connected-car-mcp

connected-car-mcp

Provides telemetry, rule-based anomaly detection, and maintenance recommendations for a synthetic connected-vehicle fleet through five narrow MCP tools, enabling fleet monitoring and analysis without external APIs.

Category
访问服务器

README

connected-car-mcp

An MCP (Model Context Protocol) server over a synthetic connected-vehicle fleet: telemetry, rule-based anomaly detection, and maintenance recommendations, exposed as five narrow tools instead of one open-ended query interface.

Built as a small, self-contained illustration of a specific design habit: deciding what belongs behind a tool boundary, and logging every call across it. Runs entirely on synthetic data generated locally — no external API, no account, no proprietary source.

Why it's shaped this way

The whole dataset could be exposed through a single run_query(sql: str) tool. That's the wrong shape for an agent to call reliably: it pushes schema-learning onto the model at call time, and there's no way to scope or audit "what can be asked" per capability. Instead:

Tool Contract
list_vehicles Enumerate the fleet
get_vehicle_telemetry Raw readings for one vehicle, time-bounded
fleet_health_summary Latest snapshot + fleet averages
detect_anomalies Rule-based flags: overheating, low battery, fault codes, harsh driving
get_maintenance_recommendations Prioritized actions for one vehicle

A model composes these — summary → pick a flagged vehicle → pull its telemetry → get a recommendation — rather than writing free-form queries against raw rows. It also makes the audit story trivial: there are only five well-defined calls to log, so audit_log.jsonl (see connected_car_mcp/audit.py) is one line per call — timestamp, tool, arguments, duration, success/failure — with no custom logic per tool. A production deployment would emit the same record as structured logs via MCPServer's middleware hook (which sees every JSON-RPC call, tool or resource) rather than a local file; the decorator here keeps the demo runnable with zero extra infrastructure.

Anomaly thresholds are simple and explainable (engine_temp_c >= 110, not a trained model) on purpose — a fleet monitor's flags need to be auditable by a human, not just accurate.

Data

data/generate_telemetry.py generates a deterministic (fixed-seed), fully synthetic dataset: 12 vehicles, readings every 10 minutes over 3 days. A few vehicles are seeded with faults so the anomaly detector has real signal to find:

  • CCV-004 — engine temperature ramps into critical range (cooling system failure)
  • CCV-009 — battery voltage degrades over time (failing battery/alternator)
  • CCV-002, CCV-011 — intermittent DTC fault codes
  • CCV-006 — occasional harsh-driving speed spikes

data/telemetry.csv is committed so the repo runs immediately; regenerate it with:

python data/generate_telemetry.py

Running it

python -m venv .venv
.venv/Scripts/activate        # .venv/bin/activate on macOS/Linux
pip install -r requirements.txt

python -m connected_car_mcp.server   # starts the MCP server over stdio

To try it from Claude Desktop or another MCP client, point it at the module with cwd set to the repo root, e.g. in claude_desktop_config.json:

{
  "mcpServers": {
    "connected-car-fleet": {
      "command": "python",
      "args": ["-m", "connected_car_mcp.server"],
      "cwd": "/path/to/connected-car-mcp"
    }
  }
}

Then ask something like "Which vehicles in the fleet need attention right now, and why?" — the model will call fleet_health_summary, follow up with detect_anomalies on the flagged vehicles, and can call get_maintenance_recommendations to turn that into next actions.

Tests

pip install pytest
pytest tests/

Covers the data layer directly (fleet size, unknown-vehicle handling, and that the seeded faults actually get flagged) rather than round-tripping through the MCP protocol layer.

Project layout

connected_car_mcp/
  server.py       MCP tool + resource definitions
  data_store.py   Query layer over the telemetry CSV (pandas)
  audit.py        Per-call audit log decorator
data/
  generate_telemetry.py   Synthetic dataset generator
  telemetry.csv            Generated dataset (committed)
tests/
  test_data_store.py

License

MIT — see LICENSE.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选