Skip to content

About

Apache-2.0 Business Formation autopilot + MCP server for US law search — thin clients of corpuslaw.us, with a hash-locked human gate on every filing

Topics

Resources

Contributing

Security policy

Stars

2 stars

Watchers

0 watching

Forks

Latest commit

 

History

86 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Corpus Agent Kit — give your AI agent real U.S. law

corpus-agent-kit

Give your AI agent real US law — and let it form a company.

Open-source connectors for the Corpus legal platform: search 700,000+ provisions of federal, state, and municipal law with verbatim citations, and run a complete LLC or nonprofit formation intake end to end. Every filing still stops at a human approval gate.

Winner — Qwen Cloud Hackathon, Track 4 License smithery badge


Start here — pick your friction level

1. Zero install: point any MCP client at the hosted server

https://corpuslaw.us/api/mcp speaks streamable-HTTP MCP directly. No clone, no build, no local process:

{
  "mcpServers": {
    "corpus-law": {
      "type": "http",
      "url": "https://corpuslaw.us/api/mcp"
    }
  }
}

That is the whole setup. Ask your agent "what does Mississippi require to form an LLC?" and it will answer from live statutes with citations you can check.

Research is free to start: 100 searches/month anonymously. A free API key — instant, self-serve, no waiting list — raises it to 1,000/month. Send it as Authorization: Bearer <key>.

1b. Grok Bot / Cursor (same hosted MCP)

Grok Bot and Cursor speak remote MCP connectors. Point one at https://corpuslaw.us/api/mcp, then ask Create an LLC for Acme AI in Mississippi. Formation tools never auto-file: handoff stops at a human approval link. USDC pay is email-confirmed; filing still needs human approval.

Optional: install skills/corpus-business-formation/ for a guided intake. For Cursor Marketplace listing, see plugins/corpus/ (.cursor-plugin/) and submit the repo at https://cursor.com/marketplace/publish. Full install notes and an optional Company Formation Bot — powered by Corpus template: docs/GROK_BOT.md.

Running work log for this integration: WORKLOG.md.

2. Zero install: try the agent in a browser

corpuslaw.us/autopilot — the Formation Autopilot from this repo (autopilot/), running on Alibaba Cloud Function Compute. Describe a business in plain English; get a launch checklist linked to reviewed guides and the formation catalog, with unresolved requirements marked Needs checking, and a prefilled formation handoff. Broad keyword law matches are withheld until their relevance can be verified.

3. Drop a skill folder — or install a plugin

Two portable Agent Skills:

Copy either folder into Claude Code, Codex, Cursor, VS Code, or Hermes and the agent learns to reach for Corpus before any MCP connection exists (install paths).

Or install both skills plus the MCP URL as one plugin. This repo is a plugin marketplace. For OpenAI Codex, use a local checkout or the extracted OpenAI release archive:

codex plugin marketplace add /absolute/path/to/corpus-agent-kit
codex plugin add corpus@corpus-agent-kit

See the OpenAI package guide for archive installation, verification, and reproducible tagged builds. Restart Codex or open a new task after installation so both skills and the MCP connector load.

For Claude Code:

/plugin marketplace add teakesdev/corpus-agent-kit
/plugin install corpus@corpus-agent-kit

Hermes installs the same bundle as an Agent Plugins v1 package (plugins/corpus/):

hermes plugins install teakesdev/corpus-agent-kit/plugins/corpus
hermes plugins enable corpus
hermes plugins doctor corpus --ci

Portable packages install disabled in Hermes; enable is a separate consent step.

Qwen Code, Gemini CLI and Kimi Code install the repository itself (qwen-extension.json, gemini-extension.json and kimi.plugin.json at the root load both skills, the hosted MCP URL and the CORPUS.md context):

qwen extensions install https://github.com/teakesdev/corpus-agent-kit:corpus
gemini extensions install https://github.com/teakesdev/corpus-agent-kit

(The :corpus suffix picks the plugin without a prompt; Qwen Code also reads this repo as a Claude Code marketplace.) In Kimi Code: /plugins install https://github.com/teakesdev/corpus-agent-kit, then /reload.

中文:给身在中国的创业者和开发者

Corpus 提供美国联邦、州及市级法律检索(来自官方来源,每条结果附逐字引用),并可为身在美国境外的创业者办理美国 LLC 或非营利公司注册。仅办理美国实体,不办理中国境内公司。本项目(Corpus Formation Autopilot / Corpus Agent Kit)获得 Global AI Hackathon Series with Qwen Cloud(通义千问)Track 4(Autopilot Agent)赛道奖项, 在 Devpost 查看。

  • 接入方式: 任何支持 MCP 的客户端,填入 https://corpuslaw.us/api/mcp(Streamable HTTP,无需 API 密钥即可开始); Qwen Code / Gemini CLI / Kimi Code 用上面的一条命令安装。
  • 能做: 法律检索与引用;向州政府提交 LLC 注册(全美 50 个州及华盛顿特区),含第一年注册代理服务,每份文件提交前都有专人审核。
  • 暂不能做: 代办 EIN、接受美国境外的主要办公地址(目前需要美国街道地址)、开设银行账户、准备 Form 5472 或其他报税文件、提供法律或税务建议。 网站与付款页面为英文,支付方式为银行卡。
  • 中文指南: 在中国可以注册美国 LLC 吗?

4. Run it yourself

Clone and build — see Quickstart below.


The ten tools

Tool What it does
law.search Hybrid semantic + keyword search over 700,000+ provisions
law.get_node Full official text of one provision
law.list_coverage Which jurisdictions are indexed, and how deeply
formation.requirements A state's exact field checklist, quirks, live pricing
formation.compare 19 formation services on price, renewals and agent capability — Corpus included, same rubric
formation.lookup_naics Find an industry code from a plain-English description
formation.handoff Validate a draft → prefilled, human-approved handoff link
formation.checkout Create the founder's order + USDC (Solana) payment request — self-custody wallet, email confirmation within 48h, human review before any filing
formation.payment_status Poll the USDC payment: awaiting / paid / expired / underpaid / held, plus email-confirmation state
account.status Quota, tier, and credit balance

Formation tools are never metered — they stay free with or without a key.

Coverage

700,000+ provisions across 20 jurisdictions (18 fully searchable) — federal, state and municipal law, ingested from official sources. Coverage grows, so this README does not pin per-jurisdiction counts: call law.list_coverage for the live list with provision counts and GIS status. It reports honestly when a jurisdiction is not covered rather than guessing.

What's in this repo

  • autopilot/ — Formation Autopilot: a Qwen Cloud agent that turns an ambiguous founder description into a launch checklist with guide and catalog sources and a prefilled, human-approved formation handoff. (Qwen Cloud Hackathon Track 4 winner.)
  • mcp-server/ — zero-dependency stdio MCP server, for clients that cannot speak HTTP MCP.
  • widget/ — embeddable law-search widget (Preact, ~12 kB gzipped).
  • skills/corpus-business-formation/ — portable Agent Skill (formation).
  • skills/corpus-legal-research/ — portable Agent Skill (live statute search).
  • plugins/corpus/ — plugin wrappers for Hermes, Claude Code, and Cursor, sharing generated skills and the headerless hosted MCP endpoint. Install guide: docs/INSTALL.md.
  • plugins/corpus-codex/ — the OpenAI Codex package. The only package that carries the OpenAI-only $0-formation first-response notice.

All of these are thin clients of the hosted Corpus platform. The law corpus, hybrid search engine, human approval gate, and filing execution live in the hosted service — this repo never touches money and never files anything.

Architecture

Architecture diagram

See docs/architecture.md for the Mermaid source.

What's open vs. what's hosted

Layer This repo (Apache-2.0) Hosted Corpus platform (closed)
Formation Autopilot agent ✅ autopilot/ —
Two-lane Qwen routing ✅ autopilot/src/ —
MCP stdio bridge (corpus-mcp) ✅ mcp-server/ —
Embeddable widget ✅ widget/ —
Law database (700,000+ provisions, Aurora) — ✅
Hybrid search engine + /api/mcp — ✅
/formation checkout + GATE 2 — ✅
Stripe payment + state filing execution — ✅

Two-lane model routing

Legacy /api/chat uses two Qwen models with different cost/quality profiles:

  • Fast lane (QWEN_MODEL_FAST, default qwen-flash-2025-07-28): all standard turns — intent parsing, law search, checklist generation. Low latency, low spend.
  • Critical lane (QWEN_MODEL_CRITICAL, default qwen3.7-max): the final pre-handoff draft review only. Higher quality for the one turn that shapes the prefilled filing URL.

The lane switch is automatic. Routing logic lives in autopilot/src/agent.ts. The hourly spend cap (SPEND_CAP_TURNS_PER_HOUR) applies across both lanes. The sourced /api/plan path builds deterministic guide/catalog items and uses the fast lane only for optional ordering; model output cannot add legal sources.

Human in the loop (gates)

Filing (GATE 2) — unchanged. The autopilot / MCP formation flow produces a prefilled draft / handoff URL. Agents never auto-file. On the Corpus platform, every filing payload still passes GATE 2: a human reviews and approves a snapshot of the exact filing payload, cryptographically bound to a hash of that payload. If the payload changes by a single byte after approval, the gate rejects it. The agent is architecturally incapable of bypassing filing approval.

Spend — updated. Agents may settle formation (and related) charges in USDC (Solana) with email confirmation only — no extra human review of the payment itself. Card / web checkout human flows still exist on corpuslaw.us. Docs refer to this as a USDC checkout / pay request via Corpus until the exact MCP tool id is named.

Sept 15 demo path — unchanged. formation.requirements → draft → formation.handoff COMPLETE → approval link. Completing USDC pay is not required for the livestream demo.

Quickstart

Prerequisites

node >=20
npm >=9

Clone and install all workspaces:

git clone https://github.com/teakesdev/corpus-agent-kit.git
cd corpus-agent-kit
npm install

Environment variables

Copy and fill .env.example (required for autopilot; mcp-server and widget read CORPUS_BASE_URL / CORPUS_API_KEY from env at runtime):

cp .env.example .env
# edit .env — at minimum set QWEN_API_KEY and CORPUS_API_KEY
Variable Default Purpose
QWEN_API_KEY (required) Qwen Cloud API key
QWEN_BASE_URL (required) Qwen OpenAI-compatible base URL (e.g. https://dashscope-intl.aliyuncs.com/compatible-mode/v1)
QWEN_MODEL_FAST qwen-flash-2025-07-28 Fast-lane model — standard turns
QWEN_MODEL_CRITICAL qwen3.7-max Critical-lane model — pre-handoff review
CORPUS_BASE_URL https://corpuslaw.us Hosted Corpus platform base URL
CORPUS_API_KEY (optional) Corpus platform API key (optional — anonymous is rate-limited)
SPEND_CAP_TURNS_PER_HOUR 120 Abuse guard: max agent turns per hour
PORT 9000 HTTP server port (autopilot backend)

autopilot — Formation Autopilot agent

cp .env.example .env        # fill QWEN_API_KEY + CORPUS_API_KEY
npm install
npm run build               # compiles all workspaces
cd autopilot && npm start   # starts the autopilot HTTP server
# open http://localhost:9000

The server exposes:

  • GET /healthz — liveness probe
  • POST /api/chat — agent turn endpoint
  • POST /api/plan — planning with guide and catalog sources; unresolved law remains Needs checking
  • POST /api/plan/handoff — validate a ready-mode draft through the hosted handoff
  • GET / — chat UI

Deploy to Alibaba Cloud Function Compute: see autopilot/deploy/alibaba/README.md.

mcp-server — stdio MCP bridge

Most clients do not need this. The hosted endpoint https://corpuslaw.us/api/mcp speaks streamable-HTTP MCP directly — see Start here. Use this bridge only for a client that can launch a stdio process but cannot speak HTTP MCP.

{
  "mcpServers": {
    "corpus-law": {
      "command": "npx",
      "args": ["-y", "@corpuslaw/mcp-server"],
      "env": { "CORPUS_API_KEY": "your-key-here" }
    }
  }
}

Nothing to clone or build. The bridge forwards every MCP request to the hosted endpoint, adding your key — so formation handoffs it produces are attributed to you. CORPUS_API_KEY is optional; without it the bridge runs on the anonymous allotment.

Use the full scoped name. npx corpus-mcp resolves to an unrelated package on npm — only @corpuslaw/mcp-server is ours.

Running from a clone instead
cd mcp-server && npm install && npm run build
{
  "mcpServers": {
    "corpus-law": {
      "command": "node",
      "args": ["/absolute/path/to/corpus-agent-kit/mcp-server/dist/index.js"],
      "env": { "CORPUS_API_KEY": "your-key-here" }
    }
  }
}

Replace /absolute/path/to/corpus-agent-kit with the path to your clone.

widget — embeddable law-search

cd widget
npm run build               # outputs dist/widget.js (loader) and dist/widget-app.js (app)

Embed in any page using the hosted loader. Point src at the Corpus host (a relative path would 404 on the host page's own origin) and pass your widget key (pk_…):

<script async src="https://corpuslaw.us/widget/widget.js"
        data-corpus-key="pk_live_…"
        data-corpus-origin="https://corpuslaw.us"></script>

Deploy to Alibaba Cloud

See autopilot/deploy/alibaba/README.md for Function Compute deploy instructions (Serverless Devs s CLI).

License

Apache-2.0 — see LICENSE.

About

Apache-2.0 Business Formation autopilot + MCP server for US law search — thin clients of corpuslaw.us, with a hash-locked human gate on every filing

Topics

Resources

Contributing

Security policy

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages