mcp.md

  1# Model Context Protocol
  2
  3Zed uses the [Model Context Protocol](https://modelcontextprotocol.io/) to interact with context servers.
  4
  5> The Model Context Protocol (MCP) is an open protocol that enables seamless integration between LLM applications and external data sources and tools. Whether you're building an AI-powered IDE, enhancing a chat interface, or creating custom AI workflows, MCP provides a standardized way to connect LLMs with the context they need.
  6
  7Check out the [Anthropic news post](https://www.anthropic.com/news/model-context-protocol) and the [Zed blog post](https://zed.dev/blog/mcp) for a general intro to MCP.
  8
  9## Installing MCP Servers
 10
 11### As Extensions
 12
 13One of the ways you can use MCP servers in Zed is by exposing them as an extension.
 14Check out the [MCP Server Extensions](../extensions/mcp-extensions.md) page to learn how to create your own.
 15
 16Thanks to our awesome community, many MCP servers have already been added as extensions.
 17You can check which ones are available via any of these routes:
 18
 191. [the Zed website](https://zed.dev/extensions?filter=context-servers)
 202. in the app, open the Command Palette and run the `zed: extensions` action
 213. in the app, go to the Agent Panel's top-right menu and look for the "View Server Extensions" menu item
 22
 23In any case, here are some popular available servers:
 24
 25- [Context7](https://zed.dev/extensions/context7-mcp-server)
 26- [GitHub](https://zed.dev/extensions/github-mcp-server)
 27- [Puppeteer](https://zed.dev/extensions/puppeteer-mcp-server)
 28- [Gem](https://zed.dev/extensions/gem)
 29- [Brave Search](https://zed.dev/extensions/brave-search-mcp-server)
 30- [Prisma](https://github.com/aqrln/prisma-mcp-zed)
 31- [Framelink Figma](https://zed.dev/extensions/framelink-figma-mcp-server)
 32- [Linear](https://zed.dev/extensions/linear-mcp-server)
 33- [Resend](https://zed.dev/extensions/resend-mcp-server)
 34
 35### As Custom Servers
 36
 37Creating an extension is not the only way to use MCP servers in Zed.
 38You can connect them by adding their commands directly to your `settings.json`, like so:
 39
 40```json [settings]
 41{
 42  "context_servers": {
 43    "local-mcp-server": {
 44      "command": "some-command",
 45      "args": ["arg-1", "arg-2"],
 46      "env": {}
 47    },
 48    "remote-mcp-server": {
 49      "url": "custom",
 50      "headers": { "Authorization": "Bearer <token>" }
 51    }
 52  }
 53}
 54```
 55
 56Alternatively, you can also add a custom server by accessing the Agent Panel's Settings view (also accessible via the `agent: open settings` action).
 57From there, you can add it through the modal that appears when you click the "Add Custom Server" button.
 58
 59## Using MCP Servers
 60
 61### Configuration Check
 62
 63Regardless of how you've installed MCP servers, whether as an extension or adding them directly, most servers out there still require some sort of configuration as part of the setup process.
 64
 65In the case of extensions, after installing it, Zed will pop up a modal displaying what is required for you to properly set it up.
 66For example, the GitHub MCP extension requires you to add a [Personal Access Token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens).
 67
 68In the case of custom servers, make sure you check the provider documentation to determine what type of command, arguments, and environment variables need to be added to the JSON.
 69
 70To check if your MCP server is properly configured, go to the Agent Panel's settings view and watch the indicator dot next to its name.
 71If they're running correctly, the indicator will be green and its tooltip will say "Server is active".
 72If not, other colors and tooltip messages will indicate what is happening.
 73
 74### Agent Panel Usage
 75
 76Once installation is complete, you can return to the Agent Panel and start prompting.
 77
 78Some models are better than others when it comes to picking up tools from MCP servers.
 79Mentioning your server by name always helps the model to pick it up.
 80
 81However, if you want to _ensure_ a given MCP server will be used, you can create [a custom profile](./agent-panel.md#custom-profiles) where all built-in tools (or the ones that could cause conflicts with the server's tools) are turned off and only the tools coming from the MCP server are turned on.
 82
 83As an example, [the Dagger team suggests](https://container-use.com/agent-integrations#zed) doing that with their [Container Use MCP server](https://zed.dev/extensions/mcp-server-container-use):
 84
 85```json [settings]
 86"agent": {
 87  "profiles": {
 88    "container-use": {
 89      "name": "Container Use",
 90      "tools": {
 91        "fetch": true,
 92        "thinking": true,
 93        "copy_path": false,
 94        "find_path": false,
 95        "delete_path": false,
 96        "create_directory": false,
 97        "list_directory": false,
 98        "diagnostics": false,
 99        "read_file": false,
100        "open": false,
101        "move_path": false,
102        "grep": false,
103        "edit_file": false,
104        "terminal": false
105      },
106      "enable_all_context_servers": false,
107      "context_servers": {
108        "container-use": {
109          "tools": {
110            "environment_create": true,
111            "environment_add_service": true,
112            "environment_update": true,
113            "environment_run_cmd": true,
114            "environment_open": true,
115            "environment_file_write": true,
116            "environment_file_read": true,
117            "environment_file_list": true,
118            "environment_file_delete": true,
119            "environment_checkpoint": true
120          }
121        }
122      }
123    }
124  }
125}
126```
127
128### Tool Approval
129
130Zed's Agent Panel includes the `agent.always_allow_tool_actions` setting that, if set to `false`, will require you to give permission for any editing attempt as well as tool calls coming from MCP servers.
131
132You can change this by setting this key to `true` in either your `settings.json` or through the Agent Panel's settings view.
133
134### External Agents
135
136Note that for [external agents](./external-agents.md) connected through the [Agent Client Protocol](https://agentclientprotocol.com/), access to MCP servers installed from Zed may vary depending on the ACP agent implementation.
137
138Regarding the built-in ones, Claude Code and Codex both support it, and Gemini CLI does not yet.
139In the meantime, learn how to add MCP server support to Gemini CLI through [their documentation](https://github.com/google-gemini/gemini-cli?tab=readme-ov-file#using-mcp-servers).