my-mcp
MCP-Server
MCP-Server 是一个围绕 FastMCP 服务器构建的小型 Python 工作区。主包位于 my-mcp/ 中,并公开了一个名为 DataTools 的服务器,它结合了来自 SQLite 的本地天气数据和来自 CoinGecko 的实时加密货币工具。
包含内容
用于查询天气读数和计算本地数据库平均值的 MCP 工具
用于从 CoinGecko 获取加密货币价格和热门币种的 MCP 工具
一个位于
weather://latest的动态 MCP 资源用于客户端 LLM 工作流的天气摘要提示词
带有 SQLAlchemy 模型和 Alembic 迁移的 SQLite 持久化
用于在容器中运行服务器的 Docker 支持
Related MCP server: Weather Service MCP Server
仓库布局
.
├── Dockerfile
├── pyproject.toml
├── uv.lock
└── my-mcp/
├── alembic.ini
├── migrations/
├── data/
├── pyproject.toml
├── README.md
└── src/my_mcp/
├── server.py
└── db/要求
Python 3.14
设置
从工作区根目录安装依赖项:
uv sync服务器在可用时使用来自 .env 的环境变量。最重要的环境变量包括:
HOST- MCP 服务器的绑定地址,例如0.0.0.0PORT- SSE 端口,例如8080DB_PATH- SQLite 数据库的路径,默认为data/app.db
数据库
数据库架构由 Alembic 管理并存储在 SQLite 中。
从包目录运行迁移:
cd my-mcp
uv run alembic upgrade head如果您需要示例数据,可以使用以下命令填充数据库:
cd my-mcp
uv run python -m my_mcp.db.seed本地运行
从仓库根目录启动服务器:
uv run --package my-mcp my-mcp默认情况下,服务器通过 SSE 运行,并监听由 HOST 和 PORT 定义的主机和端口。
Docker
构建镜像:
docker build -t mcp-server .运行它:
docker run --rm -p 8080:8080 -e HOST=0.0.0.0 -e PORT=8080 -e DB_PATH=data/app.db mcp-serverMCP 工具和资源
工具
readings_for_city(city, hours=6)- 返回某个城市最近的天气读数average_temp(city, hours=6)- 返回某个城市的天气平均温度get_crypto_price(coin_id="bitcoin")- 返回某种加密货币的价格、市值和 24 小时涨跌幅get_top_coins(limit=5)- 返回按市值排名的热门加密货币
资源
weather://latest- 返回数据库中最新的天气读数
提示词
weather_summary(city, hours=6)- 为客户端或 LLM 准备简洁的天气摘要提示词
客户端配置
对于基于 SSE 的客户端,请将其指向正在运行的服务器 URL,例如:
http://localhost:8080/sse对于 Claude Desktop 或类似工具,请使用基于命令的配置,从该仓库启动 uv run --package my-mcp my-mcp。
注意事项
加密货币工具会调用公共 CoinGecko API,因此需要互联网访问权限。
如果数据库文件不存在,它会自动创建。
Alembic 已配置为在
my-mcp/alembic.ini中使用sqlite:///./data/app.db。
This server cannot be deployed
Maintenance
Related MCP Connectors
Google Keep-style notes app with an MCP server for AI agents to read/write notes.
- TaprootOAuthcom.taproothq
Persistent memory layer for AI tools. Save and recall notes across Claude and other MCP clients.
Markdown-based note-taking with a hosted MCP server. Your notes serve you and your AI.
MCP-native notes and memory for ChatGPT, Claude, and other AI tools.
Related MCP Servers
- AlicenseBqualityDmaintenanceAn MCP server for managing and persisting notes, offering CRUD operations, note summarization, and resource-based access via a note:// URI scheme.47MIT
- FlicenseNot gradedqualityDmaintenanceA simple note-taking MCP server that allows storing and summarizing notes with custom URI schemes and provides functionality to add notes and generate summaries with different detail levels.5-
- FlicenseNot gradedqualityDmaintenanceA Claude-compatible MCP server that enables storing and summarizing notes through a simple note storage system with custom URI scheme.5-
- -licenseNot gradedqualityNot gradedmaintenanceA simple notes system that allows creating, storing, and accessing text notes through MCP resources and tools, with built-in prompt support for generating summaries of stored notes.-