Meta API MCP服务器
与模型上下文协议(MCP)一起工作的元API网关服务器。您可以通过MCP将任何API连接到LLM(Claude、GPT等)。这使得AI助手能够直接与API交互并访问真实世界的数据源。
特性
- 🔄 多API支持:通过单个服务器管理多个API
- 🛠️ 使用JSON配置文件轻松添加API
- 📋 自动将邮差收藏转换为MCP工具
- 🔌 全面支持HTTP API(GET、POST、PUT、DELETE、PATCH)
- 🔒 各种认证方式(API密钥、承载令牌)
- 📁 从本地文件或远程URL加载配置
- 📑 支持配置文件列表
API编辑器工具
开发了一个用户友好的编辑器工具来创建或编辑JSON配置文件:
安装
使用NPM进行全球安装(推荐)
npm install -g meta-api-mcp-server从源代码安装
git clone https://github.com/savhascelik/meta-api-mcp-server.git
cd meta-api-mcp-server
npm install用法
作为命令行工具
# Load from default api-configs/ folder
meta-api-mcp-server
# Specify a configuration file (in the directory where you run the server, there should be a folder with this name and structured json in it)
meta-api-mcp-server path/to/config.json
# Load from a specific folder
meta-api-mcp-server path/to/configs/
# Load from a remote URL
meta-api-mcp-server https://example.com/api-config.json
# Load from a remote configuration list
meta-api-mcp-server https://example.com/config-list.json
# Load from a Postman Collection ( your filename must contain the word ‘postman’, I'll bind it to a variable when I have time )
meta-api-mcp-server path/to/My-API.postman_collection.json与Cursor或其他MCP客户端一起使用
要连接到像Cursor这样的MCP客户端,请配置 mcp.json 文件如下:
{
"mcpServers": {
"myApiServer": {
"command": "meta-api-mcp-server",
"args": [
],
"env": {
"MCP_CONFIG_SOURCE":"api-configs/flexweather-endpoints.json",
"API_KEY": "your-api-key-here"
}
}
}
}{
"mcpServers": {
"myApiServer": {
"command": "meta-api-mcp-server",
"args": [
"server.js",
"path/to/api-config.json"
],
"env": {
"EXAMPLE_API_KEY": "your-api-key-here"
}
}
}
}{
"mcpServers": {
"flexweather": {
"command": "node",
"args": [
"server.js"
],
"env": {
"MCP_CONFIG_SOURCE":"api-configs/flexweather-endpoints.json"
}
}
}
}{
"mcpServers": {
"lemonsqueezy": {
"command": "node",
"args": [
"server.js"
],
"env": {
"MCP_CONFIG_SOURCE":"api-configs/lemon-squeezy-api.json",
"LEMON_SQUEEZY_API_KEY": ""
}
}
}
}邮差收藏转换
使用Meta API MCP服务器使用您现有的邮差收藏现在非常容易!您可以使用数百个现成的API,而无需编写一行代码。
- 导出您的Postman收藏(v2.1.0格式)
- 使用收集文件启动Meta API MCP服务器:
meta-mcp my-collection.postman_collection.json- 服务器将自动:
- 分析所有端点 - 检测身份验证方法 - 提取路径/查询参数 - 分析请求体结构 - 创建MCP工具
- 将API密钥添加到
.env文件(服务器将告诉您要使用哪个环境变量)
支持的邮差收藏功能
- ✅ 多级文件夹结构
- ✅ 承载令牌身份验证
- ✅ API密钥验证
- ✅ 路径参数
- ✅ 查询参数
- ✅ 标头
- ✅ JSON请求体
- ✅ Postman变量(如{{api_url}})
API编辑器工具
开发了一个用户友好的编辑器工具来创建或编辑JSON配置文件:
使用此网络工具,您可以:
- 通过可视化界面创建API配置
- 编辑现有JSON配置
- 将Postman集合转换为MCP兼容的配置文件
- 验证配置文件
- 将配置导出为JSON
邮递员收藏: 您可以将现有的Postman集合上传到编辑器工具,并自动将其转换为MCP兼容的配置。这允许您快速使用现有的集合,而不是从头开始配置API。
编辑器使管理工具名称、参数和所有其他配置选项变得容易。
项目结构
代码库以模块化的方式组织,以方便维护和扩展:
meta-api-mcp-server/
├── serve.js
├── api-configs/ # Default config directory
└── package.jsonAPI配置文件格式
您可以使用以下JSON格式手动配置API:
{
"apiId": "my-api",
"handlerType": "httpApi",
"baseUrl": "https://api.example.com",
"authentication": {
"type": "bearerToken",
"envVariable": "MY_API_TOKEN"
},
"endpoints": [
{
"mcpOperationId": "getUsers",
"description": "Get a list of users",
"targetPath": "/users",
"targetMethod": "GET",
"parameters": [
{
"name": "page",
"in": "query",
"required": false,
"type": "integer",
"description": "Page number"
}
]
}
]
}许可证
麻省理工学院
