# Connect a coding agent with MCP

The public The-Code MCP server gives coding agents documentation, examples, endpoint schemas, and local request-structure checks. No account or API key is required to connect.

```text
https://api.thecodeapi.com/mcp
```

Transport: **Streamable HTTP**. Authentication: **none**. Add this URL as a remote HTTP MCP server in your coding agent's MCP settings. Never include a The-Code API key in this public connection.

## Codex

Add the server with the Codex CLI:

```bash
codex mcp add the-code-api --url https://api.thecodeapi.com/mcp
codex mcp list
```

Alternatively, add this entry to `~/.codex/config.toml` (your home directory's `.codex/config.toml` on Windows):

```toml
[mcp_servers.the-code-api]
url = "https://api.thecodeapi.com/mcp"
```

The CLI and Codex IDE extension share this configuration. Use either setup method, preserving any existing server entries. Start a new session after saving. See the [official Codex setup instructions](https://developers.openai.com/learn/docs-mcp).

## Cursor

Create or edit `.cursor/mcp.json` in your project. For all projects, use `~/.cursor/mcp.json` in your home directory instead. Merge this server into any existing `mcpServers` object:

```json
{
  "mcpServers": {
    "the-code-api": {
      "url": "https://api.thecodeapi.com/mcp"
    }
  }
}
```

Save the file, restart Cursor, and check that the server is enabled under **Customize → MCPs**. See the [official Cursor MCP instructions](https://cursor.com/help/customization/mcp).

## Claude Code

Run this in the project where you want the documentation available:

```bash
claude mcp add --transport http --scope local the-code-api https://api.thecodeapi.com/mcp
claude mcp list
```

The connection should report **Connected**. Restart an existing coding-agent session if it has not picked up the new server.

## Try it in your agent

After connecting, paste this prompt into Codex, Cursor, or Claude Code:

```text
Use the the-code-api MCP server to find the quick-start guide and get a Python request example. Explain the API base URL, authentication, and how to discover available models. Do not execute inference or request my API key.
```

Your agent should retrieve the documentation using tools such as `search_docs` and `get_example`. Other clients can use the same Streamable HTTP URL in their remote MCP configuration.

## What the server provides

| Tool | Purpose |
| --- | --- |
| `search_docs` | Search our public integration documentation |
| `get_endpoint_schema` | Read an allowed gateway endpoint's schema and validation limits |
| `get_example` | Retrieve a maintained cURL, Python, or JavaScript example |
| `validate_request` | Check basic request structure without calling a provider |

Documentation resources include the agent guide and public topics. The `integrate_application` prompt provides the same setup instructions as our website.

Validation is deliberately structural. Passing a check does not establish account access, sufficient credits, model availability, or provider-specific parameter support. Use synthetic sample payloads, not customer data. No MCP tool executes inference, manages keys, changes accounts, or spends credits.

## Model discovery and inference

Your application still calls authenticated `GET https://api.thecodeapi.com/v1/models` using its server-side The-Code API key. Use returned model IDs and contracts for real requests. Private account discovery through MCP is not part of this release.

Connecting this MCP server helps an agent build an integration. Configuring The-Code as the agent's own model provider is a separate setting that depends on the client.

If your client cannot connect, check that it supports remote Streamable HTTP and the configured URL. See the [agent guide](https://thecodeapi.com/docs/agents) as a direct Markdown alternative, or email [Support@the-code.org](mailto:Support@the-code.org).
