---
url: /operations/mcp.md
---

# MCP (optional)

Besides static tools, MUCGPT allows configuration of MCP sources, for which tools are fetched and can be called.

Configure MCP in `core.config.yaml` under the `mcp` section:

```yaml
mcp:
    sources:
        "<source_id>":
            url: "http://mcpdoc-server:8088/sse"
            transport: "sse"
    cache_ttl: 43200 # seconds, default: 12h
```

Or via environment variable:

```bash
export MUCGPT_CORE_MCP__SOURCES='{"<source_id>": {"url": "...", "transport": "sse"}}'
export MUCGPT_CORE_MCP__CACHE_TTL=43200
```

* `sources`: Map of MCP source configurations.
  * `<source_id>`: Unique id of one MCP source.
    * `url`: URL of the MCP endpoint.
    * `forward_token`: If the OAuth 2.0 JWT token used for authentication should be forwarded to the MCP endpoint. Only enable this for HTTPS endpoints or trusted internal networks — over plaintext HTTP anyone able to observe the connection can read the token.
    * `transport`: Transport protocol (`"sse"` or `"streamable_http"`), see <https://modelcontextprotocol.io/specification/2025-06-18/basic/transports>
* `cache_ttl`: Time-to-live of cached MCP tools in seconds (default: 12h).

## Tool call budgets

MCP and local tools default to 10 calls per user turn, including approval
resumes. Set `run_limit` on an MCP source to replace that per-tool default;
source limits also cover newly discovered or renamed tools. An optional
`overrides` entry can replace the source limit for an exact discovered tool
name. Explicit `null` means unlimited:

```yaml
mcp:
    sources:
        knowledge:
            url: "https://mcp.example.org/mcp"
            transport: "streamable_http"
            run_limit: 4
            overrides:
                - name: "read_document"
                  run_limit: 8
                - name: "server_info"
                  run_limit: null
```

An omitted override inherits the source limit; explicit `null` disables the
limit for that tool. Limits must be positive integers. The source budget is
applied separately to each tool, not shared across the server. Excess calls
return a tool error so the agent can finish with its available information.
Configuration is applied on MCP cache hits as well as fresh discovery.

For Deep Agents built-ins, configure limits alongside enabled tools under each
model's `deep_agent` settings:

```yaml
deep_agent:
    enabled_builtin_tools: ["read_file", "grep"]
    builtin_tool_run_limits:
        read_file: 30
        grep: null
```

Enabled `read_file` and `grep` each default to 20 calls per turn. Partial
overrides retain unspecified defaults; explicit `null` disables one limit.
Other built-ins are unlimited unless configured here.
