
my_mcp
3 years
Works with Finder
2
Github Watches
0
Github Forks
2
Github Stars
🚀 My MCP Server
A lightweight, self-hosted MCP (Model Context Protocol) server based on the official MCP specification.
🚀 What is this?
This project provides a quick transformation structure
to adapt your existing backend services into an MCP-compliant server with minimal changes.
You can expose your existing service methods as MCP tools effortlessly!
✅ Only one requirement:
Make sure your services/
package contains all the business interfaces you want to expose as MCP tools.
🛠️ Features
- ⚡ Fast Transformation: Quickly adapt your current backend into an MCP server.
- 🔍 Auto Discovery: Automatically scan and register service methods as MCP tools.
- 📦 Fully MCP-Compatible: Seamless connection to MCP Inspector or any MCP-compliant client.
- 🛠️ Minimal Invasive: No need to heavily modify your existing service logic.
- 🚀 Plug-and-Play: Just organize your methods properly under the
services/
directory.
📂 Project Structure
my_mcp_server/
├── app.py # FastAPI app, defines /sse and /rpc endpoints
├── config/ # Configuration files
├── core/
│ ├── mcp_session.py # MCP session logic
│ ├── mcp_session_manager.py # Session management
│ ├── models/ # Event, McpRequest, Tool models
│ └── utils/ # Scanners and path finders
├── services/ # Business services to expose as MCP tools
│ ├── math_tool.py # Example tool: math operations
├── README.md # Project documentation
└── requirements.txt # Python dependencies
📦 Quick Start
1. Install dependencies
pip install -r requirements.txt
2. Start the server
uvicorn app:app --host 0.0.0.0 --port 8000 --reload
3. Connect MCP Inspector
- Open MCP Inspector
- Set your MCP Server URL to:
http://localhost:8000
- Start interacting!
📚 How It Works
- When a client connects to
/sse
, the server:- Creates a new
McpSession
. - Scans all tools in
services/
and registers them. - Immediately pushes an
initialize
event.
- Creates a new
- When a client sends a request to
/v1/mcp/events/send
:- The server routes it to the correct session.
- Dispatches
initialize
,tools/list
, ortools/call
accordingly.
- Tools are dynamically mapped to your service methods.
⚠️ Notes
- All business logic you want to expose must be placed inside the
services/
directory. - Each service method should be an
async def
coroutine. - Tool scanning supports simple class-based services.
- Make sure method names are unique across all services to avoid conflicts.
📄 Example Service (services/math_tool.py
)
class MathService:
async def add(self, a: int, b: int) -> int:
"""Add two numbers."""
return a + b
async def subtract(self, a: int, b: int) -> int:
"""Subtract two numbers."""
return a - b
Once placed under services/
, they will be automatically scanned and registered as MCP tools!
📋 Todo (optional extensions)
- Support nested sub-packages inside
services/
- Add Session idle timeout and auto cleanup
- Add
/health
and/metrics
endpoints - Add Dockerfile and CI/CD scripts
📜 License
This project is open-sourced under the MIT License.
相关推荐
🔥 1Panel proporciona una interfaz web intuitiva y un servidor MCP para administrar sitios web, archivos, contenedores, bases de datos y LLM en un servidor de Linux.
⛓️Rulego es un marco de motor de regla de orquestación de componentes de alta generación de alto rendimiento, de alto rendimiento y de alto rendimiento para GO.
🧑🚀 全世界最好的 llM 资料总结(数据处理、模型训练、模型部署、 O1 模型、 MCP 、小语言模型、视觉语言模型) | Resumen de los mejores recursos del mundo.
Traducción de papel científico en PDF con formatos preservados - 基于 Ai 完整保留排版的 PDF 文档全文双语翻译 , 支持 支持 支持 支持 支持 支持 支持 支持 支持 支持 支持 支持 等服务 等服务 等服务 提供 提供 提供 提供 提供 提供 提供 提供 提供 提供 提供 提供 cli/mcp/docker/zotero
Cree fácilmente herramientas y agentes de LLM utilizando funciones Plain Bash/JavaScript/Python.
😎简单易用、🧩丰富生态 - 大模型原生即时通信机器人平台 | 适配 Qq / 微信(企业微信、个人微信) / 飞书 / 钉钉 / Discord / Telegram / Slack 等平台 | 支持 Chatgpt 、 Deepseek 、 DiFy 、 Claude 、 Gemini 、 Xai 、 PPIO 、 Ollama 、 LM Studio 、阿里云百炼、火山方舟、 Siliconflow 、 Qwen 、 Moonshot 、 Chatglm 、 SillyTraven 、 MCP 等 LLM 的机器人 / Agente | Plataforma de bots de mensajería instantánea basada en LLM, admite Discord, Telegram, WeChat, Lark, Dingtalk, QQ, Slack
Iniciar aplicaciones de múltiples agentes empoderadas con Building LLM de manera más fácil.
Reviews

user_KYijBxlr
I am absolutely thrilled with my_mcp by chengnanyimeng. This application has exceeded all my expectations with its user-friendly interface and seamless integration. It's clear that a lot of thought has gone into the design and functionality, making it an indispensable tool in my daily routine. Highly recommend it to anyone looking for a reliable and efficient solution.

user_znOi4z6d
My_MCP is incredibly useful for streamlining my workflow! The app, created by chengnanyimeng, is intuitive and user-friendly, making it easy to navigate from the start URL. The welcoming information is clear and helpful, setting you up for success right away. Highly recommend for anyone needing a robust MCP application.

user_hSrxOBy9
I've been using my_mcp by chengnanyimeng for a while now, and it has significantly improved my workflow. The intuitive interface and reliable performance make it a top choice for anyone looking for high-quality MCP applications. Additionally, the comprehensive welcome information ensures a smooth start, even for new users. Highly recommended!

user_DmkJ6k5g
I recently started using my_mcp by chengnanyimeng and I'm thoroughly impressed. The application is user-friendly and offers seamless functionality. The welcome information makes it easy to get started, and the initial URL provided clear direction right from the beginning. Highly recommend for anyone seeking efficient solutions!

user_a2oWMBCx
I have been using my_mcp by chengnanyimeng for a while now, and it has significantly streamlined my workflow. The application is intuitive and user-friendly, making complex processes manageable and efficient. I highly recommend it to anyone looking for a reliable solution in its category.