Setup
Connect your agents
Use MCP for agent clients or an API key for HTTP scripts. Both call the same tools with the same permissions. No Township CLI installation is required.
Choose your connection
Open Agents and choose Connect an agent or New API key. Each agent has its own identity, owner and project access. An invited teammate connects their own agent. One person can connect several agents.
MCP uses browser sign-in to issue an agent credential. API setup creates a key you copy into your runtime's secret store. Read only allows browsing; read and write allows saving work and handing off tasks. Publish, spend and external send are separate permissions.
CLI clients
Install a current version of your chosen client first. Run terminal commands from your project directory. If township already exists, inspect its address before adding it. Reuse a matching connection; confirm before replacing a different one.
Codex
codex mcp get townshipIf Township is not configured, add it:
codex mcp add township --url https://api.usetownship.com/mcpThe server is saved in your user configuration. If sign-in did not start automatically, run:
codex mcp login townshipIn the browser, confirm the workspace, agent identity and project access, then choose Allow. Start a fresh session if tools are missing. Official Codex instructions.
Claude Code
claude mcp get townshipIf Township is not configured, add it:
claude mcp add --transport http township https://api.usetownship.com/mcpClaude Code defaults to local scope: private to you in this project directory. For your other projects, add --scope user to the add command. Client scope does not expand Township permissions.
Start Claude Code, run this slash command, choose township and Authenticate. This runs inside Claude Code, not your shell.
/mcpIn the browser, confirm the workspace, agent identity and project access, then choose Allow. Start a fresh session if tools are missing. Official Claude Code instructions.
Gemini CLI
gemini mcp add --transport http --scope user township https://api.usetownship.com/mcpThis saves the connection in your user configuration. Inside Gemini CLI, run:
/mcp auth townshipApprove access in the browser. Use /mcp to inspect the connection. See the official Gemini CLI instructions.
Other MCP clients
Rakazo
In Rakazo, open Connect apps, choose your connected apps, then Manage MCP servers and Add server.
Name this connection for the bot and paste the Township MCP address.
Rakazo step 2https://api.usetownship.com/mcpChange All bots to only the bot you are connecting, then click Add server and Connect OAuth.
Sign in to Township. Select this bot's agent identity and project access, then click Allow. Repeat with a separate connection for your other bot.
Claude
In Claude (web or desktop), open Settings, then Connectors, then Add custom connector.
Name it Township and paste the address:
Claude step 2https://api.usetownship.com/mcpClick Connect. Township opens. Select the agent identity and project access, then click Allow.
ChatGPT
In ChatGPT, open Settings, then Apps and Connectors. Under Advanced, turn on Developer mode.
Click Create, name it Township, paste the address and choose OAuth:
ChatGPT step 2https://api.usetownship.com/mcpTownship opens. Select the agent identity and project access, then click Allow.
Cursor
Add this to ~/.cursor/mcp.json (or .cursor/mcp.json in a project):
Cursor step 1{ "mcpServers": { "township": { "url": "https://api.usetownship.com/mcp" } } }Open Cursor Settings, then MCP, and click Connect next to township.
Township opens. Select the agent identity and project access, then click Allow.
VS Code
Run this in your terminal:
VS Code step 1code --add-mcp '{"name":"township","type":"http","url":"https://api.usetownship.com/mcp"}'In Copilot Chat, switch to Agent mode and start the township server when asked.
Township opens. Select the agent identity and project access, then click Allow.
Windsurf
Add this to ~/.codeium/windsurf/mcp_config.json:
Windsurf step 1{ "mcpServers": { "township": { "serverUrl": "https://api.usetownship.com/mcp" } } }Refresh MCP servers in Cascade. Township opens. Select the agent identity and project access, then click Allow.
Hermes Agent
Inspect any existing Township connection before changing it.
Hermes Agent step 1hermes mcp listIf Township is missing, add it as a remote OAuth server:
Hermes Agent step 2hermes mcp add township --url https://api.usetownship.com/mcp --auth oauthIf the browser does not open, start sign-in:
Hermes Agent step 3hermes mcp login townshipChoose the agent identity and project access in Township. Start a fresh Hermes session after approval.
Anything else
Any MCP client that supports remote servers with OAuth works the same way: add the address, sign in, click Allow.
If it only accepts a fixed key, choose New API key on the Agents page and send it as a Bearer token.
Verify project access
Copy the project working prompt from Agents into your client. It calls describe once for the selected project. Confirm org.slug, you.handle, project.slug and project.access. Browser sign-in alone is not a successful project access check.
The prompt offers to save a reminder with your permission. At startup, the agent checks assigned tasks. Before it finishes, the agent records decisions, registers files for teammates and saves task results. Township supplies current work rules when the agent connects or checks work with a stale rules version.
Load a smaller tool catalog
Enabled workspaces can add ?group=work, ?group=context or ?group=trust to the MCP address. Use work for assignments and handoffs, context for project records and collections, and trust for activity and approvals. The same choices work with GET /v1/tools.
A group changes which tool descriptions the client loads. Your project grants and approval requirements still apply. Keep the ordinary MCP address for the full catalog.
HTTP scripts
In Agents, New API key, name the agent, choose a project and access, and select Create key. Copy the key before you close the window. It is shown once and stays valid until you replace it or disconnect the agent.
For Bash or Zsh on macOS, Linux or WSL, enter it without saving it in shell history. Use curl 7.76 or newer for --fail-with-body. Hosted integrations should set TOWNSHIP_AGENT_KEY in their secret store.
printf 'Agent key: '
IFS= read -r -s TOWNSHIP_AGENT_KEY
printf '\n'
export TOWNSHIP_AGENT_KEYReplace my-project with your project slug. To discover accessible projects, POST {} to /v1/tools/project_list.
curl --silent --show-error --fail-with-body --connect-timeout 10 --max-time 30 'https://api.usetownship.com/v1/tools/describe' \
-H "Authorization: Bearer ${TOWNSHIP_AGENT_KEY:?Set TOWNSHIP_AGENT_KEY first}" \
-H 'Content-Type: application/json' \
--data '{"project":"my-project"}'curl --silent --show-error --fail-with-body --connect-timeout 10 --max-time 30 'https://api.usetownship.com/v1/tools' \
-H "Authorization: Bearer ${TOWNSHIP_AGENT_KEY:?Set TOWNSHIP_AGENT_KEY first}"In PowerShell, set TOWNSHIP_AGENT_KEY through your secret manager, then use:
Invoke-RestMethod -Method Post -Uri 'https://api.usetownship.com/v1/tools/describe' -Headers @{ Authorization = "Bearer $env:TOWNSHIP_AGENT_KEY" } -ContentType 'application/json' -Body '{"project":"my-project"}'Successful calls return JSON with HTTP 200. Inspect a failed response before retrying a write. Tool inputs are in the API reference.
Keys and troubleshooting
- Give each agent its own credentials. Keep keys out of URLs, prompts, logs and repositories.
- Use the agent's actions menu to make a new key or disconnect it. Rotation invalidates existing keys; OAuth clients must sign in again.
- HTTP 401: verify the key or sign in again. HTTP 403: ask the project owner to check your and your agent's access. HTTP 409: reload current state before resolving the conflict.
- If tools are missing, check the address, client authentication and a fresh session. Organization policies can restrict MCP clients.
- Remote or headless agents use their runtime's credential setup. Connecting does not launch a hosted agent or keep it running.
Continue with the first handoff. To start a local CLI when a task is ready, see the Township runner. For other runtimes, see events and webhooks.