注意:请勿在未经允许的情况下使用此项目进行攻击性、欺骗性或其他非法活动。
项目说明
简介
这是一个基于模型上下文协议的通用工具服务器,支持多种功能模块。
功能特性
- 提供github、gitlab、google maps等多种API接口访问能力
- 实现了内存存储功能
- 集成了网页自动化工具puppeteer
- 支持通过/mcp/gateway路径进行协议封装请求
- 提供/mcp/manifest路径获取服务说明文档
设计目标
- 为AI应用提供多种基础功能支持
- 实现标准化的接口访问协议
- 提供灵活的功能扩展能力
- 支持模块化开发和维护
核心组件
协议封装模块(/mcp/gateway)
- 功能:接收符合模型上下文协议规范的请求,解析并转发到对应功能模块
- 请求格式:
{
"tool": "github",
"action": "listRepos",
"parameters": {
"username": "octocat"
}
}
- 响应格式:
{
"tool": "github",
"action": "listRepos",
"status": "success",
"result": [
{
"id": 1296269,
"name": "Hello-World",
"full_name": "octocat/Hello-World",
...
}
]
}
功能模块
- github工具:提供github API访问能力,支持仓库、用户、issues等操作
- gitlab工具:提供gitlab API访问能力,支持项目、pipeline、issues等操作
- gmaps工具:封装google maps服务接口,支持地理编码、路线规划等功能
- memory工具:实现简单内存数据库功能,支持增删改查
- puppeteer工具:提供网页自动化能力,支持截图、PDF生成等
安装指南
安装依赖
pip install flask requests googlemaps python-pptr
初始化配置
创建config.py文件:
API_KEY_GMAPS = "your_google_maps_api_key"
GITHUB_TOKEN = "your_github_oauth_token"
GITLAB_TOKEN = "your_gitlab_access_token"
使用说明
协议封装接口使用示例
发送请求:
curl -X POST http://localhost:5000/mcp/gateway \
-H "Content-Type: application/json" \
-d '{"tool":"github","action":"listRepos","parameters":{"username":"octocat"}}'
响应结果:
{
"tool": "github",
"action": "listRepos",
"status": "success",
"result": [
{
"id": 1296269,
"name": "Hello-World",
"full_name": "octocat/Hello-World",
...
}
]
}
功能模块直接调用接口
各工具提供独立的访问路径:
- github: /tool/github/...
- gitlab: /tool/gitlab/...
- gmaps: /tool/gmaps/...
- memory: /tool/memory/...
- puppeteer: /tool/puppeteer/...
贡献指南
添加新功能模块
- 在tools目录下创建新工具文件,如
tools/newtool.py
- 按照现有工具的模式实现具体功能
- 将新工具添加到manifest中
- 实现对应的接口访问路由
许可证
本项目采用MIT开源协议。
致谢
感谢以下项目和技术:
- Flask框架:https://flask.palletsprojects.com/
- Google Maps API:https://developers.google.com/maps
- Puppeteer工具:https://github.com/puppeteer/puppeteer
附录:完整英文文档
NOTE: THE FOLLOWING IS THE COMPLETE ENGLISH DOCUMENT FOR REFERENCE ONLY.
PROJECT NOTES
INTRODUCTION
This is a universal tool server based on Model Context Protocol, supporting multiple functional modules.
FUNCTIONALITY FEATURES
- Provides API access capabilities for github、gitlab、google maps and other services
- Implements simple memory storage functionality
- Integrates web automation tool puppeteer
- Supports /mcp/gateway endpoint for protocol encapsulation requests
- Provides /mcp/manifest endpoint for service documentation
DESIGN OBJECTIVES
- Provide multiple basic functionality supports for AI applications
- Implement standardized interface access protocols
- Support flexible function extension capabilities
- Enable modular development and maintenance
CORE COMPONENTS
PROTOCOL ENCAPSULATION MODULE (/mcp/gateway)
- Function: Receives requests compliant with Model Context Protocol specifications, parses and forwards to corresponding functional modules
- Request format:
{
"tool": "github",
"action": "listRepos",
"parameters": {
"username": "octocat"
}
}
- Response format:
{
"tool": "github",
"action": "listRepos",
"status": "success",
"result": [
{
"id": 1296269,
"name": "Hello-World",
"full_name": "octocat/Hello-World",
...
}
]
}
FUNCTIONAL MODULES
- github tool: Provides github API access capabilities, supports repository、user、issues operations
- gitlab tool: Provides gitlab API access capabilities, supports project、pipeline、issues operations
- gmaps tool: Wraps google maps service interfaces, supports geocoding、route planning features
- memory tool: Implements simple in-memory database functionality, supports CRUD operations
- puppeteer tool: Provides web automation capabilities, supports screenshot、PDF generation features
INSTALLATION GUIDE
INSTALL DEPENDENCIES
pip install flask requests googlemaps python-pptr
INITIAL CONFIGURATION
Create config.py file:
API_KEY_GMAPS = "your_google_maps_api_key"
GITHUB_TOKEN = "your_github_oauth_token"
GITLAB_TOKEN = "your_gitlab_access_token"
USAGE INSTRUCTIONS
PROTOCOL ENCAPSULATION INTERFACE USE EXAMPLE
Send request:
curl -X POST http://localhost:5000/mcp/gateway \
-H "Content-Type: application/json" \
-d '{"tool":"github","action":"listRepos","parameters":{"username":"octocat"}}'
Response result:
{
"tool": "github",
"action": "listRepos",
"status": "success",
"result": [
{
"id": 1296269,
"name": "Hello-World",
"full_name": "octocat/Hello-World",
...
}
]
}
FUNCTIONAL MODULE DIRECT ACCESS INTERFACE
Each tool provides independent access path:
- github: /tool/github/...
- gitlab: /tool/gitlab/...
- gmaps: /tool/gmaps/...
- memory: /tool/memory/...
- puppeteer: /tool/puppeteer/...
CONTRIBUTION GUIDE
ADD NEW FUNCTIONAL MODULE
- Create new tool file in tools directory, e.g.,
tools/newtool.py
- Implement specific functionality following existing tool patterns
- Add new tool to manifest
- Implement corresponding interface access route
LICENSE
This project is licensed under the MIT open source protocol.
ACKNOWLEDGEMENTS
Thanks to the following projects and technologies:
- Flask framework: https://flask.palletsprojects.com/
- Google Maps API: https://developers.google.com/maps
- Puppeteer tool: https://github.com/puppeteer/puppeteer