> ## Documentation Index
> Fetch the complete documentation index at: https://docs.symbioticsec.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# MCP servers

> Add MCP servers to Symbiotic Code

You can add external tools to Symbiotic Code using the [Model Context Protocol](https://modelcontextprotocol.io/docs/getting-started/intro), or MCP. Symbiotic Code supports both local and remote servers.

<Warning>
  When you use an MCP server, it adds to the context. This can quickly add up if you have a lot of tools, as well as **become a potential security liability**. So we recommend being careful with which MCP servers you use.
</Warning>

***

## Enable

You can define MCP servers in your [configuration file](/code/basics/configuration_file) under `mcp`. Add each MCP with a unique name. You can refer to that MCP by name when prompting the LLM.

```jsonc title="symbiotic.jsonc" {6} theme={null}
{
  "$schema": "https://config.symbioticsec.ai/config.json",
  "mcp": {
    "name-of-mcp-server": {
      // ...
      "enabled": true,
    },
    "name-of-other-mcp-server": {
      // ...
    },
  },
}
```

You can also disable a server by setting `enabled` to `false`. This is useful if you want to temporarily disable a server without removing it from your config.

## Local

Add local MCP servers by setting `type` to `"local"` within the MCP object.

```jsonc title="symbiotic.jsonc" {15} theme={null}
{
  "$schema": "https://config.symbioticsec.ai/config.json",
  "mcp": {
    "my-local-mcp-server": {
      "type": "local",
      // Or ["bun", "x", "my-mcp-command"]
      "command": ["npx", "-y", "my-mcp-command"],
      "enabled": true,
      "environment": {
        "MY_ENV_VAR": "my_env_var_value",
      },
    },
  },
}
```

The command is how the local MCP server is started. You can also pass in a list of environment variables as well.

For example, here's how you can add the test [`@modelcontextprotocol/server-everything`](https://www.npmjs.com/package/@modelcontextprotocol/server-everything) MCP server.

```jsonc title="symbiotic.jsonc" theme={null}
{
  "$schema": "https://config.symbioticsec.ai/config.json",
  "mcp": {
    "mcp_everything": {
      "type": "local",
      "command": ["npx", "-y", "@modelcontextprotocol/server-everything"],
    },
  },
}
```

And to use it I can add `use the mcp_everything tool` to my prompts.

```txt "mcp_everything" theme={null}
use the mcp_everything tool to add the number 3 and 4
```

***

#### Options

Here are all the options for configuring a local MCP server.

| Option        | Type    | Required | Description                                                                         |
| ------------- | ------- | -------- | ----------------------------------------------------------------------------------- |
| `type`        | String  | Yes      | Type of MCP server connection, must be `"local"`.                                   |
| `command`     | Array   | Yes      | Command and arguments to run the MCP server.                                        |
| `environment` | Object  |          | Environment variables to set when running the server.                               |
| `enabled`     | Boolean |          | Enable or disable the MCP server on startup.                                        |
| `timeout`     | Number  |          | Timeout in ms for fetching tools from the MCP server. Defaults to 5000 (5 seconds). |

***

## Remote

Add remote MCP servers by setting `type` to `"remote"`.

```json title="symbiotic.json" theme={null}
{
  "$schema": "https://config.symbioticsec.ai/config.json",
  "mcp": {
    "my-remote-mcp": {
      "type": "remote",
      "url": "https://my-mcp-server.com",
      "enabled": true,
      "headers": {
        "Authorization": "Bearer MY_API_KEY"
      }
    }
  }
}
```

The `url` is the URL of the remote MCP server and with the `headers` option you can pass in a list of headers.

***

#### Options

| Option    | Type    | Required | Description                                                                         |
| --------- | ------- | -------- | ----------------------------------------------------------------------------------- |
| `type`    | String  | Yes      | Type of MCP server connection, must be `"remote"`.                                  |
| `url`     | String  | Yes      | URL of the remote MCP server.                                                       |
| `enabled` | Boolean |          | Enable or disable the MCP server on startup.                                        |
| `headers` | Object  |          | Headers to send with the request.                                                   |
| `oauth`   | Object  |          | OAuth authentication configuration.                                                 |
| `timeout` | Number  |          | Timeout in ms for fetching tools from the MCP server. Defaults to 5000 (5 seconds). |
