I craft unique cereal names, stories, and ridiculously cute Cereal Baby images.

MCP-Server
serveur MCP
3 years
Works with Finder
1
Github Watches
0
Github Forks
0
Github Stars
MCP API Server
企业级微服务API服务端,支持MCP协议扩展。
✨ 功能特性
- MCP协议集成(支持工具扩展和资源访问)
- 动态API工具注册
- TypeScript强类型支持
🚀 快速开始
前置要求
- Node.js 18+
- npm 9+
- TypeScript 5.0+
安装步骤
# 克隆仓库
git clone https://github.com/your-repo/mcp-api-server.git
# 安装依赖
npm install
# 生产环境构建
npm run build
MCP 配置参数
{
"mcpServers": {
"api-server": {
"command": "node",
"args": [
"D:/api-server/build/index.js"
],
"env": {
"BASE_URL": "https://127.0.0.0:8080",
"CLIENT_ID": "xxx",
"CLIENT_SECRET": "xxx",
"USERNAME": "xxx",
"PASSWORD": "xxx",
"TENANT_ID": "1",
"REJECT_UNAUTHORIZED": "false",
"ALLOWED_APIS": "/admin-api/system/user/page,/admin-api/system/user/create,/admin-api/system/user/update"
},
"disabled": false,
"autoApprove": []
}
}
}
配置说明
在 mcpServers
中配置 ALLOWED_APIS
数组来控制哪些API端点可以作为MCP工具暴露:
📂 项目结构
mcp-api-server/
├── build/ # 编译输出目录
├── src/ # 源代码
│ ├── config/ # 配置模块
│ ├── modules/ # 业务模块
│ └── tools/ # MCP工具协议
├── package.json
└── tsconfig.json
📡 MCP Tools
动态API工具系统
MCP-Server 实现了基于 OpenAPI 规范的动态工具发现和注册机制,无需手动配置即可自动生成 MCP 工具。
apiEndpoints.ts 功能说明
// 从OpenAPI规范自动获取API端点信息
const openApiData = await fetchOpenApiData();
// 根据配置的允许列表过滤API
const API_ENDPOINTS = Object.entries(openApiData.paths)
.filter(([path]) => config.ALLOWED_APIS.includes(path))
.map(([path, methods]) => {
// 转换为标准工具格式
return Object.entries(methods).map(([method, details]) => ({
name: details.operationId,
description: details.summary,
inputSchema: details.parameters ? {
type: 'object',
properties: Object.fromEntries(details.parameters
.filter(isExposableParameter)
.map(transformParameterToProperty)
)
} : {},
path: path,
method: method.toUpperCase()
}));
}).flat();
tools/index.ts 工具注册机制
export function registerTools(server: Server) {
// 注册可用工具列表
server.setRequestHandler(ListToolsRequestSchema, async () => ({
tools: tools,
}));
// 处理工具调用请求
server.setRequestHandler(CallToolRequestSchema, async (request) => {
const endpoint = apiMap[request.params.name];
// 根据HTTP方法类型动态处理请求
if(endpoint.method === 'GET') {
const response = await apiClient.get(endpoint.path, { params: request.params.arguments });
return { content: [{ type: 'text', text: JSON.stringify(response.data, null, 2) }] };
} else if(endpoint.method === 'POST') {
const response = await apiClient.post(endpoint.path, request.params.arguments);
return { content: [{ type: 'text', text: JSON.stringify(response.data, null, 2) }] };
} else if(endpoint.method === 'PUT') {
const response = await apiClient.put(endpoint.path, request.params.arguments);
return { content: [{ type: 'text', text: JSON.stringify(response.data, null, 2) }] };
}
});
}
系统优势
- 自动发现: 通过 OpenAPI 规范自动发现和注册API端点
- 缓存机制: 实现了API规范数据的缓存,提高性能并处理网络异常
- 参数转换: 自动将OpenAPI参数定义转换为MCP工具输入模式
- 安全过滤: 过滤内部参数,只暴露安全的API参数
- 错误处理: 完善的错误处理机制,确保工具调用稳定性
- 工具注册: 自动注册可用工具列表,无需手动配置
🤝 贡献指南
- Fork项目仓库
- 创建特性分支 (
git checkout -b feature/your-feature
) - 提交修改 (
git commit -m 'Add some feature'
) - 推送分支 (
git push origin feature/your-feature
) - 创建Pull Request
📄 许可证
MIT License
相关推荐
Evaluator for marketplace product descriptions, checks for relevancy and keyword stuffing.
Confidential guide on numerology and astrology, based of GG33 Public information
A geek-themed horoscope generator blending Bitcoin prices, tech jargon, and astrological whimsy.
Advanced software engineer GPT that excels through nailing the basics.
Therapist adept at identifying core issues and offering practical advice with images.
Découvrez la collection la plus complète et la plus à jour de serveurs MCP sur le marché. Ce référentiel sert de centre centralisé, offrant un vaste catalogue de serveurs MCP open-source et propriétaires, avec des fonctionnalités, des liens de documentation et des contributeurs.
Manipulation basée sur Micropython I2C de l'exposition GPIO de la série MCP, dérivée d'Adafruit_MCP230XX
Une passerelle API unifiée pour intégrer plusieurs API d'explorateur de blockchain de type étherscan avec la prise en charge du protocole de contexte modèle (MCP) pour les assistants d'IA.
Miroir dehttps: //github.com/bitrefill/bitrefill-mcp-server
Reviews

user_xui9ygAG
I have been using mcp-server by qingtianyu for several months and it has significantly improved my server management experience. The project is well-documented and the community support is excellent. Highly recommend for anyone looking for a robust and reliable server management tool. Check it out on GitHub!