上下文协议 (Model Context Protocol)
什么是 MCP?
了解更多关于 MCP 的信息
访问官方 MCP 文档以深入了解该协议
访问官方 MCP 文档以深入了解该协议
用途
stdout
或提供 HTTP 端点即可。这种灵活性允许你使用你喜欢的编程语言和技术栈非常快速地实现 MCP 服务器。示例
架构
对于 stdio 服务器,该命令应该是一个 Cursor 可以运行的有效 shell 命令。
对于 SSE 服务器,URL 应该是 SSE 端点的 URL,例如 http://example.com:8000/sse
。
配置 MCP 服务器
// This example demonstrated an MCP server using the stdio format
// Cursor automatically runs this process for you
// This uses a Node.js server, ran with `npx`
{
"mcpServers": {
"server-name": {
"command": "npx",
"args": ["-y", "mcp-server"],
"env": {
"API_KEY": "value"
}
}
}
}
env
字段允许你指定环境变量,这些变量将可用于你的 MCP 服务器进程。这对于管理 API 密钥和其他敏感配置特别有用。