mcp.md

  1---
  2title: Model Context Protocol (MCP) in Zed
  3description: Install and configure MCP servers in Zed to extend your AI agent with external tools, data sources, and integrations.
  4---
  5
  6# Model Context Protocol
  7
  8Zed uses the [Model Context Protocol](https://modelcontextprotocol.io/) to interact with context servers.
  9
 10> The Model Context Protocol (MCP) is an open protocol for connecting LLM applications to external tools and data sources through a standard interface.
 11
 12## Supported Features
 13
 14Zed currently supports MCP's [Tools](https://modelcontextprotocol.io/specification/2025-11-25/server/tools) and [Prompts](https://modelcontextprotocol.io/specification/2025-11-25/server/prompts) features.
 15We welcome contributions that help advance Zed's MCP feature coverage (Discovery, Sampling, Elicitation, etc).
 16
 17Zed also handles the `notifications/tools/list_changed` notification from MCP servers. When a server adds, removes, or modifies its available tools at runtime, Zed automatically reloads the tool list without requiring a server restart.
 18
 19## Installing MCP Servers
 20
 21### As Extensions
 22
 23One of the ways you can use MCP servers in Zed is by exposing them as an extension.
 24Check out the [MCP Server Extensions](../extensions/mcp-extensions.md) page to learn how to create your own.
 25
 26Many MCP servers are available as extensions. Find them via:
 27
 281. [the Zed website](https://zed.dev/extensions?filter=context-servers)
 292. in the app, open the Command Palette and run the `zed: extensions` action
 303. in the app, go to the Agent Panel's top-right menu and look for the "View Server Extensions" menu item
 31
 32Popular servers available as an extension include:
 33
 34- [Context7](https://zed.dev/extensions/context7-mcp-server)
 35- [GitHub](https://zed.dev/extensions/github-mcp-server)
 36- [Puppeteer](https://zed.dev/extensions/puppeteer-mcp-server)
 37- [Gem](https://zed.dev/extensions/gem)
 38- [Brave Search](https://zed.dev/extensions/brave-search-mcp-server)
 39- [Prisma](https://github.com/aqrln/prisma-mcp-zed)
 40- [Framelink Figma](https://zed.dev/extensions/framelink-figma-mcp-server)
 41- [Resend](https://zed.dev/extensions/resend-mcp-server)
 42
 43### As Custom Servers
 44
 45Creating an extension is not the only way to use MCP servers in Zed.
 46You can connect them by adding their commands directly to your settings file ([how to edit](../configuring-zed.md#settings-files)), like so:
 47
 48```json [settings]
 49{
 50  "context_servers": {
 51    "local-mcp-server": {
 52      "command": "some-command",
 53      "args": ["arg-1", "arg-2"],
 54      "env": {}
 55    },
 56    "remote-mcp-server": {
 57      "url": "custom",
 58      "headers": { "Authorization": "Bearer <token>" }
 59    }
 60  }
 61}
 62```
 63
 64Alternatively, you can also add a custom server by accessing the Agent Panel's Settings view (also accessible via the `agent: open settings` action).
 65From there, you can add it through the modal that appears when you click the "Add Custom Server" button.
 66
 67## Using MCP Servers
 68
 69### Configuration Check
 70
 71Most MCP servers require configuration after installation.
 72
 73In the case of extensions, after installing it, Zed will pop up a modal displaying what is required for you to properly set it up.
 74For 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).
 75
 76In 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.
 77
 78To 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.
 79If they're running correctly, the indicator will be green and its tooltip will say "Server is active".
 80If not, other colors and tooltip messages will indicate what is happening.
 81
 82### Agent Panel Usage
 83
 84Once installation is complete, you can return to the Agent Panel and start prompting.
 85
 86How reliably MCP tools get called can vary from model to model.
 87Mentioning the MCP server by name can help the model pick tools from that server.
 88
 89However, 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.
 90
 91As 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):
 92
 93```json [settings]
 94"agent": {
 95  "profiles": {
 96    "container-use": {
 97      "name": "Container Use",
 98      "tools": {
 99        "fetch": true,
100        "thinking": true,
101        "copy_path": false,
102        "find_path": false,
103        "delete_path": false,
104        "create_directory": false,
105        "list_directory": false,
106        "diagnostics": false,
107        "read_file": false,
108        "open": false,
109        "move_path": false,
110        "grep": false,
111        "edit_file": false,
112        "terminal": false
113      },
114      "enable_all_context_servers": false,
115      "context_servers": {
116        "container-use": {
117          "tools": {
118            "environment_create": true,
119            "environment_add_service": true,
120            "environment_update": true,
121            "environment_run_cmd": true,
122            "environment_open": true,
123            "environment_file_write": true,
124            "environment_file_read": true,
125            "environment_file_list": true,
126            "environment_file_delete": true,
127            "environment_checkpoint": true
128          }
129        }
130      }
131    }
132  }
133}
134```
135
136### Tool Permissions
137
138> **Note:** In Zed v0.224.0 and above, tool approval is controlled by `agent.tool_permissions.default`.
139> In earlier versions, it was controlled by the `agent.always_allow_tool_actions` boolean (default `false`).
140
141Zed's Agent Panel provides the `agent.tool_permissions.default` setting to control tool approval behavior for the native Zed agent:
142
143- `"confirm"` (default) — Prompts for approval before running any tool action, including MCP tool calls
144- `"allow"` — Auto-approves tool actions without prompting
145- `"deny"` — Blocks all tool actions
146
147For granular control over specific MCP tools, you can configure per-tool permission rules.
148MCP tools use the key format `mcp:<server>:<tool_name>` — for example, `mcp:github:create_issue`.
149The `default` key on a per-tool entry is the primary mechanism for MCP tools, since pattern-based rules match against an empty string for MCP tools and most patterns won't match.
150
151Learn more about [how tool permissions work](./tool-permissions.md), how to further customize them, and other details.
152
153### External Agents
154
155Note 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.
156
157Regarding the built-in ones, Claude Agent and Codex both support it, and Gemini CLI does not yet.
158In 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).
159
160### Error Handling
161
162When a MCP server encounters an error while processing a tool call, the agent receives the error message directly and the operation fails.
163Common error scenarios include:
164
165- Invalid parameters passed to the tool
166- Server-side failures (database connection issues, rate limits)
167- Unsupported operations or missing resources
168
169The error message from the context server will be shown in the agent's response, allowing you to diagnose and correct the issue.
170Check the context server's logs or documentation for details about specific error codes.