Tangle ships a Model Context Protocol server that exposes the same domain operations the API does, but over JSON-RPC stdio. Point an MCP-aware AI assistant at it and it can list repos, read code, open issues, merge PRs, and more.
bun run mcp
# or directly:
bun src/mcp/serve.tsThe server speaks LSP-style framed JSON-RPC on stdin/stdout. All human-readable output goes to stderr.
By default the MCP runs as the instance owner — i.e., whoever signed up first. Override with:
TANGLE_MCP_USER=alice bun src/mcp/serve.ts # acts as user "alice"
TANGLE_MCP_USER=anonymous bun src/mcp/serve.ts # only public dataEvery domain tool runs that user's permission gate (resolveRepoAccess) — so a non-owner identity can only touch repos they actually have access to.
Built-ins (atlas) — db.query, db.schemas, migrate.{status,up,down}, health.check, logs.tail.
Tangle domain (32 tools):
| Group | Tools |
|---|---|
| Identity | tangle.users.me, tangle.users.search |
| Repos | tangle.repos.{list_mine,list_by_owner,get,create,delete,fork,set_mirror} |
| Browse | tangle.git.{refs,tree,blob,commits,readme,clone_url} |
| Issues | tangle.issues.{list,get,create,update,comment,list_comments} |
| Pulls | tangle.pulls.{list,get,create,diff,merge,comment} |
| Labels | tangle.labels.{list,create} |
| Releases | tangle.releases.list |
| Webhooks | tangle.webhooks.{list,deliveries} |
Each tool advertises a JSON-Schema inputSchema — tools/list returns the catalog with parameter docs.
Point the host at the entry script. Example for ~/.config/claude/mcp.json:
{
"tangle": {
"command": "bun",
"args": ["src/mcp/serve.ts"],
"cwd": "/path/to/tangle",
"env": {
"DATABASE_URL": "postgres://postgres:postgres@localhost:5432/tangle",
"REPO_DIR": "/path/to/tangle/.tangle/repos"
}
}
}Common workflows:
- "Show me what changed in the auth module last week" —
tangle.git.commits+tangle.git.blob. - "Triage the open issues for repo X" —
tangle.issues.list+tangle.issues.updateto label/close in bulk. - "Fork upstream/foo, open a PR" —
tangle.repos.fork+tangle.pulls.createend-to-end. - "Why is webhook delivery failing?" —
tangle.webhooks.deliveriesfor the recent attempt log.
src/mcp/serve.ts shares its config (DATABASE_URL, REPO_DIR, storage settings) with the API process. Domain tools call directly into the same modules src/server.ts mounts as routes — no HTTP round-trip, no double-implementation. The auth model is owner-by-default rather than per-request because the MCP runs in-process on the operator's machine.