Detailed changes
@@ -3,15 +3,6 @@ export default {
const url = new URL(request.url);
url.hostname = "docs-anw.pages.dev";
- // These pages were removed, but may still be served due to Cloudflare's
- // [asset retention](https://developers.cloudflare.com/pages/configuration/serving-pages/#asset-retention).
- if (
- url.pathname === "/docs/assistant/context-servers" ||
- url.pathname === "/docs/assistant/model-context-protocol"
- ) {
- return await fetch("https://zed.dev/404");
- }
-
let res = await fetch(url, request);
if (res.status === 404) {
@@ -43,6 +43,8 @@
- [Inline Assistant](./assistant/inline-assistant.md)
- [Commands](./assistant/commands.md)
- [Prompts](./assistant/prompting.md)
+- [Context Servers](./assistant/context-servers.md)
+ - [Model Context Protocol](./assistant/model-context-protocol.md)
# Extensions
@@ -51,7 +53,8 @@
- [Developing Extensions](./extensions/developing-extensions.md)
- [Language Extensions](./extensions/languages.md)
- [Theme Extensions](./extensions/themes.md)
-- [Slash Commands](./extensions/slash-commands.md)
+- [Slash Command Extensions](./extensions/slash-commands.md)
+- [Context Server Extensions](./extensions/context-servers.md)
# Language Support
@@ -15,3 +15,5 @@ This section covers various aspects of the Assistant:
- [Using Commands](./commands.md): Explore slash commands that enhance the Assistant's capabilities and future extensibility.
- [Prompting & Prompt Library](./prompting.md): Learn how to write and save prompts, how to use the Prompt Library, and how to edit prompt templates.
+
+- [Context Servers](./context-servers.md): Learn about context servers that enhance the Assistant's capabilities via the [Model Context Protocol](./model-context-protocol.md).
@@ -0,0 +1,49 @@
+# Context Servers
+
+Context servers are a mechanism for pulling context into the Assistant from an external source. They are powered by the [Model Context Protocol](./model-context-protocol.md).
+
+Currently Zed supports context servers providing [slash commands](./commands.md) for use in the Assistant.
+
+## Installation
+
+Context servers can be installed via [extensions](../extensions/context-servers.md).
+
+If you don't already have a context server, check out one of these:
+
+- [Postgres Context Server](https://github.com/zed-extensions/postgres-context-server)
+
+## Configuration
+
+Context servers may require some configuration in order to run or to change their behavior.
+
+You can configure each context server using the `context_servers` setting in your `settings.json`:
+
+```json
+{
+ "context_servers": {
+ "postgres-context-server": {
+ "settings": {
+ "database_url": "postgresql://postgres@localhost/my_database"
+ }
+ }
+}
+```
+
+If desired, you may also provide a custom command to execute a context server:
+
+```json
+{
+ "context_servers": {
+ "my-context-server": {
+ "command": {
+ "path": "/path/to/my-context-server",
+ "args": ["run"],
+ "env": {}
+ },
+ "settings": {
+ "enable_something": true
+ }
+ }
+ }
+}
+```
@@ -0,0 +1,21 @@
+# Model Context Protocol
+
+Zed uses the [Model Context Protocol](https://modelcontextprotocol.io/) to interact with [context servers](./context-server.md):
+
+> 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.
+
+Check out the [Anthropic news post](https://www.anthropic.com/news/model-context-protocol) and the [Zed blog post](https://zed.dev/blog/mcp) for an introduction to MCP.
+
+## Try it out
+
+Want to try it for yourself?
+
+The following context servers are available today as Zed extensions:
+
+- [Postgres Context Server](https://github.com/zed-extensions/postgres-context-server)
+
+## Bring your own context server
+
+If there's an existing context 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.
+
+If you are interested in building your own context server, check out the [Model Context Protocol docs](https://modelcontextprotocol.io/introduction#get-started-with-mcp) to get started.
@@ -0,0 +1,39 @@
+# Context Servers
+
+Extensions may provide [context servers](../assistant/context-servers.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.html#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.
@@ -7,6 +7,7 @@ Extensions can add the following capabilities to Zed:
- [Languages](./languages.md)
- [Themes](./themes.md)
- [Slash Commands](./slash-commands.md)
+- [Context Servers](./context-servers.md)
## Directory Structure of a Zed Extension