MCP服务器配置_agent-add-mcp
以下为本文档的中文说明
agent-add-mcp 是一个专门用于帮助用户将 MCP(Model Context Protocol)服务器添加到 Warp 终端模拟器 AI 功能配置文件中的用户辅助技能。Warp 是一款基于 Rust 语言开发的新一代现代化 GPU 加速终端模拟器,其内置的 AI 智能助手功能是其核心竞争力之一。MCP(Model Context Protocol)是一种新兴的开放协议标准,允许大语言模型驱动的 AI Agent 通过标准化的接口与外部工具、数据源和服务进行安全的双向交互。该技能极大简化了在 Warp 的 AI 工作流中配置和使用 MCP 服务器的复杂流程。使用场景包括:在 Warp 终端中为 AI 助手配置一个新的 MCP 工具服务器以扩展其能力边界、为 AI Agent 添加如本地文件系统操作、数据库查询、第三方 API 调用等具体的工具集成、管理和维护 Warp 中已配置的多个 MCP 服务器的启动、停止和参数更新。核心特点包括:自动智能检测当前系统上 Warp 的 AI Agent 配置文件的准确存放路径(跨平台支持 macOS 和 Windows 的差异路径)和 YAML/JSON 配置文件的具体格式语法要求;提供引导式的交互式 MCP 服务器配置向导,以一步步问答的方式引导用户完成从选取 MCP 服务器类型到填写必要参数(如命令路径 command、环境变量 env、参数列表 args 等)的完整配置过程;内置对常见和热门的 MCP 服务器实现的开箱即用配置模板,覆盖文件系统操作(Read/Write/Search File System)、数据库查询(SQLite/PostgreSQL 数据库连接)、Web 抓取和内容获取、Git 仓库操作等典型工具场景;自动对用户填写的 MCP 服务器配置进行正确性校验和端到端连通性测试,确保配置能够正常启动和工作;提供配置变更前的自动备份和错误配置的快速一键重置恢复功能;当 MCP 服务器启动失败或连接异常时提供详细的错误诊断信息和针对性的修复操作建议。该技能让 Warp 用户能够以极低的门槛扩展其终端 AI 助手的实际工具操作能力。
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.
3d:[“","","","L3f”,null,{“content”:“$40”,“frontMatter”:{“name”:“agent-add-mcp”,“description”:“Use this skill when helping users add MCP servers to their Warp configuration.”}}]
41:I[471044,[“/_next/static/chunks/051aanbhrv4br.js”,“/_next/static/chunks/0mizr60h7ayzt.js”,“/_next/static/chunks/0v9lm1dmbdoo-.js”,“/_next/static/chunks/0rxr1j1j3j-.r.js”,“/_next/static/chunks/02ftybezfvqjd.js”,“/_next/static/chunks/0.v9ksvnnj8ia.js”,“/_next/static/chunks/0bn6id96nx3k.js",“/_next/static/chunks/13ybnhn37c.tc.js”,“/_next/static/chunks/0_fnrdtruz8uf.js”,“/_next/static/chunks/0r6l15utt1mwb.js”,“/_next/static/chunks/0dm9a5into854.js”,"/_next/static/chunks/07k6hqoibtcn.js”,“/next/static/chunks/0b4cao.4y…j.js”,“/_next/static/chunks/02i-n28z7kjd0.js”],“SkillSidebar”]
3a:[“","","","L41”,null,{“skill”:“KaTeX parse error: Expected 'EOF', got '}' at position 261: …de":"15-1252"}]}̲] 3e:["”,“section”,null,{“aria-labelledby”:“related-skills-heading”,“className”:“mt-8 overflow-hidden rounded-lg border border-border bg-card”,“children”:[[“KaTeX parse error: Expected '}', got 'EOF' at end of input: …,"children":[["”,“div”,null,{“className”:“flex min-w-0 items-center gap-2”,“children”:[“KaTeX parse error: Expected 'EOF', got '}' at position 108: …同仓库更多 Skills"}]}̲],["”,“span”,null,{“className”:“shrink-0 text-xs text-muted-foreground”,“children”:“同仓库”}]]}],[“KaTeX parse error: Expected '}', got 'EOF' at end of input: …,"children":[["”,“h2”,null,{“id”:“related-skills-heading”,“className”:“text-2xl font-semibold tracking-normal text-foreground”,“children”:“同仓库更多 Skills”}],[“KaTeX parse error: Expected '}', got 'EOF' at end of input: …","children":["L42”,“L43","L43","L43","L44”,“L45","L45","L45","L46”,“$L47”]}]]}]]}]
48:I[206516,[“/_next/static/chunks/051aanbhrv4br.js”,“/_next/static/chunks/0mizr60h7ayzt.js”,“/_next/static/chunks/0v9lm1dmbdoo-.js”,“/_next/static/chunks/0rxr1j1j3j-.r.js”,“/_next/static/chunks/02ftybezfvqjd.js”,“/_next/static/chunks/0.v9ksvnnj8ia.js”,“/_next/static/chunks/0bn6id96nx3k.js",“/_next/static/chunks/13ybnhn37c.tc.js”,“/_next/static/chunks/0_fnrdtruz8uf.js”,“/_next/static/chunks/0r6l15utt1mwb.js”,“/_next/static/chunks/0dm9a5into854.js”,"/_next/static/chunks/07k6hqoibtcn.js”,“/next/static/chunks/0b4cao.4y…j.js”,“/_next/static/chunks/02i-n28z7kjd0.js”],“default”]
openEuler 是由开放原子开源基金会孵化的全场景开源操作系统项目,面向数字基础设施四大核心场景(服务器、云计算、边缘计算、嵌入式),全面支持 ARM、x86、RISC-V、loongArch、PowerPC、SW-64 等多样性计算架构
更多推荐
所有评论(0)