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.
 14To learn how to create your own, check out the [MCP Server Extensions](../extensions/mcp-extensions.md) page for more details.
 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 of the ones available:
 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
 41{
 42  "context_servers": {
 43    "your-mcp-server": {
 44      "source": "custom",
 45      "command": "some-command",
 46      "args": ["arg-1", "arg-2"],
 47      "env": {}
 48    }
 49  }
 50}
 51```
 52
 53Alternatively, you can also add a custom server by accessing the Agent Panel's Settings view (also accessible via the `agent: open settings` action).
 54From there, you can add it through the modal that appears when you click the "Add Custom Server" button.
 55
 56## Using MCP Servers
 57
 58### Installation Check
 59
 60Regardless of whether you're using MCP servers as an extension or adding them directly, most servers out there need some sort of configuration as part of the set up process.
 61
 62In the case of extensions, Zed will show a modal displaying what is required for you to properly set up a given server.
 63For 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).
 64
 65In 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.
 66
 67To check whether your MCP server is properly installed, go to the Agent Panel's settings view and watch the indicator dot next to its name.
 68If they're running correctly, the indicator will be green and its tooltip will say "Server is active".
 69If not, other colors and tooltip messages will indicate what is happening.
 70
 71### Using in the Agent Panel
 72
 73Once installation is complete, you can return to the Agent Panel and start prompting.
 74Mentioning your MCP server by name helps the agent pick it up.
 75
 76If you want to ensure a given server will be used, you can create [a custom profile](./agent-panel.md#custom-profiles) by turning off the built-in tools (either all of them or the ones that would cause conflicts) and turning on only the tools coming from the MCP server.
 77
 78As an example, [the Dagger team suggests](https://container-use.com/agent-integrations#add-container-use-agent-profile-optional) doing that with their [Container Use MCP server](https://zed.dev/extensions/mcp-server-container-use):
 79
 80```json
 81"agent": {
 82  "profiles": {
 83    "container-use": {
 84      "name": "Container Use",
 85      "tools": {
 86        "fetch": true,
 87        "thinking": true,
 88        "copy_path": false,
 89        "find_path": false,
 90        "delete_path": false,
 91        "create_directory": false,
 92        "list_directory": false,
 93        "diagnostics": false,
 94        "read_file": false,
 95        "open": false,
 96        "move_path": false,
 97        "grep": false,
 98        "edit_file": false,
 99        "terminal": false
100      },
101      "enable_all_context_servers": false,
102      "context_servers": {
103        "container-use": {
104          "tools": {
105            "environment_create": true,
106            "environment_add_service": true,
107            "environment_update": true,
108            "environment_run_cmd": true,
109            "environment_open": true,
110            "environment_file_write": true,
111            "environment_file_read": true,
112            "environment_file_list": true,
113            "environment_file_delete": true,
114            "environment_checkpoint": true
115          }
116        }
117      }
118    }
119  }
120}
121```
122
123### Tool Approval
124
125Zed'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.
126
127You can change this by setting this key to `true` in either your `settings.json` or through the Agent Panel's settings view.