MCP远程服务添加福利群:解决AI开发者的「MCP实战痛点」一个可配置的模型上下文协议(MCP)服务器,可以从远程配置动态加载其功能。这利用了 ModelContextProtocol 来创建一个可以与本地MCP客户端通信的本地服务器。
mcp-remote-server充当MCP客户端和远程API之间的桥梁。它解析通过MCP_CONTROL_PLANE_URL指定的远程托管配置,该配置包含工具、资源和提示的列表,每个都指向远程API端点。
{
"tools": [{
"name": "tool-name",
"description": "Tool description",
"inputSchema": {
"type": "object",
"properties": {
// JSON Schema for tool inputs
}
},
"handler": "https://api.example.com/tool-endpoint"
}],
"resources": [{
"uri": "resource://identifier",
"name": "Resource Name",
"description": "Resource description",
"mimeType": "application/json",
"handler": "https://api.example.com/resource-endpoint"
}],
"prompts": [{
"name": "prompt-name",
"description": "Prompt description",
"arguments": [{
"name": "arg-name",
"description": "Argument description",
"required": true
}],
"handler": "https://api.example.com/prompt-endpoint"
}]
}

远程处理器必须返回适当格式化的响应:
bun install
export MCP_CONTROL_PLANE_URL="https://your-config-endpoint"

bun run index.ts
该项目使用bun v1.1.32中的bun init创建。Bun是一个快速的一体化JavaScript运行时。我选择Bun是因为它速度快,而且我想尝试一些不同的东西。
该项目还使用Biome进行类型检查和代码检查。我选择Biome的原因与选择Bun相同。我希望JS有一个类似gofmt的工具。这是一个好的开始。