使用说明
传感器数据库MCP服务器演示
最低限度 模型上下文协议(MCP)服务器 它公开了一个合成传感器读数SQLite数据库和一个小型图表生成助手。
使用它来展示LLM(例如Claude)如何 发现 模式, 怎么翻译 数据,以及 创建绘图 根据需求。
里面是什么
| 组件 | 目的 |
|---|---|
data/sensor.db |
SQLite数据库有两个表: • 传感器 (id、位置、类型) • 传感器读取 (sensor_id、时间戳、值) |
mcp_server.py |
FastMCP服务器提供四种工具: • list_tables()• describe_table(table_name)• query(sql) (只读)• create_chart(...) (matplotlib) |
快速启动
- 安装依赖项(建议使用Python 3.11+)
uv pip install fastmcp==2.8.1 matplotlib==3.10.3 pandas==2.3.0
与Claude Desktop一起使用
添加到您的mcp.json(或等效文件)中:
"sensor_db_server": {
"command": "uv",
"args": [
"--directory",
"C:\\path\\to\\sensor-db-mcp-server-demo",
"run",
"mcp_server.py"
]
}
示例提示
How many sensors do we currently have?
What's the average temperature in the south zone?
Visualize the relationship between temperature and humidity in the north.