From 7c2822a020b7be73ed985a73a9b3d8d10e7d25d1 Mon Sep 17 00:00:00 2001 From: Danilo Leal <67129314+danilo-leal@users.noreply.github.com> Date: Mon, 9 Jun 2025 21:00:10 -0300 Subject: [PATCH] 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 --- docs/book.toml | 1 + docs/src/SUMMARY.md | 2 +- docs/src/ai/mcp.md | 24 +++++++---- docs/src/extensions/context-servers.md | 39 ----------------- docs/src/extensions/developing-extensions.md | 2 +- docs/src/extensions/mcp-extensions.md | 44 ++++++++++++++++++++ 6 files changed, 64 insertions(+), 48 deletions(-) delete mode 100644 docs/src/extensions/context-servers.md create mode 100644 docs/src/extensions/mcp-extensions.md diff --git a/docs/book.toml b/docs/book.toml index 284bdf7152..d04447d90f 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.md index 883fe3a4f0..72210a498e 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 Support diff --git a/docs/src/ai/mcp.md b/docs/src/ai/mcp.md index 214c79ad4a..3d356cddfd 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 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. diff --git a/docs/src/extensions/context-servers.md b/docs/src/extensions/context-servers.md deleted file mode 100644 index 52d1f0e442..0000000000 --- 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 { - 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.md index d03aaa5d64..e701956bc7 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 Locally diff --git a/docs/src/extensions/mcp-extensions.md b/docs/src/extensions/mcp-extensions.md new file mode 100644 index 0000000000..9f39086256 --- /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 { + 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).