
easyMcp
Enable developers to quickly build an MCP server service framework that supports stdio and sse。使开发者快速的搭建一个支持stdio与sse的mcp server服务框架
what is easyMcp?
easyMcp is a framework that enables developers to quickly build an MCP (Multi-Channel Protocol) server service that supports standard input/output (stdio) and server-sent events (sse).
how to use easyMcp?
To use easyMcp, developers can clone the repository from GitHub, set up their development environment, and follow the provided documentation to create their own MCP server.
key features of easyMcp?
- Quick setup for MCP server services
- Support for stdio and sse
- Easy integration with existing applications
use cases of easyMcp?
- Building real-time applications that require server-sent events.
- Developing multi-channel communication systems.
- Creating custom server solutions for various applications.
FAQ from easyMcp?
- What programming languages does easyMcp support?
easyMcp is designed to be language-agnostic, allowing integration with various programming languages that can handle stdio and sse.
- Is easyMcp free to use?
Yes! easyMcp is open-source and free for developers to use.
- Where can I find the documentation?
Documentation is available in the GitHub repository under the 'docs' folder.
easyMcp
Just two steps to help developers quickly build an extensible mcp server framework that supports both stdio and SSE startup modes.
User Manual
1. Step One [Optional] Define Required Configuration
Define your project's required configuration in src/config/.env, for example, database configuration:
# MySQL Database Configuration
MYSQL_HOST=192.168.3.229
MYSQL_PORT=3306
MYSQL_USER=root
MYSQL_PASSWORD=root
MYSQL_DATABASE=a_llm
MYSQL_ROLE=admin
2. Step Two Create Your Own Tools
Add your own tool classes in the src/handles directory, refer to the example.py sample
- Inherit from BaseHandler
- Define the name property, which is the tool's name
- Define the description property, which is the tool's description
- Implement the get_tool_description method, which tells the mcp client what your tool does
- Implement the run_tool method, which is called by the mcp client to execute your tool's logic
- Reference the new tool in init.py
example.py
from typing import Dict, Any, Sequence
from mcp import Tool
from mcp.types import TextContent
from .base import BaseHandler
from config import get_config
class Example(BaseHandler):
name = "get_Example"
description = (
"this is Example xxxx"
)
def get_tool_description(self) -> Tool:
return Tool(
name=self.name,
description=self.description,
inputSchema={
"type": "object",
"properties": {
"text": {
"type": "string",
"description": "This is the text that must be entered for the example"
}
},
"required": ["text"]
}
)
async def run_tool(self, arguments: Dict[str, Any]) -> Sequence[TextContent]:
try:
if "text" not in arguments:
raise ValueError("Missing text content")
text = arguments["text"]
# Reference configuration information
config = get_config()
## todo something
result = "xxxxxxx"
# Join all results with commas
return [TextContent(type="text", text=','.join(result))]
except Exception as e:
return [TextContent(type="text", text=f"error: {str(e)}")]
init.py
from .example import Example
__all__ = [
"Example",
]
3. Startup
Currently, this framework supports two startup modes: stdio and SSE.
1. SSE Mode
- Start the service using uv
Add the following content to your mcp client tool, such as cursor, cline, etc.
mcp json as follows
{
"mcpServers": {
"easyMcp": {
"name": "easyMcp",
"description": "",
"isActive": true,
"baseUrl": "http://localhost:9000/sse"
}
}
}
Startup command
# Download dependencies
uv sync
# Start
uv run server.py
2. STDIO Mode
Add the following content to your mcp client tool, such as cursor, cline, etc.
mcp json as follows
{
"mcpServers": {
"easyMcp": {
"isActive": true,
"name": "easyMcp",
"command": "uv",
"args": [
"--directory",
"G:\\python\\mysql_mcp\\src", # Replace this with your project path
"run",
"server.py",
"--stdio"
],
"env": {
"MYSQL_HOST": "192.168.xxx.xxx",
"MYSQL_PORT": "3306",
"MYSQL_USER": "root",
"MYSQL_PASSWORD": "root",
"MYSQL_DATABASE": "a_llm",
"MYSQL_ROLE": "admin"
}
}
}
}
## Effect diagram
