# MCP

URL: https://www.agencytitan.com/docs/tag/mcp

**External AI via MCP** — AgencyTitan hosts a [Model Context Protocol](https://modelcontextprotocol.io) server so an external model (Claude, ChatGPT, Gemini, Grok, Cursor, Claude Code, or any MCP-capable host) can work with your agency data. The host model thinks; AgencyTitan returns a router-selected internal tool pack plus instructions/knowledge, then executes allowlisted tools and public REST as the authenticated identity. Every call is **tenant-pinned** and runs with that identity's permissions. This is not AgencyTitan calling a tenant's external MCP server.

Server URL (Streamable HTTP):

### `https://api.agencytitan.com/v1/mcp`

## Authentication

OAuth and API keys are **equal first-class paths** for MCP. Use whichever your client supports:

| Path | Best for | How |
|---|---|---|
| **OAuth 2.0** | Claude.ai, ChatGPT, and other hosts that discover OAuth | Paste the MCP URL; the host runs discovery → authorize → token |
| **API key (bearer)** | Cursor, Claude Code, VS Code, and clients that set request headers | `Authorization: Bearer at_live_…` (or an OAuth access token) |

Both resolve to `{ userId, tenantId }` and work on every `/v1` surface (REST and MCP). Create keys and manage sessions under **Settings → System → API & MCP**.

## Connect to AgencyTitan's MCP server

### Cursor

Add the following to your `.cursor/mcp.json` file (or Settings → MCP):

```json
{
  "mcpServers": {
    "agency-titan": {
      "url": "https://api.agencytitan.com/v1/mcp",
      "headers": { "Authorization": "Bearer at_live_YOUR_KEY_HERE" }
    }
  }
}
```

### Claude Code

```bash
claude mcp add --transport http agency-titan https://api.agencytitan.com/v1/mcp \
  --header "Authorization: Bearer at_live_YOUR_KEY_HERE"
```

### ChatGPT / Claude.ai

Paste the MCP URL into the host's custom connector UI:

```text
https://api.agencytitan.com/v1/mcp
```

Use **OAuth** as the connection mechanism. Unauthenticated requests return `401` with `WWW-Authenticate` pointing at protected-resource metadata. The host then:

1. Fetches `/.well-known/oauth-protected-resource/v1/mcp`
2. Fetches `/.well-known/oauth-authorization-server`
3. Registers a public client via `POST /oauth/register` (Dynamic Client Registration)
4. Opens AgencyTitan's authorize page (PKCE) so you pick which agency to grant
5. Exchanges the code at `POST /oauth/token` and calls MCP with the access token

No API key paste is required for this path.

### VS Code

Add the following to your `.vscode/mcp.json` file in your workspace:

```json
{
  "servers": {
    "agency-titan": {
      "type": "http",
      "url": "https://api.agencytitan.com/v1/mcp",
      "headers": { "Authorization": "Bearer at_live_YOUR_KEY_HERE" }
    }
  }
}
```

### Custom / Other

MCP is an open protocol supported by many clients. Use the server URL `https://api.agencytitan.com/v1/mcp` and OAuth when the client supports it. If your client does not support OAuth, pass an API key in the `Authorization` header as a Bearer token:

```json
{
  "mcpServers": {
    "agency-titan": {
      "url": "https://api.agencytitan.com/v1/mcp",
      "headers": { "Authorization": "Bearer at_live_YOUR_KEY_HERE" }
    }
  }
}
```

## Rate limits

MCP calls are limited to **240 requests per minute per agency**, plus **120 requests per minute per subject** (API key or OAuth client), separately from the REST budget. Exceeding either limit returns a JSON-RPC error with a `Retry-After` header.

## Operations

_This tag has no REST operations (guide / concept page)._

## Useful links

- Interactive page: https://www.agencytitan.com/docs/tag/mcp
- API reference home: https://www.agencytitan.com/docs/
- This page as Markdown: https://www.agencytitan.com/docs/tag/mcp.md
- Full API Markdown: https://api.agencytitan.com/v1/llms.txt
