Bridge Restish-MCP服务器
概述
此MCP服务器充当一个桥梁,使LLM可以访问您的自定义HTTP API服务器。它从您的HTTP API服务器获取工具定义,并将它们动态注册为LLM可以调用的MCP工具。
运作原理
- 获取工具定义:从中检索可用的工具定义
${BASE_URL}/tools端点 - 注册MCP工具:根据获取的工具定义动态注册MCP工具
- 代理API调用:当LLM调用工具时,它将请求转发到相应的HTTP API端点
HTTP API服务器要求
描述
您的HTTP API服务器应实现以下规范:
运行示例服务器以进行说明。
git clone https://github.com/high-u/mcp-server-bridge-restish.git
cd mcp-server-bridge-restish
node example/server.js 3000工具定义端点
GET ${BASE_URL}/tools 应返回一组工具定义:
curl http://localhost:3000/tools示例响应:
[
{
"name": "get_time",
"description": "Get current date and time",
"schema": {
"type": "object",
"properties": {},
"required": []
},
"endpoint": "/get_time",
"method": "get"
},
{
"name": "get_birthday",
"description": "Get a birthday for a given name",
"schema": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "The name to get birthday for"
}
},
"required": [
"name"
]
},
"endpoint": "/get_birthday",
"method": "get"
}
]工具执行端点
每个工具都通过其指定的端点和方法执行:
GET ${BASE_URL}/get_time→ 以JSON格式返回当前时间
curl http://localhost:3000/get_time{
"time": "2025-06-22T03:53:49.675Z",
"timestamp": 1750564429675
}GET ${BASE_URL}/get_birthday?name=XXX→ 以JSON格式返回XXX的生日
curl "http://localhost:3000/get_birthday?name=John"{
"name": "John",
"birthday": "1973-11-08"
}响应模式由您决定。如何使用它取决于LLM。
用法
配置Claude桌面
将以下内容添加到您的 claude_desktop_config.json:
{
"mcpServers": {
"bridge-restish": {
"command": "mcp-server-bridge-restish",
"args": ["http://localhost:3000", "server-api-key"],
"env": {
"BASE_URL": "http://localhost:3000",
"AUTH_TYPE": "Bearer",
"API_KEY": "server-api-key"
}
}
}
}“BASE_URL”是必需的。根据需要设置“API_KEY”和“AUTH_TYPE”。
用户提示示例
What time is it?How old is John this year?