MCP Integration
The AgentTeams CLI ships with a built-in MCP (Model Context Protocol) stdio server. Agent CLIs such as Claude Code can search eight internal entity types — plans, completion reports, co-actions, post-mortems, conventions, documents, code reviews, and comments — list them exactly within a project or known parent scope, and read the full records they select. Everything is read-only.
The agentteams mcp subcommands handle registration, so you never have to look up each tool’s config syntax. For exact lists, relevance search, full-record reads, and the complete tool catalog, see MCP Tools.
AgentTeams CLI requires Node.js
>=20.12.0. This also applies when registering throughnpx -y @agentteams/cli mcp.
Automatic registration
Run it with no arguments and it prints the project-scope detection result and plan for this repository without changing a single file.
agentteams mcp installFor each client you get the detection evidence, the target config file, and the strategy that would be used. A batch project-scope preview never writes files; choose one client to apply.
agentteams mcp install --client claude-codeIf you truly need a machine-wide user-scope registration, preview and approve it explicitly.
agentteams mcp install --scope user
agentteams mcp install --scope user --yesOnly --scope user --yes performs a batch user-scope apply. A batch apply with the default project scope is refused because the CLI cannot safely choose repository files for every client.
⚠️ A user-scope registration is machine-wide and binds the client to one AgentTeams project. If that client already has an
agentteamsserver pointing at a different project, applying the plan re-points it. Check the project and team IDs in the preview output first.
Registering a single client
# project scope (default): this repository only
agentteams mcp install --client claude-code
# user scope: the whole machine (explicit opt-in)
agentteams mcp install --client cursor-cli --scope userUse config when you only want the fragment and no changes. Omit --client to print them all.
agentteams mcp config --client codexconfig also defaults to project scope. Add --scope user only when you need a user-scope fragment. It never modifies a file or client setting, and it never prints your real API key.
Supported clients
| Client | --client | Automatic registration |
|---|---|---|
| Claude Code | claude-code | Supported |
| GitHub Copilot CLI | copilot-cli | Supported |
| OpenCode | opencode | Supported |
| Amp | amp | Supported |
| Cursor CLI | cursor-cli | Supported |
| Kimi CLI | kimi-cli | Supported |
| Antigravity | antigravity | Supported |
| Codex | codex | Prints the fragment |
Codex has no safe automated path, so paste the TOML fragment that config prints. The target config file for each scope is listed in MCP Tools.
Orca is not an MCP client. Register the individual agents you launch from Orca using the table above — see Orca Integration.
Migrating an existing user-scope registration
User-scope registrations created under the old default are not deleted or overwritten automatically. Migrate each repository as follows:
- From the repository root, run
agentteams mcp installand verify the project-scope plan plus its project and team IDs. - Apply
agentteams mcp install --client <client>for that repository, or manually apply the fragment fromagentteams mcp config --client <client>. - After the client loads the project config successfully, remove the old user-scope
agentteamsserver with that client’s own removal command or settings UI.
If an existing user-scope server is bound to a different project than the current repository, the MCP server exits with a project binding mismatch before registering any search/list/get tools. Check the local and bound project IDs in the error and re-register from the current repository at project scope.
Required environment variables
Agent CLIs spawn the MCP server from an arbitrary working directory, so the three values below must be carried by the server config itself rather than by a project-folder config file.
| Environment variable | Value |
|---|---|
AGENTTEAMS_API_KEY | Project API key |
AGENTTEAMS_PROJECT_ID | Target project ID |
AGENTTEAMS_TEAM_ID | Team ID |
Key handling differs per scope.
- User scope — automatic registration writes the literal key and restricts the config file to owner-only permissions.
- Project scope — committable files carry only an environment reference. Set the key in your shell environment beforehand.
Troubleshooting
| Symptom | Cause and fix |
|---|---|
| Registration is skipped as “already registered” | A server with that name already exists and the tool refuses to overwrite it. Remove it with that tool first, then re-run. |
| Registration is reported as “apply manually” | No automated path exists for that combination. Paste the printed fragment. This is not a failure. |
| Registration fails with a parse error | The target config file is broken. The CLI leaves the original untouched, so fix the file and re-run. |
| Server exits immediately on variable substitution | The client failed to substitute a reference like ${AGENTTEAMS_API_KEY}. Use literal values or check your shell environment. |
| Server exits immediately, configuration not found | One or more of the three required environment variables is missing. |
| Server exits with a project binding mismatch | A user-scope server is bound to another project. Re-register from the current repository at project scope. |
| Connects, but every call fails with 401 | The key value itself is wrong. Reissue the key in the web app or confirm you are targeting the right project. |
Manual registration
There is always a way back to doing it by hand, and config prints exactly that fragment.
agentteams mcp config --client claude-code --scope projectFor Claude Code, for example, you can register directly:
claude mcp add agentteams --scope user -- agentteams mcpIf you edit an mcpServers-style JSON config by hand, the shape is:
{
"mcpServers": {
"agentteams": {
"command": "agentteams",
"args": ["mcp"],
"env": {}
}
}
}No credentials or project binding go into the entry. The server reads .agentteams/config.json and the OS credential store at request time, so nothing in an MCP config file is a secret.
Which runtime the entry spawns
agentteams mcp install / config picks the command from what your machine can actually spawn, and prints which one it chose:
agentteams mcp— used when a globalagentteamsis onPATH(npm install -g @agentteams/cli). This is the fast path: no download, no cold start.npx -y @agentteams/cli mcp— used when it is not. Registering throughnpx @agentteams/cli mcp installwithout a global install lands here, as does any MCP client launched from a GUI that never inherits a login shell’sPATH.
If you write the config by hand and the client reports “server failed to start”, the bare executable is almost certainly not on the PATH that client sees. Either install the CLI globally or use the npx form:
{
"mcpServers": {
"agentteams": {
"command": "npx",
"args": ["-y", "@agentteams/cli", "mcp"],
"env": {}
}
}
}