使用说明
MCP服务器实验
这是一个演示库,展示了使用Python的模块化客户端-服务器计算设置。它模拟了基本的计算器功能,并与轻量级SQLite后端集成,以跟踪操作或模拟有状态处理。
🚀 特性
- 用于客户端-服务器交互的模块化Python组件
- 基于SQLite的服务器逻辑(
sqlite_server.py) - 带客户端的算术计算器模块(
calculator.py,calculator_client.py) - 用于本地测试的简单界面(
main.py) - 示例数据库(
community.db)用于演示 - 使用Python构建并通过配置
pyproject.toml
📁 项目结构
mcp\_demo/
├── calculator.py # Core arithmetic operations
├── calculator\_client.py # Client code to interact with calculator
├── sqlite\_server.py # Lightweight SQLite server module
├── main.py # Entry point for running the demo
├── community.db # Prebuilt SQLite DB for demo use
├── greetings.txt # Sample data file
├── pyproject.toml # Python project configuration
├── .gitignore
└── .python-version
🛠️ 安装
-
克隆存储库:
git clone https://github.com/codemaker2015/mcp-server-experiments.git cd mcp-server-experiments -
安装uv
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex" set Path=C:\Users\Codem\.local\bin;%Path% -
创建虚拟环境。
uv venv source .venv/bin/activate # for linux .venv\Scripts\activate # for windows -
安装依赖项(如果在中指定
pyproject.toml或需求文件):uv add -r requirements.txt
🧪 用法
-
将MCP服务器安装到Claude Desktop:
mcp install calculator.py mcp install sqlite_server.py -
使用MCP Inspector直接测试客户端-服务器模拟:
mcp dev sqlite_server.py mcp dev calculator_client.py
📦 德莫斯
- MCP第一服务器
- MCP SQLite服务器
- MCP股价服务器
- MCP股票分析服务器
- MCP客户端
