DevContext
Enables coding agents to access live runtime observability data such as logs, deploys, and health metrics for evidence-based incident triage.
README
DevContext
DevContext is a prototype Model Context Protocol (MCP) server and CLI tool that provides AI coding assistants and engineers with runtime observability data (logs, deploys, and health metrics) to assist in incident triage.
Overview
Coding assistants can inspect source repositories and draft fixes, but they often lack visibility into what happens during runtime incidents (such as recent deployments, error rate spikes, disk saturation, or downstream API outages). DevContext is a proof-of-concept tool that exposes runtime context via a command-line interface (CLI) and standard MCP tool calls.
CLI & Tool Commands
DevContext can be run directly from the command line or registered as an MCP server.
1. devcontext diagnose
Runs automated incident triage against built-in datasets or custom files/folders:
# Diagnose built-in service dataset
devcontext diagnose --service order-processing
# Output raw JSON format
devcontext diagnose --service order-processing --json
# Point at custom log, deploy, and health paths (files or log directories)
devcontext diagnose --log-path /var/log/app/ --deploys-path deploys.json --health-path health.json
# Enable experimental Groq LLM extraction
devcontext diagnose --service order-processing --use-llm
2. devcontext serve
Starts the stdio MCP server for connection to MCP hosts (e.g. Claude Desktop, Antigravity):
devcontext serve
<img width="1920" height="1080" alt="demo_devcontext" src="https://github.com/user-attachments/assets/aaad8db0-bfff-4301-ac6d-c825fbe08aa6" />
Log Parsing Options
- Deterministic Parser (
parser.py): Uses heuristics to sample log lines and attempt structure matching (JSON-lines, CSV, key-value pairs, or basic bracketed/space-delimited timestamps).- Limitation: Best suited for simple single-line logs. Complex multi-line stack traces or non-standard custom formats may fall back to basic line matching.
- Experimental LLM Extraction (
extraction.py): Optionally sends log chunks to Groq's API (response_format={"type": "json_object"}) to extract structured event objects.- Limitation: Incurs API latency (~200–400ms) and token costs; falls back to the deterministic parser if the API key is missing or calls time out.
Data Source Options
- Built-in Mock Data: Pass a service name (e.g.
service_name="order-processing") to query the included demo data. - Custom File or Directory Paths:
log_path: Path to a single log file or a directory containing split.log/.txtfiles.deploys_path: Path to a customdeploys.jsonfile.health_path: Path to a customhealth.jsonfile.
Evaluation & Test Scenarios
The repository includes an evaluation harness (eval.py) tested against 5 synthetic test scenarios:
| Scenario | Service | Scenario Type | Expected Outcome | Result |
|---|---|---|---|---|
scenario_1_bad_deploy |
payment-service |
Resource Limit Reduction | Identify deploy f8a1c92 |
Pass |
scenario_2_disk_full |
storage-service |
Disk Full (No recent deploy) | Identify disk exhaustion (98%) | Pass |
scenario_3_memory_leak |
analytics-worker |
Memory Leak / OOM | Identify memory saturation (97%) | Pass |
scenario_4_downstream_outage |
notification-service |
External API Outage | Identify SendGrid 503 errors | Pass |
scenario_5_bad_migration |
user-service |
Failed Database Migration | Identify deploy d4e912f |
Pass |
Limitations & Scope
- Small Test Suite: This evaluation suite contains 5 synthetic test cases created for validation. It is not an exhaustive production benchmark.
- Heuristic Matching:
diagnose()uses simple rules (e.g. checking if a deploy occurred within 10 minutes of the first error). Real-world infrastructure incidents are often more complex and may involve multiple interacting factors.
Architecture
┌─────────────────────────────────────────────────────────┐
│ CLI / MCP Clients │
│ (devcontext CLI / Claude Desktop / Antigravity) │
└───────────────────────────┬─────────────────────────────┘
│ CLI Args / stdio JSON-RPC
┌───────────────────────────▼─────────────────────────────┐
│ DevContext Entry Point │
│ (cli.py / server.py) │
└───────────────────────────┬─────────────────────────────┘
│
┌───────────────────────────▼─────────────────────────────┐
│ Diagnostic Core (tools.py) │
└───────┬───────────────────┬─────────────────────┬───────┘
│ │ │
┌───────▼───────────┐ ┌─────▼─────────────┐ ┌─────▼─────────────┐
│ Structure Parser │ │ Deployment Engine │ │ Health Observer │
│ (parser.py) │ │ (deploys.json) │ │ (health.json) │
└───────┬───────────┘ └───────────────────┘ └───────────────────┘
│
┌───────┴─────────────────────────────────────────┐
│ Groq API (Optional LLM log extraction) │
└─────────────────────────────────────────────────┘
Quickstart & Setup
1. Installation
git clone https://github.com/your-username/devcontext.git
cd devcontext
pip install -e .
2. Diagnose a Service via CLI
devcontext diagnose --service order-processing
3. Register as an MCP Server (Claude Desktop)
Add DevContext to your claude_desktop_config.json:
{
"mcpServers": {
"devcontext": {
"command": "devcontext",
"args": [
"serve"
]
}
}
}
4. Run Evaluation Suite
python eval.py
5. Optional API Key Setup
Copy .env.example to .env if using Groq for experimental LLM log extraction:
cp .env.example .env
Dependencies & Requirements
- Python 3.10+
mcp(Model Context Protocol SDK)groq(Optional, for LLM extraction)
Future Extensions
- Pluggable Adapters: Connect directly to CloudWatch, Datadog, Grafana Loki, or Prometheus APIs.
- Probabilistic Confidence Scores: Output root-cause probability distributions (e.g.
95% confidence: bad deploy) instead of single deterministic strings. - Automated Rollback Proposals: Generate validated git revert commits or Kubernetes patch specs alongside the diagnosis.
License
Distributed under the MIT License.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。