DevContext
Lets the server pull runtime observability data such as logs and health metrics from Datadog to support incident triage.
Enables using Grafana/Grafana Loki as a source of runtime log and observability data for incident triage.
Allows querying Prometheus for runtime health and observability metrics during incident triage.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
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.
Related MCP server: AgentLens MCP Server
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 optional OpenAI-compatible LLM log extraction
devcontext diagnose --service order-processing --use-llm2. devcontext serve
Starts the stdio MCP server for connection to MCP hosts (e.g. Claude Desktop, Antigravity):
devcontext serveLog 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.
Optional LLM Extraction (
extraction.py): Optionally sends log chunks to an OpenAI-compatible 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.
Benchmark
eval.py scores any diagnosis method against 50 scenarios: 5 handwritten (easy) and 45 generated by a seeded script (benchmark/generate.py). Scoring is strict: the predicted root-cause type must match ground truth, and for bad deploys the blamed commit must match too. There is no pass-by-default branch, and a crash counts as a failure.
python eval.py # all 50, rule-based method
python eval.py --set generated --verbose --json results/rule.jsonGenerated scenarios cover 5 root causes (bad deploy, disk, memory leak, downstream outage, DB connection pool) across variants:
Variant | What it tests |
| One clear signal, sparse logs |
| 300+ lines, benign WARNs right before the incident, decoy health metrics |
| Unrelated deploy 2-8 minutes before a non-deploy incident |
| Bad deploy whose errors only start 25-90 minutes later |
Logs alternate between plain text and JSON-lines.
Results: rule-based diagnose()
Set | Accuracy |
Handwritten (5) | 100% (5/5) |
| 80% (12/15) |
| 40% (6/15) |
| 0% (0/12) |
| 0% (0/3) |
Overall (50) | 46% (23/50) |
What this shows:
Deploy-blaming is too eager: any deploy within 10 minutes of the first flagged line gets blamed, so an unrelated deploy beats clear disk, memory, or outage evidence (0/12).
Benign WARNs break correlation:
first_error_timestampcounts WARN lines, so a harmless warning before a deploy hides a real regression.Keyword rules misfire: a moderately high disk metric (86-89%) trips the disk branch on unrelated incidents.
No DB-pool rule exists: all 9 connection-pool scenarios fail by design (0/9), a coverage gap rather than a bug.
The parser is not the bottleneck: JSON-lines and plain text score the same within each variant.
LLM Agent Methods & Evaluation Protocol
agent.py adds three LLM methods, all scored by the same strict, zero-pass-by-default benchmark harness. The LLM layer is provider-agnostic, using the openai SDK to connect to any OpenAI-compatible endpoint (e.g. self-hosted vLLM on Kaggle/local GPU, or cloud endpoints).
Method | What it is |
| Baseline: last 150 log lines + deploys + health pasted into one prompt, no tools |
| Investigator: tool-calling loop over the same |
| Two-stage Investigator + Verifier pipeline: adds a skeptical verifier pass that checks evidence grounding and can overturn the draft |
The investigator does NOT receive diagnose(), so it cannot echo the rule-based heuristic. During benchmarking (eval.py), tool calls invoke tools.py functions directly rather than going through the MCP stdio JSON-RPC transport.
Environment Variables
The LLM layer requires three environment variables (with a clear error naming any missing variable):
DEVCONTEXT_BASE_URL: Base URL of the OpenAI-compatible endpoint (e.g.http://localhost:8000/v1for vLLM).DEVCONTEXT_API_KEY: API key for the endpoint (usedummyfor local vLLM).DEVCONTEXT_MODEL: Model name (do not assume or hardcode; verify viapython eval.py --list-models).
Optional configuration:
DEVCONTEXT_MIN_INTERVAL: Optional delay in seconds between consecutive API calls to prevent rate limits.DEVCONTEXT_CACHE: Directory for cached responses (defaults to.llm_cache/). Cache keys includebase_url + model + prompt + tools.
Evaluation Protocol
To maintain scientific and empirical rigor:
Tune Prompts Only on Dev: Tune system instructions and few-shot guidance strictly on
--split dev(handwritten scenarios + seed 0).Freeze Prompts: Once finalized, freeze all prompt templates.
Evaluate on Test: Run
--split test(seeds 1 and 2, held out by generator seed while sharing generator templates and failure classes withdev) once per method with--runs 3to verify run-to-run consistency.Fair Comparison: All methods (
llm_raw,agent,agent_verified) must be evaluated against the exact same model and endpoint.Report Complete Metadata: Every reported benchmark table must specify:
Model Name
Provider / Serving Engine (e.g. vLLM on Kaggle T4 GPU)
Evaluation Date
No Hand Edits: Benchmark results must be generated directly by
eval.pywithout manual modification.
# Query available model IDs from the endpoint
python eval.py --list-models
# Run evaluation on test split (3 runs per scenario)
python eval.py --method llm_raw --runs 3 --split test --json results/llm_raw.json
python eval.py --method agent --runs 3 --split test --json results/agent.json
python eval.py --method agent_verified --runs 3 --split test --json results/agent_verified.jsonRunning Rate-Limit-Free on Kaggle GPU with vLLM
To benchmark without API rate limits or commercial token costs, run on a Kaggle GPU (T4 x 2 or P100):
Script:
scripts/kaggle_vllm.shNotebook:
notebooks/kaggle_vllm.ipynb
How It Works:
Model Selection: Uses
Qwen/Qwen2.5-7B-Instruct-AWQon Hugging Face (4-bit AWQ, ~5.3 GB VRAM weights). It fits easily on a 16GB Kaggle GPU with generous KV-cache headroom.vLLM Serving: Starts an OpenAI-compatible server with native Hermes tool calling:
vllm serve Qwen/Qwen2.5-7B-Instruct-AWQ \ --quantization awq \ --enable-auto-tool-choice \ --tool-call-parser hermes \ --port 8000Health Check Polling: Waits for
http://127.0.0.1:8000/healthbefore initiating benchmark runs.Resumable Cache: Restores any previously saved
.llm_cache/from an attached Kaggle dataset (/kaggle/input/**/.llm_cache). If a 9-hour Kaggle GPU session times out, the next run resumes instantly from where it left off.Artifact Export: Copies
.llm_cache/andresults/to/kaggle/workingfor persistence and dataset creation.
Benchmark Results
Model: Qwen/Qwen2.5-7B-Instruct-AWQ (4-bit AWQ)
Serving Engine: vLLM 0.34.0 (--max-model-len 16384 on Kaggle Tesla T4 GPU)
Split & Sample Size: test split (30 scenarios, seeds 1–2; --runs 3 at temperature=0 produced identical predictions across repeats with 0/30 unstable scenarios, so effective n = 30)
Date: December 2026 (2026-12-04)
Method | Test Accuracy ( | 95% Wilson CI | Crashes | Avg Tokens | Latency | Key Characteristics & Failure Modes |
| 40.0% ( | 24.6%–57.7% | 0 | 0 | <0.1s | 46.0% ( |
| 83.3% ( | 66.4%–92.7% | 0 | 4,210 | 4.0s | 6/6 on |
| 90.0% ( | 74.4%–96.5% | 0 | 3,304 | 13.7s | Invokes |
| 93.3% ( | 78.7%–98.2% | 0 | 5,029 | 2.2s* | +1 scenario over |
*Latency reflects cached warm-run investigator calls plus uncached verifier passes; all 30 scenarios ran with 0 crashes under --max-model-len 16384.
Detailed Breakdown by Incident Family & Stress Variant (test Split, n = 30 Scenarios)
Because all 3 greedy (temperature=0) runs per scenario were identical (0/30 unstable scenarios), counts below are reported per unique scenario (n = 30) so repeats are not double-counted as independent samples. rule is shown on the same 30 test scenarios for an apples-to-apples comparison.
====================================================================================================
ACCURACY BREAKDOWN (Test Split: Seeds 1-2, n = 30 Unique Scenarios; 3 Deterministic Runs/Scenario)
====================================================================================================
Incident Family rule (Test Split) llm_raw (16k ctx) agent (Tool Layer) agent_verified (Pipeline)
----------------------------------------------------------------------------------------------------
bad_deploy 33.3% (2/6) 16.7% (1/6) 66.7% (4/6) 66.7% (4/6)
db_pool 0.0% (0/6) 100.0% (6/6) 83.3% (5/6) 100.0% (6/6)
disk 66.7% (4/6) 100.0% (6/6) 100.0% (6/6) 100.0% (6/6)
downstream_dependency 33.3% (2/6) 100.0% (6/6) 100.0% (6/6) 100.0% (6/6)
memory_leak 66.7% (4/6) 100.0% (6/6) 100.0% (6/6) 100.0% (6/6)
----------------------------------------------------------------------------------------------------
Variant
----------------------------------------------------------------------------------------------------
clean 80.0% (8/10) 80.0% (8/10) 100.0% (10/10) 100.0% (10/10)
delayed 0.0% (0/2) 50.0% (1/2) 50.0% (1/2) 50.0% (1/2)
noisy 40.0% (4/10) 80.0% (8/10) 80.0% (8/10) 90.0% (9/10)
red_herring_deploy 0.0% (0/8) 100.0% (8/8) 100.0% (8/8) 100.0% (8/8)
====================================================================================================
OVERALL (n = 30): 40.0% (12/30) 83.3% (25/30) 90.0% (27/30) 93.3% (28/30)
====================================================================================================Core Insights, Weak Spots & Limitations:
Honest Tool-Layer Gain (
agent90.0% vsllm_raw83.3%) & Prompt Size: With--max-model-len 16384,llm_rawhad 0 crashes and solved 24/24 non-deploy scenarios (db_pool,disk,downstream_dependency,memory_leak). The gap betweenllm_raw(83.3%) andagent(90.0%) comes frombad_deploy(1/6 vs 4/6), where callingget_recent_deployslets the investigator inspect older deploys/diffs cleanly, and from keeping noisy prompts compact (3,304 avg tokens vs 4,210 avg and 8,250–8,472 peak tokens forllm_raw).Weak Spot —
bad_deployIs Still at 66.7% (4/6): Bothagentandagent_verifiedmissedbad_deploy__delayed__1andbad_deploy__noisy__1(delayedvariant overall is1/2 = 50.0%). Deployment attribution remains the hardest class.Investigator + Verifier Pipeline (
agent_verifiedvsagent): Inagent,db_pool__noisy__2was misclassified asdisk, andagent_verified's verifier pass overturned that draft todb_pool. Onn = 30, however, a 1-scenario difference (28/30vs27/30, overlapping 95% Wilson CIs of78.7%–98.2%vs74.4%–96.5%) is within noise and does not establish a statistically significant advantage.Scope & Generalization Limits: The
testsplit is held out by generator seed only (seeds 1–2 vs seed 0 + handwritten indev). Both splits share the exact same synthetic generator templates and 5 root-cause classes, and the prompts inagent.pywere written knowing those failure modes. Consequently, these numbers show that the model can use prompt hints and the diagnostic tools on synthetic logs with noise, delays, and red-herring deploys — not that it generalizes to real production incidents.
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) │
└───────┬───────────┘ └───────────────────┘ └───────────────────┘
│
┌───────┴─────────────────────────────────────────┐
│ OpenAI-compatible API (Optional extraction) │
└─────────────────────────────────────────────────┘Quickstart & Setup
1. Installation
git clone https://github.com/sid-stack001/devcontext.git
cd devcontext
pip install -e .2. Diagnose a Service via CLI
devcontext diagnose --service order-processing3. Register as an MCP Server (Claude Desktop)
Add DevContext to your claude_desktop_config.json:
{
"mcpServers": {
"devcontext": {
"command": "devcontext",
"args": [
"serve"
]
}
}
}4. Run Tests and Benchmark
pip install -e .[dev]
pytest
python eval.py5. Environment Configuration
Copy .env.example to .env to configure your OpenAI-compatible endpoint:
cp .env.example .envDependencies & Requirements
Python 3.10+
mcp(Model Context Protocol SDK)openai(Provider-agnostic API client)pytest(Optional, for test execution)
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.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Read-only production context for AI agents: Docker/K8s health, deploys, logs, traffic, code graph
Lets AI agents analyze API metrics, request logs, and traces, and manage apps and alerts.
Query your AI agent traces, root-cause verdicts and issues, and run investigations, from your agent.
Open-source agent that observes and fixes your application. Query logs, traces, metrics, incidents.
Related MCP Servers
- AlicenseAqualityCmaintenanceEnables AI agents to investigate backend incidents by executing runbooks that gather evidence from observability and storage systems.110MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI agents to access observability and evaluation data, including run history, span traces, LLM-as-judge evaluation results, and regression reports.MIT
- AlicenseNot gradedqualityDmaintenanceExposes a live application's runtime state to coding agents, including logs, DB schema, config, and feature flags, with read-only SQL and secret redaction.MIT
- FlicenseAqualityDmaintenanceProvides AI coding agents with real-time visibility into local development runtime state, enabling them to tail application logs, inspect ports, monitor process metrics, and diagnose network errors.1-