docs: Improve MCP-related pages (#32422)

While creating a new MCP extension this weekend, I visited these pages
and it felt like they could be improved a little bit. I'm renaming the
MCP-related page under the /extension directory to use the "MCP"
acronym, instead of "context servers".

Release Notes:

- N/A
This commit is contained in:
Danilo Leal 2025-06-09 21:00:10 -03:00 committed by GitHub
parent 3db00384f4
commit 7c2822a020
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 64 additions and 48 deletions

View file

@ -36,6 +36,7 @@ enable = false
"/assistant/context-servers.html" = "/docs/ai/mcp.html"
"/assistant/model-context-protocol.html" = "/docs/ai/mcp.html"
"/model-improvement.html" = "/docs/ai/ai-improvement.html"
"/extensions/context-servers.html" = "/docs/extensions/mcp-extensions.html"
# Our custom preprocessor for expanding commands like `{#kb action::ActionName}`,

View file

@ -66,7 +66,7 @@
- [Theme Extensions](./extensions/themes.md)
- [Icon Theme Extensions](./extensions/icon-themes.md)
- [Slash Command Extensions](./extensions/slash-commands.md)
- [Context Server Extensions](./extensions/context-servers.md)
- [MCP Server Extensions](./extensions/mcp-extensions.md)
# Language Support

View file

@ -8,8 +8,17 @@ Check out the [Anthropic news post](https://www.anthropic.com/news/model-context
## MCP Servers as Extensions
One of the ways you can use MCP servers in Zed is through exposing it as an extension.
Check the servers that are already available in Zed's extension store via either [the Zed website](https://zed.dev/extensions?filter=context-servers) or directly through the app by running the `zed: extensions` action or by going to the Agent Panel's top-right menu and looking for "View Server Extensions".
One of the ways you can use MCP servers in Zed is by exposing them as an extension.
To learn how to do that, check out the [MCP Server Extensions](../extensions/mcp-extensions.md) page for more details.
### Available extensions
Many MCP servers have been exposed as extensions already, thanks to Zed's awesome community.
Check which ones are already available in Zed's extension store via any of these routes:
1. [the Zed website](https://zed.dev/extensions?filter=context-servers)
2. in the app, run the `zed: extensions` action
3. in the app, go to the Agent Panel's top-right menu and look for the "View Server Extensions" menu item
In any case, here are some of the ones available:
@ -21,12 +30,12 @@ In any case, here are some of the ones available:
- [Prisma](https://github.com/aqrln/prisma-mcp-zed)
- [Framelink Figma](https://github.com/LoamStudios/zed-mcp-server-figma)
- [Linear](https://github.com/LoamStudios/zed-mcp-server-linear)
- [Resend](https://github.com/danilo-leal/zed-resend-mcp-server)
If there's an existing MCP server you'd like to bring to Zed, check out the [context server extension docs](../extensions/context-servers.md) for how to make it available as an extension.
## Add your own MCP server
## Bring your own MCP server
Alternatively, you can connect to MCP servers in Zed via adding their commands directly to your `settings.json`, like so:
Creating an extension is not the only way to use MCP servers in Zed.
You can connect them by adding their commands directly to your `settings.json`, like so:
```json
{
@ -43,4 +52,5 @@ Alternatively, you can connect to MCP servers in Zed via adding their commands d
}
```
You can also add a custom server by reaching for the Agent Panel's Settings view (also accessible via the `agent: open configuration` action) and adding the desired server through the modal that appears when clicking the "Add Custom Server" button.
Alternatively, you can also add a custom server by accessing the Agent Panel's Settings view (also accessible via the `agent: open configuration` action).
From there, you can add it through the modal that appears when clicking the "Add Custom Server" button.

View file

@ -1,39 +0,0 @@
# Context Servers
Extensions may provide [context servers](../ai/mcp.md) for use in the Assistant.
## Example extension
To see a working example of an extension that provides context servers, check out the [`postgres-context-server` extension](https://github.com/zed-extensions/postgres-context-server).
This extension can be [installed as a dev extension](./developing-extensions.md#developing-an-extension-locally) if you want to try it out for yourself.
## Defining context servers
A given extension may provide one or more context servers. Each context server must be registered in the `extension.toml`:
```toml
[context_servers.my-context-server]
```
Then, in the Rust code for your extension, implement the `context_server_command` method on your extension:
```rust
impl zed::Extension for MyExtension {
fn context_server_command(
&mut self,
context_server_id: &ContextServerId,
project: &zed::Project,
) -> Result<zed::Command> {
Ok(zed::Command {
command: get_path_to_context_server_executable()?,
args: get_args_for_context_server()?,
env: get_env_for_context_server()?,
})
}
}
```
This method should return the command to start up a context server, along with any arguments or environment variables necessary for it to function.
If you need to download the context server from an external source—like GitHub Releases or npm—you can also do this here.

View file

@ -8,7 +8,7 @@ Extensions can add the following capabilities to Zed:
- [Themes](./themes.md)
- [Icon Themes](./icon-themes.md)
- [Slash Commands](./slash-commands.md)
- [Context Servers](./context-servers.md)
- [MCP Servers](./mcp-extensions.md)
## Developing an Extension Locally

View file

@ -0,0 +1,44 @@
# MCP Server Extensions
[Model Context Protocol servers](../ai/mcp.md) can be exposed as extensions for use in the Agent Panel.
## Defining MCP Extensions
A given extension may provide one or more MCP servers.
Each MCP server must be registered in the `extension.toml`:
```toml
[context_servers.my-context-server]
```
Then, in the Rust code for your extension, implement the `context_server_command` method on your extension:
```rust
impl zed::Extension for MyExtension {
fn context_server_command(
&mut self,
context_server_id: &ContextServerId,
project: &zed::Project,
) -> Result<zed::Command> {
Ok(zed::Command {
command: get_path_to_context_server_executable()?,
args: get_args_for_context_server()?,
env: get_env_for_context_server()?,
})
}
}
```
This method should return the command to start up an MCP server, along with any arguments or environment variables necessary for it to function.
If you need to download the MCP server from an external source—like GitHub Releases or npm—you can also do that in this function.
## Available Extensions
Check out all the MCP servers that have already been exposed as Zed extensions [on Zed's site](https://zed.dev/extensions?filter=context-servers).
We recommend taking a look at their repositories as a way to understand how they are generally created and structured.
## Testing
To test your new MCP server extension, you can [install it as a dev extension](./developing-extensions.md#developing-an-extension-locally).