diff --git a/docs/configuration.md b/docs/configuration.md index f8e52c3..369f8e4 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -1,71 +1,71 @@ -# Deep Code 配置 +# Deep Code Configuration -## 配置层级 +## Configuration Hierarchy -配置按以下优先级顺序应用(数字较小的会被数字较大的覆盖): +Configuration is applied in the following priority order (lower-numbered sources are overridden by higher-numbered ones): -| 层级 | 配置来源 | 说明 | -| ---- | ------------ | ------------------------------------------- | -| 1 | 默认值 | 应用程序内硬编码的默认值 | -| 2 | 用户设置文件 | 当前用户的全局设置 | -| 3 | 项目设置文件 | 项目特定的设置 | -| 4 | 环境变量 | 系统范围或会话特定的变量 | +| Layer | Configuration Source | Description | +| ----- | -------------------- | ---------------------------------------------- | +| 1 | Defaults | Hardcoded defaults within the application | +| 2 | User settings file | Global settings for the current user | +| 3 | Project settings file| Project-specific settings | +| 4 | Environment variables| System-wide or session-specific variables | -## 设置文件 +## Settings File -Deep Code 使用 `settings.json` 设置文件进行持久化配置,支持两个层级的存放位置: +Deep Code uses the `settings.json` file for persistent configuration, supporting two storage locations: -| 文件类型 | 位置 | 作用范围 | -| ------------ | ---------------------------------- | ---------------------------------------------------- | -| 用户设置文件 | `~/.deepcode/settings.json` | 适用于当前用户的所有 Deep Code 会话。 | -| 项目设置文件 | `项目根目录/.deepcode/settings.json` | 仅在该特定项目中运行 Deep Code 时生效。项目设置会覆盖用户设置。 | +| File Type | Location | Scope | +| ------------------- | ----------------------------------------- | --------------------------------------------------------------------- | +| User settings file | `~/.deepcode/settings.json` | Applies to all Deep Code sessions for the current user. | +| Project settings file | `/.deepcode/settings.json` | Takes effect only when running Deep Code in that specific project. Project settings override user settings. | -### `settings.json` 中的可用设置 +### Available Settings in `settings.json` -以下是 `settings.json` 支持的全部顶层字段,以及 `env` 内部支持的子字段: +The following are all the top-level fields supported in `settings.json`, along with the sub-fields inside `env`: -| 字段 | 类型 | 说明 | -| -------------------- | --------- | ------------------------------------------------------------------- | -| `env` | object | 环境变量分组(见下方子字段表) | -| `model` | string | 模型名称。优先级高于 `env.MODEL` | -| `thinkingEnabled` | boolean | 是否启用思考模式(DeepSeek V4 系列默认启用) | -| `reasoningEffort` | string | 推理强度,可选 `"high"` 或 `"max"`(默认 `"max"`) | -| `debugLogEnabled` | boolean | 是否启用调试日志输出(默认 `false`) | -| `notify` | string | 任务完成通知脚本的完整路径(如 Slack 通知脚本) | -| `webSearchTool` | string | 自定义联网搜索脚本的完整路径 | -| `mcpServers` | object | MCP 服务器配置(键为服务名,值为 McpServerConfig 对象) | +| Field | Type | Description | +| ------------------ | ------- | --------------------------------------------------------------------------- | +| `env` | object | Group of environment variables (see sub-field table below) | +| `model` | string | Model name. Takes precedence over `env.MODEL` | +| `thinkingEnabled` | boolean | Whether to enable thinking mode (enabled by default for DeepSeek V4 series)| +| `reasoningEffort` | string | Reasoning intensity, either `"high"` or `"max"` (default `"max"`) | +| `debugLogEnabled` | boolean | Enable debug log output (default `false`) | +| `notify` | string | Full path to a task-completion notification script (e.g., Slack notification script) | +| `webSearchTool` | string | Full path to a custom web search script | +| `mcpServers` | object | MCP server configurations (keys are service names, values are McpServerConfig objects) | -#### `env` 子字段 +#### `env` Sub-fields -| 字段 | 类型 | 说明 | -| ---------- | ------ | ------------------------------------------------------------------ | -| `MODEL` | string | 模型名称。例如 `"deepseek-v4-pro"`、`"deepseek-v4-flash"` | -| `BASE_URL` | string | API 请求的基础 URL。例如 `"https://api.deepseek.com"` | -| `API_KEY` | string | API 密钥 | -| `THINKING_ENABLED` | string | 是否启用思考模式 | -| `REASONING_EFFORT` | string | 推理强度 | -| `DEBUG_LOG_ENABLED` | string | 是否启用调试日志输出 | -| `<其他任意KEY>` | string | 自定义环境变量 | +| Field | Type | Description | +| ----------------- | ------ | ---------------------------------------------------------------- | +| `MODEL` | string | Model name, e.g. `"deepseek-v4-pro"`, `"deepseek-v4-flash"` | +| `BASE_URL` | string | Base URL for API requests, e.g. `"https://api.deepseek.com"` | +| `API_KEY` | string | API key | +| `THINKING_ENABLED`| string | Enable thinking mode | +| `REASONING_EFFORT`| string | Reasoning intensity | +| `DEBUG_LOG_ENABLED`| string| Enable debug log output | +| `` | string | Custom environment variable | -#### `thinkingEnabled` — 思考模式 +#### `thinkingEnabled` — Thinking Mode -是否启用 DeepSeek 思考模式。设置为 `true` 启用、`false` 禁用。 +Whether to enable DeepSeek thinking mode. Set to `true` to enable, `false` to disable. -- 对于 `deepseek-v4-pro` 和 `deepseek-v4-flash`,思考模式**默认启用**。 -- 对于其他模型,思考模式**默认关闭**。 +- For `deepseek-v4-pro` and `deepseek-v4-flash`, thinking mode is **enabled by default**. +- For other models, thinking mode is **disabled by default**. -#### `reasoningEffort` — 推理强度 +#### `reasoningEffort` — Reasoning Intensity -当思考模式启用时,控制模型思考的深度: +When thinking mode is enabled, controls the depth of the model’s reasoning: -| 值 | 说明 | -| ------ | --------------------------------- | -| `max` | 最大推理深度(默认值) | -| `high` | 较高推理深度,token消耗相对较小 | +| Value | Description | +| ------ | --------------------------------------------------------- | +| `max` | Maximum reasoning depth (default) | +| `high` | Higher reasoning depth with relatively lower token usage | -#### `notify` — 任务完成通知 +#### `notify` — Task Completion Notification -设置一个 Shell 脚本的完整路径。当 AI 助手完成一轮任务后,会自动执行该脚本,可用于发送通知(如 Slack 消息)。 +Set a full path to a shell script. When the AI assistant finishes a round of tasks, the script is executed automatically, which can be used to send notifications (e.g., a Slack message). ```json { @@ -73,9 +73,9 @@ Deep Code 使用 `settings.json` 设置文件进行持久化配置,支持两 } ``` -#### `webSearchTool` — 自定义联网搜索 +#### `webSearchTool` — Custom Web Search -Deep Code 内置免费可用的 Web Search 工具。如果需要自定义搜索逻辑,可将 `webSearchTool` 设为一个可执行脚本的完整路径: +Deep Code has a built-in, free-to-use Web Search tool. If you need custom search logic, set `webSearchTool` to the full path of an executable script: ```json { @@ -83,16 +83,16 @@ Deep Code 内置免费可用的 Web Search 工具。如果需要自定义搜索 } ``` -脚本接收一个搜索查询参数,输出 JSON 格式的结果供 AI 使用。 +The script receives a search query as an argument and outputs results in JSON format for the AI. -#### `mcpServers` — MCP 服务器 +#### `mcpServers` — MCP Servers -MCP(Model Context Protocol)服务器配置。值是键值对,键为服务名称,值为服务器配置对象。 +Configuration for MCP (Model Context Protocol) servers. The value is a key-value pair, where the key is the service name and the value is a server configuration object. ```json { "mcpServers": { - "<服务名>": { + "": { "command": "npx", "args": ["-y", "@modelcontextprotocol/server-github"], "env": { @@ -103,71 +103,70 @@ MCP(Model Context Protocol)服务器配置。值是键值对,键为服务 } ``` -| McpServerConfig 字段 | 类型 | 必填 | 说明 | -| -------------------- | -------- | ---- | -------------------------------------------------------------------- | -| `command` | string | 是 | 可执行文件路径或命令(如 `npx`、`node`、`python`) | -| `args` | string[] | 否 | 传递给命令的参数列表 | -| `env` | object | 否 | 传递给 MCP 服务器进程的环境变量 | +| McpServerConfig field | Type | Required | Description | +| --------------------- | -------- | -------- | ------------------------------------------------------------------------ | +| `command` | string | Yes | Executable path or command (e.g. `npx`, `node`, `python`) | +| `args` | string[] | No | List of arguments passed to the command | +| `env` | object | No | Environment variables passed to the MCP server process | -> 当 `command` 为 `npx` 时,Deep Code 会自动在参数前补充 `-y`。 +> When `command` is `npx`, Deep Code automatically prepends `-y` to the arguments. -详细 MCP 使用说明请参考 [mcp.md](mcp.md)。 +For detailed MCP usage instructions, refer to [mcp.md](mcp.md). +#### `debugLogEnabled` — Debug Log -#### `debugLogEnabled` — 调试日志 +Set to `true` to enable detailed debug logging (default `false`), useful for troubleshooting API calls and tool execution. -设为 `true` 可让程序输出详细的调试日志(默认 `false`),用于排查 API 调用和工具执行的问题。 +## Environment Variable Priority -## 环境变量优先级 +Environment variables are a common way to configure applications, especially for sensitive information (such as api-key) or settings that may change between environments. -环境变量是配置应用程序的常用方式,尤其适用于敏感信息(如 api-key)或可能在不同环境之间更改的设置。 +### Priority Principle -### 优先级原则 +Environment variable priority follows the logic of “the more specific and localized the configuration, the higher the priority”, and the override rule of “env files protect existing environment by default, system variables override env files”. (The `env` object in settings.json can be thought of as a type of env file.) -环境变量优先级遵循“越具体、越局部的配置,优先级越高”和“env文件默认保护现有环境,系统变量高于env文件”的覆盖逻辑。(settings.json的env对象可以认为是一种env文件) +Priority levels (from lowest to highest): +1. `env` defined at the top level of `settings.json` – this is a general configuration for the entire tool and all its subprocesses (global variables). Can be overridden by outer environment variables, but the environment variable KEY has the `DEEPCODE_` prefix removed. +2. `env` defined inside `mcpServers` in `settings.json` – this is the most specific configuration for a particular MCP service (local variables). Can be overridden by outer environment variables, but the KEY has the `MCP_` prefix removed. +3. Shell/system environment variables – operating system level. -优先级层级 (由低到高) -1. settings.json 外层的 env:这是针对整个工具及其所有子进程的通用配置(全局变量)。可被外层环境变量覆盖,但环境变量KEY会移除`DEEPCODE_`前缀。 -2. settings.json mcpServers 内定义的 env:这是针对特定 MCP 服务的最具体配置(局部变量)。可被外层环境变量覆盖,但环境变量KEY会移除`MCP_`前缀。 -3. Shell 环境系统变量:操作系统层面的环境变量。 +### Scenarios -### 场景 +#### 1. Setting the model’s api_key and base_url -#### 一、设置模型的api_key, base_url +Applied in the following priority order (lower-numbered sources are overridden by higher-numbered ones) – using api_key as an example: -按以下优先级顺序应用(数字较小的会被数字较大的覆盖)(以api_key为例): +1. Hardcoded default: `""` +2. User-level settings.json: `{"env": {"API_KEY": "abc123"}}` +3. Project-level settings.json: `{"env": {"API_KEY": "abc123"}}` +4. System environment variable: `DEEPCODE_API_KEY=abc123 deepcode` -1. 硬编码默认值: `""` -2. 用户级settings.json: `{"env": {"API_KEY": "abc123"}}` -3. 项目级settings.json: `{"env": {"API_KEY": "abc123"}}` -4. 系统环境变量: `DEEPCODE_API_KEY=abc123 deepcode` +#### 2. Setting model, thinkingEnabled, and reasoningEffort -#### 二、设置模型的model, thinkingEnabled, reasoningEffort +Applied in the following priority order (lower-numbered overridden by higher-numbered) – using thinkingEnabled as an example: -按以下优先级顺序应用(数字较小的会被数字较大的覆盖)(以thinkingEnabled为例): +1. Hardcoded default: `true` +2. User-level settings.json: `{"env": {"THINKING_ENABLED": "true"}}` +3. User-level settings.json: `{"thinkingEnabled": true}` +4. Project-level settings.json: `{"env": {"THINKING_ENABLED": "true"}}` +5. Project-level settings.json: `{"thinkingEnabled": true}` +6. System environment variable: `DEEPCODE_THINKING_ENABLED=true deepcode` -1. 硬编码默认值: `true` -2. 用户级settings.json: `{"env": {"THINKING_ENABLED": "true"}}` -3. 用户级settings.json: `{"thinkingEnabled": true}` -4. 项目级settings.json: `{"env": {"THINKING_ENABLED": "true"}}` -5. 项目级settings.json: `{"thinkingEnabled": true}` -6. 系统环境变量: `DEEPCODE_THINKING_ENABLED=true deepcode` +#### 3. Setting environment variables for external scripts like notify and webSearchTool -#### 三、设置启动notify, webSearchTool等外挂脚本的环境变量 +Applied in the following priority order (lower-numbered overridden by higher-numbered) – using notify as an example: -按以下优先级顺序应用(数字较小的会被数字较大的覆盖)(以notify为例): +1. Hardcoded default: `os.environ.get('WEBHOOK', '...') # notify script code` +2. User-level settings.json: `{"env": {"WEBHOOK": "..."}}` +3. Project-level settings.json: `{"env": {"WEBHOOK": "true"}}` +4. System environment variable: `DEEPCODE_WEBHOOK=... deepcode` -1. 硬编码默认值:`os.environ.get('WEBHOOK', '...') # notify脚本代码` -2. 用户级settings.json: `{"env": {"WEBHOOK": "..."}}` -3. 项目级settings.json: `{"env": {"WEBHOOK": "true"}}` -4. 系统环境变量: `DEEPCODE_WEBHOOK=... deepcode` +#### 4. Setting environment variables for an MCP Service -#### 四、设置MCP Service的环境变量 +Applied in the following priority order (lower-numbered overridden by higher-numbered) – using a GitHub MCP server as an example: -按以下优先级顺序应用(数字较小的会被数字较大的覆盖)(以github MCP server为例): - -1. 用户级settings.json: `{"mcpServers":{"github":{"env":{"GITHUB_PERSONAL_ACCESS_TOKEN":"..."}}}}` -2. 用户级settings.json: `{"env": {"MCP_GITHUB_PERSONAL_ACCESS_TOKEN": "..."}}` -3. 项目级settings.json: `{"mcpServers":{"github":{"env":{"GITHUB_PERSONAL_ACCESS_TOKEN":"..."}}}}` -4. 项目级settings.json: `{"env": {"MCP_GITHUB_PERSONAL_ACCESS_TOKEN": "..."}}` -5. 系统环境变量: `DEEPCODE_MCP_GITHUB_PERSONAL_ACCESS_TOKEN=... deepcode` +1. User-level settings.json: `{"mcpServers":{"github":{"env":{"GITHUB_PERSONAL_ACCESS_TOKEN":"..."}}}}` +2. User-level settings.json: `{"env": {"MCP_GITHUB_PERSONAL_ACCESS_TOKEN": "..."}}` +3. Project-level settings.json: `{"mcpServers":{"github":{"env":{"GITHUB_PERSONAL_ACCESS_TOKEN":"..."}}}}` +4. Project-level settings.json: `{"env": {"MCP_GITHUB_PERSONAL_ACCESS_TOKEN": "..."}}` +5. System environment variable: `DEEPCODE_MCP_GITHUB_PERSONAL_ACCESS_TOKEN=... deepcode` \ No newline at end of file diff --git a/docs/mcp.md b/docs/mcp.md index fe6711d..11adda5 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -1,22 +1,22 @@ -# Deep Code CLI MCP 配置指南 +# Deep Code CLI MCP Configuration Guide -Deep Code CLI 支持 MCP(Model Context Protocol),让 AI 助手能够连接外部工具和服务,如 GitHub、浏览器、数据库等。 +Deep Code CLI supports MCP (Model Context Protocol), enabling AI assistants to connect with external tools and services such as GitHub, browsers, databases, and more. -## 概述 +## Overview -配置 MCP 后,Deep Code 可以: +Once MCP is configured, Deep Code can: -- 操作 GitHub 仓库(查看 Issues、创建 PR、搜索代码等) -- 操控浏览器(截图、点击、填表单等) -- 访问文件系统 -- 连接数据库和 API -- ...以及任何兼容 MCP 协议的外部服务 +- Operate on GitHub repositories (view issues, create PRs, search code, etc.) +- Control browsers (screenshots, clicks, form filling, etc.) +- Access the file system +- Connect to databases and APIs +- ...and any external service compatible with the MCP protocol -MCP 工具在 Deep Code 中的命名格式为 `mcp__<服务名>__<工具名>`,例如 `mcp__github__search_code`。 +MCP tools are named in Deep Code using the format `mcp____`, for example `mcp__github__search_code`. -## 配置 MCP 服务器 +## Configuring MCP Servers -编辑 `~/.deepcode/settings.json`,添加 `mcpServers` 字段: +Edit `~/.deepcode/settings.json` and add the `mcpServers` field: ```json { @@ -28,30 +28,30 @@ MCP 工具在 Deep Code 中的命名格式为 `mcp__<服务名>__<工具名>`, "thinkingEnabled": true, "reasoningEffort": "max", "mcpServers": { - "<服务名称>": { - "command": "<可执行文件>", - "args": ["<参数1>", "<参数2>"], + "": { + "command": "", + "args": ["", ""], "env": { - "<环境变量>": "<值>" + "": "" } } } } ``` -### 配置项说明 +### Configuration Fields -| 字段 | 类型 | 必填 | 说明 | -| --------- | -------- | ---- | ---------------------------------------------------------------------------------------------------------------------- | -| `command` | string | 是 | MCP 服务器的可执行文件路径或命令(如 `npx`、`node`、`python`)。当命令是 `npx` 时,Deep Code 会自动在参数前补充 `-y`。 | -| `args` | string[] | 否 | 传递给命令的参数列表 | -| `env` | object | 否 | 传递给 MCP 服务器进程的环境变量(如 API Key) | +| Field | Type | Required | Description | +| --------- | -------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `command` | string | Yes | Path or command of the MCP server executable (e.g., `npx`, `node`, `python`). When the command is `npx`, Deep Code automatically prepends `-y` to the arguments. | +| `args` | string[] | No | List of arguments to pass to the command | +| `env` | object | No | Environment variables (e.g., API keys) to pass to the MCP server process | -## 常用 MCP 示例 +## Common MCP Examples ### GitHub MCP -让 Deep Code 直接操作 GitHub 仓库(搜索代码、管理 Issue/PR、读写文件等): +Allows Deep Code to directly operate on GitHub repositories (search code, manage issues/PRs, read/write files, etc.): ```json { @@ -67,11 +67,11 @@ MCP 工具在 Deep Code 中的命名格式为 `mcp__<服务名>__<工具名>`, } ``` -> GitHub Personal Access Token 可在 [GitHub Settings > Developer settings > Personal access tokens](https://github.com/settings/tokens) 生成。 +> Generate a GitHub Personal Access Token at [GitHub Settings > Developer settings > Personal access tokens](https://github.com/settings/tokens). -### 浏览器控制(Playwright) +### Browser Control (Playwright) -让 Deep Code 操控浏览器进行截图、页面操作等: +Lets Deep Code control a browser for screenshots, page interactions, etc.: ```json { @@ -84,9 +84,9 @@ MCP 工具在 Deep Code 中的命名格式为 `mcp__<服务名>__<工具名>`, } ``` -### 文件系统 +### File System -让 Deep Code 在指定目录中读写文件: +Enables Deep Code to read and write files within a specified directory: ```json { @@ -99,7 +99,7 @@ MCP 工具在 Deep Code 中的命名格式为 `mcp__<服务名>__<工具名>`, } ``` -### 自定义 Python MCP +### Custom Python MCP ```json { @@ -115,9 +115,9 @@ MCP 工具在 Deep Code 中的命名格式为 `mcp__<服务名>__<工具名>`, } ``` -## 完整配置示例 +## Full Configuration Example -以下是一个配置了 GitHub 和 Playwright 两个 MCP 服务器的完整 `~/.deepcode/settings.json`: +Below is a complete `~/.deepcode/settings.json` with both GitHub and Playwright MCP servers configured: ```json { @@ -144,62 +144,62 @@ MCP 工具在 Deep Code 中的命名格式为 `mcp__<服务名>__<工具名>`, } ``` -## 使用 MCP +## Using MCP -配置完成后,启动 `deepcode`,使用 `/mcp` 命令管理 MCP 连接: +After configuration, start `deepcode` and use the `/mcp` command to manage MCP connections: -- `/mcp` — 查看已配置的 MCP 服务器状态 -- `/mcp add` — 添加新的 MCP 服务器 -- `/mcp remove` — 移除 MCP 服务器 -- `/mcp list` — 列出所有已连接的 MCP 服务器及其工具 +- `/mcp` — View the status of configured MCP servers +- `/mcp add` — Add a new MCP server +- `/mcp remove` — Remove an MCP server +- `/mcp list` — List all connected MCP servers and their tools -在对话中直接使用 MCP 工具名称即可调用,例如: +Simply use the MCP tool name in your conversation to invoke it, for example: ``` -帮我搜索 GitHub 上 deepcode-cli 仓库的 issues +Help me search for issues in the deepcode-cli repository on GitHub ``` -AI 会自动调用 `mcp__github__search_issues` 工具完成操作。 +The AI will automatically invoke the `mcp__github__search_issues` tool to complete the action. -## 工具命名规则 +## Tool Naming Convention -MCP 工具名称由三部分组成:`mcp__<服务名>__<工具名>` +An MCP tool name consists of three parts: `mcp____` -| 服务名 | 工具名 | 完整调用名 | -| ---------- | ----------------------- | ------------------------------------------ | -| github | search_code | `mcp__github__search_code` | -| github | create_pull_request | `mcp__github__create_pull_request` | -| playwright | browser_navigate | `mcp__playwright__browser_navigate` | -| playwright | browser_take_screenshot | `mcp__playwright__browser_take_screenshot` | +| Service | Tool Name | Full Invocation Name | +| ---------- | ----------------------- | ------------------------------------------- | +| github | search_code | `mcp__github__search_code` | +| github | create_pull_request | `mcp__github__create_pull_request` | +| playwright | browser_navigate | `mcp__playwright__browser_navigate` | +| playwright | browser_take_screenshot | `mcp__playwright__browser_take_screenshot` | -你可以通过 `/mcp list` 查看每个服务器提供的具体工具列表。 +You can view the list of tools provided by each server using `/mcp list`. -## 故障排查 +## Troubleshooting -### 启动失败 +### Startup Failure -如果 MCP 服务器无法启动,检查: +If an MCP server fails to start, check: -1. `command` 是否已安装(如 `npx` 需要 Node.js) -2. `env` 中的环境变量是否正确(如 `GITHUB_PERSONAL_ACCESS_TOKEN`) -3. 运行 `deepcode` 的终端是否有网络访问权限 +1. Whether `command` is installed (e.g., `npx` requires Node.js) +2. Whether environment variables in `env` are correct (e.g., `GITHUB_PERSONAL_ACCESS_TOKEN`) +3. Whether the terminal running `deepcode` has network access -### 工具不显示 +### Tools Not Showing Up -1. 确认 `settings.json` 中的 `mcpServers` 字段格式正确 -2. 启动 deepcode 后使用 `/mcp` 查看服务器状态 -3. 如果服务器状态显示错误,根据错误信息排查 +1. Verify that the `mcpServers` field in `settings.json` is correctly formatted +2. After starting deepcode, use `/mcp` to check server status +3. If the server status shows an error, debug based on the error message -### Windows 用户 +### Windows Users -在 Windows 上,Deep Code CLI 会自动为 `.cmd` 命令添加 shell 支持。如果你的 MCP 命令是批处理脚本,确保文件名以 `.cmd` 结尾。 +On Windows, Deep Code CLI automatically adds shell support for `.cmd` commands. If your MCP command is a batch script, ensure the filename ends with `.cmd`. -## 编写你自己的 MCP 服务器 +## Writing Your Own MCP Server -MCP 服务器遵循 [Model Context Protocol](https://modelcontextprotocol.io/) 规范,使用 JSON-RPC 2.0 通信。你可以用任何语言编写 MCP 服务器,只要实现以下协议即可: +MCP servers follow the [Model Context Protocol](https://modelcontextprotocol.io/) specification and communicate using JSON‑RPC 2.0. You can write an MCP server in any language as long as it implements the following methods: -1. `initialize` — 握手和协议协商 -2. `tools/list` — 返回可用工具列表 -3. `tools/call` — 执行工具调用 +1. `initialize` — Handshake and protocol negotiation +2. `tools/list` — Return the list of available tools +3. `tools/call` — Execute a tool call -更多参考:[MCP 官方文档](https://modelcontextprotocol.io/) +For more information, see the [official MCP documentation](https://modelcontextprotocol.io/). \ No newline at end of file