多MCP服务器
一组模型上下文协议(MCP)服务器,提供本地笔记和屏幕截图功能。
什么是MCP?
模型上下文协议(MCP)是一个开放标准,使AI助手能够安全地与外部数据源和工具连接。MCP允许AI模型:
- 从各种来源获取实时信息
- 与外部系统和API交互
- 跨不同应用程序维护上下文
- 通过自定义工具扩展其功能
该项目实现了多个MCP服务器,这些服务器提供不同的工具,允许AI助手从本地系统中做笔记和截图。
概述
此项目包含两个MCP服务器:
- LocalNotes (
local.py)-管理存储在本地文本文件中的笔记 - 屏幕截图演示 (
screenshot.py)-捕获屏幕截图
这两台服务器既可以单独使用,也可以一起使用,以增强具有笔记和视觉捕捉功能的人工智能助理功能。
特性
LocalNotes服务器
- 添加注释:将新笔记添加到本地笔记文件
- 阅读笔记:检索所有存储的笔记
- 本地存储:笔记存储在一个简单的文本文件中(
notes.txt) - 错误处理:文件操作的强大错误处理
截屏服务器
- 屏幕捕获:截取当前屏幕的屏幕截图
- 图像处理:返回优化的JPEG图像
- 实时捕捉:捕获当前屏幕上显示的任何内容
需求
- Python 3.11或更高版本
- MCP CLI软件包
- PyAutoGUI(用于屏幕截图功能)
安装
选项1:使用uvx直接安装(推荐)
您可以使用uvx直接从GitHub存储库运行MCP服务器:
uvx --from git+https://github.com/akaiserg/multi-mcp-servers.git mcp-server这将直接安装并运行MathCalculator MCP服务器,而无需克隆存储库。
选项2:地方发展设置
- 克隆此存储库:
git clone https://github.com/akaiserg/multi-mcp-servers.git
cd multi-mcp-servers- 使用uv安装依赖项(推荐):
uv sync或者使用pip:
pip install -e .用法
运行MCP服务器
使用uvx(推荐)
要直接从GitHub运行MathCalculator MCP服务器:
uvx --from git+https://github.com/akaiserg/multi-mcp-servers.git mcp-server本地开发-单个服务器
要在开发期间在本地运行特定服务器,请执行以下操作:
LocalNotes服务器:
python local.py截屏服务器:
python screenshot.py加密服务器:
python crypto.py提示服务器:
python prompt.pyMathCalculator服务器:
python src/mcpserver/deployment.py每个服务器将在单独的实例上启动并监听MCP协议通信。
可用工具
LocalNotes服务器工具
1. add_note_to_file
- 描述:将内容附加到本地笔记文件
- 参数:
content(string)-要附加的注释内容 - 退货:成功/错误消息
示例用法:
AI Assistant: "I'll save this important information for you."
Tool Call: add_note_to_file("Meeting notes: Discussed project timeline, deadline is Dec 15th")
Response: "Note appended to notes.txt"2. read_notes_from_file
- 描述:从本地笔记文件中读取所有笔记
- 参数:无
- 退货:所有存储的钞票或“未找到钞票”(如果为空)
示例用法:
AI Assistant: "Let me check your saved notes."
Tool Call: read_notes_from_file()
Response: "my note
Meeting notes: Discussed project timeline, deadline is Dec 15th"截屏服务器工具
1. capture_screenshot
- 描述:捕获当前屏幕并将其作为图像返回
- 参数:无
- 退货:当前屏幕的JPEG图像
示例用法:
AI Assistant: "I'll take a screenshot of your current screen."
Tool Call: capture_screenshot()
Response: [Returns optimized JPEG image of the screen]与MCP客户端集成
这两台服务器都可以与任何兼容MCP的客户端集成。以下是一些示例:
Claude桌面集成
选项1:使用uvx(推荐) 使用uvx将MCP服务器添加到Claude Desktop配置中:
{
"mcpServers": {
"math-calculator": {
"command": "uvx",
"args": ["--from", "git+https://github.com/akaiserg/multi-mcp-servers.git", "mcp-server"]
}
}
}选项2:地方发展设置 将服务器添加到您的Claude Desktop MCP配置中以进行本地开发:
{
"mcpServers": {
"local-notes": {
"command": "python",
"args": ["/path/to/your/project/local.py"]
},
"screenshot": {
"command": "python",
"args": ["/path/to/your/project/screenshot.py"]
},
"math-calculator": {
"command": "python",
"args": ["/path/to/your/project/src/mcpserver/deployment.py"]
}
}
}与AI助手的对话示例
User: "Can you save a note about my grocery list and then take a screenshot?"
AI: "I'll save that note for you and capture a screenshot of your current screen."
[AI calls add_note_to_file("Grocery list: milk, bread, eggs, apples")]
[AI calls capture_screenshot()]
AI: "I've saved your grocery list to your local notes and captured a screenshot of your screen!"
User: "What notes do I have saved?"
AI: "Let me check your saved notes."
[AI calls read_notes_from_file()]
AI: "Here are your saved notes:
- my note
- Grocery list: milk, bread, eggs, apples"文件结构
multi-mcp-servers/
├── local.py # LocalNotes MCP server implementation
├── screenshot.py # ScreenShot MCP server implementation
├── main.py # Basic entry point
├── notes.txt # Local notes storage
├── pyproject.toml # Project configuration
├── uv.lock # Dependency lock file
├── .gitignore # Git ignore patterns
├── .python-version # Python version specification
└── README.md # This file发展
项目结构
local.py:包含使用FastMCP的LocalNotes MCP服务器实现screenshot.py:包含使用FastMCP和PyAutoGUI的ScreenShot MCP服务器实现main.py:基本Python入口点(模板)notes.txt:存储笔记的本地文件pyproject.toml:项目配置和依赖关系
依赖项
该项目取决于:
mcp[cli]>=1.11.0:模型上下文协议实现pyautogui>=0.9.54:屏幕截图功能
扩展服务器
通过使用添加新功能,您可以轻松地向任一服务器添加更多工具 @mcp.tool() 装饰师:
向LocalNotes添加工具:
@mcp.tool()
def clear_notes() -> str:
"""Clears all notes from the file."""
try:
with open("notes.txt", "w", encoding="utf-8") as f:
f.write("")
return "All notes cleared"
except Exception as e:
return f"Error clearing notes: {e}"向ScreenShot添加工具:
@mcp.tool()
def capture_region_screenshot(x: int, y: int, width: int, height: int) -> Image:
"""Captures a specific region of the screen."""
buffer = io.BytesIO()
screenshot = pyautogui.screenshot(region=(x, y, width, height))
screenshot.convert("RGB").save(buffer, format="JPEG", quality=60, optimize=True)
return Image(data=buffer.getvalue(), format="jpeg")创建其他MCP服务器
您可以按照相同的模式创建新的MCP服务器:
- 导入FastMCP
- 创建具有唯一名称的实例
- 使用添加工具
@mcp.tool()装饰器 - 使用以下命令运行服务器
mcp.run()
贡献
- 分叉存储库
- 创建要素分支
- 进行更改
- 测试您的更改
- 提交拉取请求
许可证
\[在此处添加您的许可证信息\]
支持
\[在此处添加支持信息\]
