From a82cc80d1dcc3f1d155e3e4350beacd253a721c4 Mon Sep 17 00:00:00 2001 From: Marshall Bowers Date: Tue, 20 Aug 2024 21:12:12 -0400 Subject: [PATCH] docs: Remove context servers documentation (#16560) This PR removes the docs for context servers. Release Notes: - N/A --- docs/src/SUMMARY.md | 2 - docs/src/assistant/assistant.md | 4 - docs/src/assistant/context-servers.md | 43 --- docs/src/assistant/model-context-protocol.md | 364 ------------------- 4 files changed, 413 deletions(-) delete mode 100644 docs/src/assistant/context-servers.md delete mode 100644 docs/src/assistant/model-context-protocol.md diff --git a/docs/src/SUMMARY.md b/docs/src/SUMMARY.md index 282da8d048f86aea081237fe5e00d55db34e3bd7..33a43dc5a9d51bcef96024f22961e84934d5e6b8 100644 --- a/docs/src/SUMMARY.md +++ b/docs/src/SUMMARY.md @@ -39,8 +39,6 @@ - [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 diff --git a/docs/src/assistant/assistant.md b/docs/src/assistant/assistant.md index 7092a23294d09bf8373b219da565c0dbdeaa9bb9..b998b31821d46b9ba6e94cb968c375b4d449266e 100644 --- a/docs/src/assistant/assistant.md +++ b/docs/src/assistant/assistant.md @@ -15,7 +15,3 @@ 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 how to add custom slash commands implemented in external codebases with the Context Server Protocol. - - - [Model Context Protocol](./model-context-protocol.md): Read the full specification of the Model Context Protocol that Context Servers follow to interface with the Assistant. diff --git a/docs/src/assistant/context-servers.md b/docs/src/assistant/context-servers.md deleted file mode 100644 index 9c4c93eebea4a80c345c560c54b50bce862195e7..0000000000000000000000000000000000000000 --- a/docs/src/assistant/context-servers.md +++ /dev/null @@ -1,43 +0,0 @@ -# Context Servers - -A Context Server is an experimental interface for defining simple, language-agnostic slash commands in Zed's [Assistant](./assistant.md). Context Servers allow you to extend Zed's Assistant to interface with external capabilities and systems in a language-agnostic way. - -If slash commands allow you to extend the Assistant with new capabilities, Context Servers follow a simple protocol for registering and making use of those capabilities. - -## Using a Context Server - -To configure Zed to use a Context Server, add the command required to start the server to your [settings](../configuring-zed.md): - -```json -{ - "experimental.context_servers": { - "servers": [ - { - "id": "python_context_server", - "executable": "python", - "args": ["-m", "your_context_server_module"] - } - ] - } -} -``` - -## Developing a Context Server - -Context Servers are JSON-RPC servers communicating over stdio. Context Servers must comply with the [Model Context Protocol (MCP)](./model-context-protocol.md). - -See [python-context-server](https://github.com/zed-industries/python-context-server) for a minimal working example. - -Currently, Zed's client only implements a subset of the protocol required to support custom prompt insertions and manipulations. This is likely to be expanded in the future. - -### Should you write a Context Server? - -[Extensions](../extensions.md) are also capable of [adding slash commands to the Assistant](../extensions/slash-commands.md). - -If your slash commands are already implemented in a language other than Rust, wrapping them in a Context Server implementation will likely be the fastest way to plug them into Zed. - -An Extension should be preferred when: - -- Your slash commands are implemented in WebAssembly-compatible Rust -- You want Zed to manage distribution of your slash commands -- You want to publish your slash commands diff --git a/docs/src/assistant/model-context-protocol.md b/docs/src/assistant/model-context-protocol.md deleted file mode 100644 index c3520ee231b1a65af37cee2e455a6ab950db9dda..0000000000000000000000000000000000000000 --- a/docs/src/assistant/model-context-protocol.md +++ /dev/null @@ -1,364 +0,0 @@ -# Model Context Protocol - -## Overview - -The Model Context Protocol (MCP) is a JSON-RPC based protocol for communication between a client (e.g., Zed) and context servers. It enables context-aware development assistance through various features like prompts, resources, and tools. - -Currently, Zed's client only implements a subset of the protocol required to support custom prompt insertions and manipulations. This is likely to be expanded in the future. - -## Protocol Basics - -- Communication: JSON-RPC 2.0 over stdio -- Versioning: Protocol version negotiated during initialization - -## Message Types - -1. Requests: Client-to-server method calls -2. Responses: Server-to-client replies to requests -3. Notifications: Unidirectional messages (no response expected) - -## Lifecycle - -1. Client sends `initialize` request -2. Server responds with capabilities -3. Client sends `initialized` notification -4. Normal operation begins - -### Initialize Request - -```json -{ - "jsonrpc": "2.0", - "id": 1, - "method": "initialize", - "params": { - "protocolVersion": 1, - "capabilities": { - "experimental": {}, - "sampling": {} - }, - "clientInfo": { - "name": "Zed", - "version": "1.0.0" - } - } -} -``` - -### Initialize Response - -```json -{ - "jsonrpc": "2.0", - "id": 1, - "result": { - "protocolVersion": 1, - "capabilities": { - "experimental": {}, - "logging": {}, - "prompts": {}, - "resources": { - "subscribe": true - }, - "tools": {} - }, - "serverInfo": { - "name": "ExampleServer", - "version": "1.0.0" - } - } -} -``` - -### Initialized Notification - -```json -{ - "jsonrpc": "2.0", - "method": "notifications/initialized", - "params": {} -} -``` - -## Features - -### Prompts - -#### List Prompts - -Request: - -```json -{ - "jsonrpc": "2.0", - "id": 2, - "method": "prompts/list", - "params": {} -} -``` - -Response: - -```json -{ - "jsonrpc": "2.0", - "id": 2, - "result": { - "prompts": [ - { - "name": "examplePrompt", - "arguments": [ - { - "name": "arg1", - "description": "Description of arg1", - "required": true - } - ] - } - ] - } -} -``` - -#### Execute Prompt - -Request: - -```json -{ - "jsonrpc": "2.0", - "id": 3, - "method": "prompts/get", - "params": { - "name": "examplePrompt", - "arguments": { - "arg1": "value1" - } - } -} -``` - -Response: - -```json -{ - "jsonrpc": "2.0", - "id": 3, - "result": { - "prompt": "Generated prompt text" - } -} -``` - -### Resources - -#### List Resources - -Request: - -```json -{ - "jsonrpc": "2.0", - "id": 4, - "method": "resources/list", - "params": {} -} -``` - -Response: - -```json -{ - "jsonrpc": "2.0", - "id": 4, - "result": { - "resourceTemplates": [ - { - "uriTemplate": "template://example/{param}", - "name": "Example Template", - "description": "Description of the template" - } - ], - "resources": [ - { - "uri": "https://example.com/resource", - "mimeType": "text/plain" - } - ] - } -} -``` - -#### Read Resource - -Request: - -```json -{ - "jsonrpc": "2.0", - "id": 5, - "method": "resources/read", - "params": { - "uri": "https://example.com/resource" - } -} -``` - -Response: - -```json -{ - "jsonrpc": "2.0", - "id": 5, - "result": { - "contents": [ - { - "uri": "https://example.com/resource", - "mimeType": "text/plain", - "contentType": "text", - "text": "Resource content" - } - ] - } -} -``` - -#### Subscribe to Resource - -Request: - -```json -{ - "jsonrpc": "2.0", - "id": 6, - "method": "resources/subscribe", - "params": { - "uri": "https://example.com/resource" - } -} -``` - -Response: - -```json -{ - "jsonrpc": "2.0", - "id": 6, - "result": null -} -``` - -#### Unsubscribe from Resource - -Request: - -```json -{ - "jsonrpc": "2.0", - "id": 7, - "method": "resources/unsubscribe", - "params": { - "uri": "https://example.com/resource" - } -} -``` - -Response: - -```json -{ - "jsonrpc": "2.0", - "id": 7, - "result": null -} -``` - -### Tools - -#### Call Tool - -Request: - -```json -{ - "jsonrpc": "2.0", - "id": 8, - "method": "tools/call", - "params": { - "name": "exampleTool", - "arguments": { - "key": "value" - } - } -} -``` - -Response: - -```json -{ - "jsonrpc": "2.0", - "id": 8, - "result": { - "output": "Tool execution result" - } -} -``` - -### Logging - -#### Set Logging Level - -Request: - -```json -{ - "jsonrpc": "2.0", - "id": 9, - "method": "logging/setLevel", - "params": { - "level": "info" - } -} -``` - -Response: - -```json -{ - "jsonrpc": "2.0", - "id": 9, - "result": null -} -``` - -### Notifications - -#### Progress - -```json -{ - "jsonrpc": "2.0", - "method": "notifications/progress", - "params": { - "progressToken": "operation1", - "progress": 50.0, - "total": 100.0 - } -} -``` - -## Error Handling - -Errors should be returned as standard JSON-RPC 2.0 error objects: - -```json -{ - "jsonrpc": "2.0", - "id": null, - "error": { - "code": -32000, - "message": "Error message" - } -} -```