代理添加
- 作者仓库星标 59,731
- 作者仓库 warp
- 领域
- 人工智能
- 作者声明的智能体
- 未找到明确声明;不据此推断已兼容或已测试
- 静态检查
- 88 / 100 · 启发式扫描,不代表运行安全
- 运行环境证据
- 未执行;当前没有隔离运行测试证据
- 作者 / 版本 / 许可证
- @warpdotdev · 未声明许可证
- 上下文用量评级
- 低消耗
- 接入复杂程度
- 需简单配置
- 是否需要外部接口密钥
- 需要 · Vendor-specific
- 兼容的系统
- macOS · Linux · Windows
- 运行环境要求
- Node.js
- 检测到的文件与系统行为
-
- 只读
- 允许写入 / 修改
- 命令执行
- 读取环境变量
- 网络行为
- 允许外网请求
- 安装命令数
- 无(仅作为资料)
需要注意: 未声明工具权限范围;实际权限由运行环境决定。
第 1 步:确定范围
如果用户未指定,请询问他们是否要全局配置服务器(针对所有项目)或项目范围的服务器(仅针对特定存储库)。配置文件路径: 全局(用户范围):`~/.warp/.mcp.json` 项目范围:`{repo_root}/.warp/.mcp.json`
第 2 步:收集服务器详细信息
如果用户未提供服务器的连接详细信息,请使用 WebSearch 查找指定服务器的正确配置。如果不清楚服务器是否应作为本地 CLI 进程(stdio 传输)运行或通过 URL 连接(HTTP/SSE 流传输),请询问用户他们更喜欢哪一个。
第三步:检查并准备配置文件
检查目标配置文件是否存在。如果不存在,则使用目录的`mkdir -p`创建它,并使用空的`mcpServers`包装器密钥对其进行初始化:如果存在,则读取它以确定哪个顶级包装器密钥已在使用中。识别的包装键(按优先顺序排列): `mcpServers` *(首选)* `mcp_servers`
# Adding MCP Servers to Warp
Warp supports MCP servers via native config files. Follow these steps when helping a user add an MCP server.
## Step 1: Determine Scope
If the user hasn't specified, ask whether they want to configure the server **globally** (for all projects) or **project-scoped** (for a specific repository only).
Config file paths:
- **Global (user-scoped):** `~/.warp/.mcp.json`
- **Project-scoped:** `{repo_root}/.warp/.mcp.json`
## Step 2: Gather Server Details
If the user hasn't provided the server's connection details, use WebSearch to find the correct configuration for the named server.
If it's unclear whether the server should be run as a local CLI process (stdio transport) or connected to via URL (HTTP/SSE streaming transport), ask the user which they prefer.
## Step 3: Check and Prepare the Config File
Check whether the target config file exists.
- **If it does not exist**, create it with `mkdir -p` for the directory and initialize it with an empty `mcpServers` wrapper key:
```json
{
"mcpServers": {}
}
```
- **If it exists**, read it to determine which top-level wrapper key is already in use. Recognized wrapper keys (in order of preference):
- `mcpServers` *(preferred)*
- `mcp_servers`
- `servers`
- `mcp.servers` (nested under a `mcp` key)
- Flat map (each top-level key is a server name)
Preserve the existing wrapper key when writing. If the existing key is unrecognized or incompatible, switch to `mcpServers`.
**Never remove existing server entries** — only add or update the new server.
## Step 4: Write the Server Configuration
### Command-based server (stdio transport)
```json
{
"mcpServers": {
"server-name": {
"command": "npx",
"args": ["-y", "@scope/package-name"],
"env": {
"API_KEY": "${API_KEY}"
}
}
}
}
```
By default, Warp spawns stdio servers from the directory the config was discovered in:
- Project-scoped configs (`{repo_root}/.warp/.mcp.json`) run from the repo root.
- Global configs (`~/.warp/.mcp.json`, `~/.claude.json`, etc.) run from the home directory.
If the server's `command` or `args` are relative paths (e.g. `./tooling/mcp/server.js`) or the server expects a specific cwd, set `working_directory` to override the default:
```json
{
"mcpServers": {
"server-name": {
"command": "node",
"args": ["./tooling/mcp/server.js"],
"working_directory": "/absolute/path/to/repo"
}
}
}
```
### URL-based server (HTTP/SSE streaming transport)
```json
{
"mcpServers": {
"server-name": {
"url": "https://example.com/mcp",
"env": {
"API_KEY": "${API_KEY}"
}
}
}
}
```
For environment variables containing secrets, use `${VAR_NAME}` syntax — Warp will substitute the value from the user's environment at runtime.
## Notes
- Warp auto-detects changes to `.mcp.json` files on save — no restart required.
- Configured servers appear in Warp's Settings under MCP, labeled **"Detected from Warp"**.
- Global config applies across all sessions; project config only applies when working inside that repository.
章节与文件索引
按说明文件中的顺序排列。
第 1 步:确定范围
第 2 步:收集服务器详细信息
第三步:检查并准备配置文件
基于命令的服务器(stdio 传输)
基于 URL 的服务器(HTTP/SSE 流传输)
文件/命令 -> ~/.warp/.mcp.json · {repo_root}/.warp/.mcp.json · mkdir -p · mcpServers · mcp_servers · servers · mcp.servers · mcp
内容校验值 -> 8dd798c0826d
当前原文的自动摘译,尚未人工审校。
第三步:检查并准备配置文件
检查目标配置文件是否存在。如果不存在,则使用目录的
mkdir -p创建它,并使用空的mcpServers包装器密钥对其进行初始化:如果存在,则读取它以确定哪个顶级包装器密钥已在使用中。识别的包装键(按优先顺序):mcpServers(首选)mcp_servers基于命令的服务器(stdio 传输)
默认情况下,Warp 从发现配置的目录中生成 stdio 服务器:项目范围的配置 (
{repo_root}/.warp/.mcp.json) 从存储库根运行。全局配置(~/.warp/.mcp.json、~/.claude.json等)从主目录运行。如果服务器的command或args是相对路径(例如./tooling/mcp/server.js)或服务器需要特定的cwd,请设置working_directory以覆盖默认值:基于 URL 的服务器(HTTP/SSE 流传输)
对于包含机密的环境变量,请使用
${VAR_NAME}语法 - Warp 将在运行时替换用户环境中的值。