
启动MCP服务器的最简单途径
概览
该仓库包含完整且可运行的单文件自包含MCP服务器模板,支持Python/uv和TypeScript/Deno版本。 - : 复制、粘贴、运行 - 无需复杂配置 - : 两个模板均使用官方 Anthropic SDK - : 所有文档均有可用代码 - : 只需几分钟即可添加自己的工具、资源和提示 - : 本地测试 MCP 想法的最快方法 两个功能上完全相同的、经过实战考验的模板: - - 使用官方 MCP SDK 与 UV 的 Python 服务器- - 使用 Deno 的官方 MCP SDK 的 TypeScript 服务器 每个模板都展示了所有核心MCP功能:- 📊 : LLM上下文的动态数据源 - 🛠️ : LLM可以调用执行操作的功能 - 📝 : 用于LLM交互的可复用模板 - ⚙️ : 环境变量支持 想看看这些服务器的实际操作吗?选择你的语言并运行: 两个服务器都会立即启动,并展示可用的内容!
概述(AI 翻译)
让MCP服务器在2分钟内运行! 本仓库包含完整、可运行的单文件自包含MCP服务器模板,支持Python/uv和TypeScript/Deno。
🚀 为什么是EZ-MCP?
- ** ⚡ 即时设置**:复制、粘贴、运行——无需复杂配置
- ** 🎯 生产就绪**:两个模板均使用官方Anthropic SDK
- ** 📚 全面示例**:所有带有可用代码的文件
- ** 🔧 易于扩展**:几分钟内添加自己的工具、资源和提示
- ** 💡 适合实验**:本地测试MCP想法的最快方法
📁 你得到了什么
两个功能上完全相同的、经过实战考验的模板:
ez-mcp.py- 使用官方 MCP SDK 和 UV 的 Python 服务器ez-mcp.ts- 使用官方MCP SDK配合Deno
每个模板都展示了MCP的所有核心功能:
- 📊 资源:用于大型语言模型上下文的动态数据源
- 🛠️ 工具:LLM可以调用来执行动作的功能
- 📝 提示词:用于大型语言模型交互的可复用模板
- ⚙️ 配置:环境变量支持
⚡ 快速试驾
想看看这些服务器的实际操作吗?选择你的语言并运行:
Python 版本
本页由 AI 翻译,技术细节请以原文为准。
README
以下为原文 README 节选,完整内容请查看原文。
EZ-MCP: The Fastest Way to Build MCP Servers
Get an MCP server running in under 2 minutes! This repository contains complete, ready-to-run templates for single file self-contained MCP servers in both Python/uv and TypeScript/Deno.
🚀 Why EZ-MCP?
- ⚡ Instant Setup: Copy, paste, run - no complex configuration needed
- 🎯 Production Ready: Both templates use official Anthropic SDKs
- 📚 Comprehensive Examples: Everything documented with working code
- 🔧 Easily Extensible: Add your own tools, resources, and prompts in minutes
- 💡 Perfect for Experimentation: The fastest way to test MCP ideas locally
📁 What You Get
Two functionally identical, battle-tested templates:
ez-mcp.py- Python server using official MCP SDK with UVez-mcp.ts- TypeScript server using official MCP SDK with Deno
Each template demonstrates all core MCP features:
- 📊 Resources: Dynamic data sources for LLM context
- 🛠️ Tools: Functions LLMs can call to perform actions
- 📝 Prompts: Reusable templates for LLM interactions
- ⚙️ Configuration: Environment variable support
⚡ Quick Test Drive
Want to see these servers in action? Pick your language and run:
Python Version
# Install uv (if not already installed)
curl -LsSf https://astral.sh/uv/install.sh | sh
# Clone and run immediately
git clone
cd ez-mcp
uv run ez-mcp.py
TypeScript Version
# Install Deno (if not already installed)
curl -fsSL https://deno.land/install.sh | sh
# Clone and run immediately
git clone
cd ez-mcp
deno run --allow-all ez-mcp.ts
Both servers will start immediately and show you what’s available!
🎯 Create Your Own Server (Copy & Customise in 5 Minutes)
The fastest way to build your own MCP server is to copy one of our templates and customise it. Both templates are functionally identical and production-ready - just pick your preferred language!
For Python Developers:
-
Copy the template:
curl -O https://raw.githubusercontent.com/your-repo/ez-mcp/main/ez-mcp.py # Or just copy the ez-mcp.py file contents from this repo -
Rename and customise:
cp ez-mcp.py my-awesome-server.py -
Edit the server details (around line 160):
mcp = FastMCP( name="My Awesome Server", # <- Change this to your server name dependencies=["mcp>=1.9.0"] ) -
Add your own tools (copy this pattern anywhere in the file):
@mcp.tool() def my_custom_tool(input_text: str) -> str: """Describe what your tool does""" # Your logic here return f"Processed: {input_text}" -
Run your server:
uv run my-awesome-server.py
For TypeScript/JavaScript Developers:
- Copy the template:
curl -O https://raw.githubusercontent.com/your-repo/ez-mcp/main/ez-mcp.ts
安装
npx @modelcontextprotocol/inspector deno run --allow-all your-server.ts配置
{
"mcpServers": {
"my-python-server": {
"command": "uv",
"args": ["run", "/absolute/path/to/your-server.py"],
"env": {
"MY_API_KEY": "your-key-here"
}
}
}
}