Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
docs: Improve MCP-related pages (#32422)
Danilo Leal7c2822a020b7
diff --git a/docs/book.toml b/docs/book.tomlindex 284bdf7152c..d04447d90f8 100644--- a/docs/book.toml+++ b/docs/book.toml@@ -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}`,diff --git a/docs/src/SUMMARY.md b/docs/src/SUMMARY.mdindex 883fe3a4f0a..72210a498eb 100644--- a/docs/src/SUMMARY.md+++ b/docs/src/SUMMARY.md@@ -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 Supportdiff --git a/docs/src/ai/mcp.md b/docs/src/ai/mcp.mdindex 214c79ad4a9..3d356cddfde 100644--- a/docs/src/ai/mcp.md+++ b/docs/src/ai/mcp.md@@ -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 itemIn 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.--## Bring your own MCP server+## Add 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.diff --git a/docs/src/extensions/context-servers.md b/docs/src/extensions/context-servers.mddeleted file mode 100644index 52d1f0e4427..00000000000--- a/docs/src/extensions/context-servers.md+++ /dev/null@@ -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.diff --git a/docs/src/extensions/developing-extensions.md b/docs/src/extensions/developing-extensions.mdindex d03aaa5d64e..e701956bc70 100644--- a/docs/src/extensions/developing-extensions.md+++ b/docs/src/extensions/developing-extensions.md@@ -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 Locallydiff --git a/docs/src/extensions/mcp-extensions.md b/docs/src/extensions/mcp-extensions.mdnew file mode 100644index 00000000000..9f39086256a--- /dev/null+++ b/docs/src/extensions/mcp-extensions.md@@ -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).