MCP 助手
- 作者仓库星标 59,731
- 作者仓库 warp
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 -pfor the directory and initialize it with an emptymcpServerswrapper key:{ "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_serversserversmcp.servers(nested under amcpkey)- 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)
{
"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:
{
"mcpServers": {
"server-name": {
"command": "node",
"args": ["./tooling/mcp/server.js"],
"working_directory": "/absolute/path/to/repo"
}
}
}
URL-based server (HTTP/SSE streaming transport)
{
"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.jsonfiles 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.
- 流狐分类
- AI 智能
- 作者声明 Agent
- 未找到明确声明;不据此推断已兼容或已测试
- 静态检查
- 88 / 100 · 启发式扫描,不代表运行安全
- 作者 / 版本 / 许可
- @warpdotdev · 未声明 license
- 流狐 Token 估算
- 低消耗
- 流狐接入估算
- 需简单配置
- 是否需要外部 API Key
- 需要 · Vendor-specific
- 检测到的系统要求
- macOS · Linux · Windows
- 底层运行要求
- Node.js
- 检测到的文件与系统行为
-
- 只读
- 允许写入 / 修改
- Shell 执行
- 读取环境变量
- 检测到的网络行为
- 允许外网请求
- 安装命令数
- 无(仅作为资料)
档案由构建时根据 SKILL.md 与安装命令自动衍生,可能与作者实际意图存在差异。
需要注意: 未限定 allowed-tools,默认拥有全部工具权限。
作者没有在当前 SKILL.md 中定义固定输出样例。 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
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…
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: If it exists, read it to determine which top-level wrapper key is already in use. Recognized…
Step 4: Write the Server Configuration
# 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": {
… 作者原文负责流程事实;流狐只索引当前章节、要点、文件与命令。
章节 -> Step 1: Determine Scope → Step 2: Gather Server Details → Step 3: Check and Prepare the Config File → Step 4: Write the Server Configuration → Command-based server (stdio transport) → URL-based server (HTTP/SSE streaming transport)
要点 -> globally · project-scoped · Global (user-scoped) · Project-scoped · If it does not exist · If it exists · Never remove existing server entries · "Detected from Warp"
文件/命令 -> ~/.warp/.mcp.json · {reporoot}/.warp/.mcp.json · mkdir -p · mcpServers · mcpservers · servers · mcp.servers · mcp
内容 SHA-256 -> 8dd798c0826d
方法与流程
适用与边界
原文中的明确线索
~/.warp/.mcp.json、{reporoot}/.warp/.mcp.json、mkdir -p、mcpServers、mcpservers、servers、mcp.servers、mcp