# load_mcp_config

> **Function** in `deepagents_code`

📖 [View in docs](https://reference.langchain.com/python/deepagents-code/mcp_tools/load_mcp_config)

Load and validate MCP configuration from a JSON file.

Supports multiple server types:

- stdio: Process-based servers with `command`, `args`, `env` fields (default)
- sse: Server-Sent Events servers with `type: "sse"`, `url`, and optional `headers`
- http: HTTP-based servers with `type: "http"`, `url`, and optional `headers`

Any server type may also set an optional tool filter:

- `allowedTools`: list of tool names or patterns to keep (all others dropped)
- `disabledTools`: list of tool names or patterns to drop (all others kept)

Entries are either literal tool names or `fnmatch`-style glob patterns
(entries containing `*`, `?`, or `[`). Each entry is matched against both
the bare MCP tool name and the server-prefixed form
(`f"{server_name}_{tool}"`), so either `read_*` or `fs_read_*` works.
Setting both fields on a single server is an error.

## Signature

```python
load_mcp_config(
    config_path: str,
) -> dict[str, Any]
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `config_path` | `str` | Yes | Path to the MCP JSON configuration file. |

## Returns

`dict[str, Any]`

Parsed configuration dictionary.

---

[View source on GitHub](https://github.com/langchain-ai/deepagents/blob/0412009c5441bef8d75a427e1da8909e33ab5b56/libs/code/deepagents_code/mcp_tools.py#L607)