n

nullplatform

rag-systemsdeveloper-toolsagent-orchestration

328 查看 · 2026-07-07 更新

Meta MCP 代理

一个灵活的模型上下文协议(MCP)代理,能够跨多个MCP服务器和JavaScript函数发现和执行工具。即使你有数百个工具,它也能减少上下文事件。 这个MCP充当其他MCPs(或库)的包装器,通过一种本地检索增强生成(Local RAG)来减小上下文大小,为大语言模型提供两种方法(发现和执行),并要求大语言模型在发现时保持简洁。execute方法是一个简单的代理。

我们强烈建议添加配置discoverDescriptionExtras以详细说明工具的目的以及大语言模型应使用它的主题类型。

特性

  • 🌉 统一工具发现:跨多个MCP服务器搜索工具
  • 🔌 代理执行:将工具调用路由到适当的服务器
  • 🔍 智能搜索:通过模糊匹配找到最适合工作的工具
  • 🧩 JavaScript集成:将自定义JavaScript函数作为MCP工具暴露
  • 📝 可配置:从文件或命令行参数加载配置

使用

🧱 安装

编辑你的文件 ~/Library/Application Support/Claude/claude_desktop_config.json

并添加以下内容:

json { "mcpServers": { "mcp-openapi-proxy": { "command": "npx", "args": ["@nullplatform/meta-mcp-proxy","-f","config.json"] } } }

配置文件格式

你的config.json应该遵循以下结构:

json { "discoverDescriptionExtras": "用于发现的额外描述", "discoverLimit": 10, "mcpServers": { "server-name": { "command": "要执行的命令", "args": ["arg1", "arg2"], "env": { "ENV_VAR1": "value1", "ENV_VAR2": "value2" }, "transport": "stdio" } } }

例如:

{ "discoverDescriptionExtras": "用于管理宠物商店的API,可以访问宠物、宠物类型、用户、订单和商店", "mcpServers": { "mcp-petstore": { "command": "uvx", "args": ["mcp-openapi-proxy"], "env": { "OPENAPI_SPEC_URL": "https://petstore.swagger.io/v2/swagger.json", "API_KEY": "xxxxx" } } } }

Claude 的0-Shot对话示例

该示例使用了几乎没有任何API描述的宠物商店演示配置。

0-shot 示例

作为库使用

您也可以在自己的JavaScript应用程序中将Meta MCP Proxy作为库使用:

javascript import { MCPProxy } from @nullplatform/meta-mcp-proxy ;

// 创建一个新的代理实例 const mcpProxy = new MCPProxy({ mcpServers: { "my-server": { "command": "path/to/server", "args": [], "env": {} } }, discoverLimit: 10 });

// 注册一个自定义JavaScript函数 mcpProxy.registerJsFunction( "myFunction", "我的函数的描述", { properties: { param1: { type: "string", description: "第一个参数" }, param2: { type: "number", description: "第二个参数" } }, required: ["param1"] }, async ({ param1, param2 }) => { // 实现代码放在这里 return { content: [ { type: "text", text: JSON.stringify({ result: 处理了${param1} }) } ] }; } );

// 启动MCP服务器 await mcpProxy.startMCP();

示例:使用meta-mcp-proxy作为库创建MCP

许可证

MIT

服务配置

[{'mcpServers': {'mcp-openapi-proxy': {'args': ['@nullplatform/meta-mcp-proxy', '-f', 'config.json'], 'command': 'npx'}}}, {'mcpServers': {'server-name': {'args': ['arg1', 'arg2'], 'command': 'command-to-execute', 'env': {'ENV_VAR1': 'value1', 'ENV_VAR2': 'value2'}, 'transport': 'stdio'}}}, {'mcpServers': {'mcp-petstore': {'args': ['mcp-openapi-proxy'], 'command': 'uvx', 'env': {'API_KEY': 'xxxxx', 'OPENAPI_SPEC_URL': 'https://petstore.swagger.io/v2/swagger.json'}}}}]

来源