Krometrail

Krometrail

Gives AI coding agents eyes into running applications by recording browser activity and providing session investigation tools for debugging.

Category
访问服务器

README

Krometrail

Browser observation and runtime debugging for AI coding agents.

curl -fsSL https://krometrail.dev/install.sh | sh

Krometrail is an MCP server and CLI that gives AI coding agents eyes into running applications. It records browser activity — network requests, console output, DOM mutations, framework state, storage changes, and screenshots — then lets agents search, inspect, and diff that recorded session to diagnose bugs. It also bridges the Debug Adapter Protocol (DAP) for breakpoint-level debugging across 6 languages.

Browser Observation

Record everything happening in a browser session and investigate it later — no code changes required.

What Gets Captured

  • Network — every request/response with headers, bodies, status codes, timing, and WebSocket frames
  • Console — all console output with levels, args, and stack traces
  • DOM mutations — meaningful structural changes (forms, dialogs, sections)
  • User input — clicks, form submissions, field changes
  • Screenshots — periodic and navigation-triggered snapshots
  • Browser storage — localStorage/sessionStorage mutations and cross-tab events
  • Framework state — React and Vue component lifecycles, state/prop diffs, store mutations
  • Framework errors — auto-detected anti-patterns (stale closures, infinite re-renders, missing cleanup)

Quick Start

Add to your agent's MCP config (.mcp.json in your project root):

{
  "mcpServers": {
    "krometrail": {
      "command": "krometrail",
      "args": ["--mcp"]
    }
  }
}

Start recording a browser session:

# MCP: chrome_start({ url: "http://localhost:3000", framework_state: true })
# CLI:
krometrail chrome start http://localhost:3000 --framework-state

# Place markers at significant moments
krometrail chrome mark "submitted form"

# Stop recording
krometrail chrome stop

Investigate what happened:

# List recorded sessions
krometrail session list --has-errors

# Get a structured overview
krometrail session overview <session-id>

# Search for specific events
krometrail session search <session-id> --event-types network_response --status-codes 500
krometrail session search <session-id> --framework react --pattern stale_closure

# Deep-dive into a specific event
krometrail session inspect <session-id> --event-id <id>

# Compare two moments (what changed between page load and error?)
krometrail session diff <session-id> --from <timestamp> --to <timestamp>

# Generate reproduction steps or test scaffolds
krometrail session replay-context <session-id> --format playwright

Browser MCP Tools

Tool Description
chrome_start Launch Chrome and start recording (URL, framework observation, tab filtering)
chrome_status Current recording status, event counts, active tabs
chrome_mark Place a named marker in the recording timeline
chrome_stop Stop recording and persist events to database
session_list List recorded sessions with filters (time, URL, errors, markers)
session_overview Structured overview: navigation, markers, errors, network, framework summary
session_search Full-text and structured search across recorded events
session_inspect Deep-dive into a specific event with full context and nearest screenshot
session_diff Compare two moments: URL, storage, console, network, framework state changes
session_replay_context Generate reproduction steps or Playwright/Cypress test scaffolds

Framework State Observation

When enabled, Krometrail hooks into React DevTools and Vue Devtools to track:

  • Component mount/update/unmount lifecycles
  • State and prop changes with before/after diffs
  • Render counts and trigger source identification
  • Pinia/Vuex store mutations (Vue)
  • Auto-detected bug patterns: stale closures, infinite re-renders, missing effect cleanup, excessive context re-renders
{ "url": "http://localhost:3000", "framework_state": true }
{ "url": "http://localhost:3000", "framework_state": ["react"] }
{ "url": "http://localhost:3000", "framework_state": ["react", "vue"] }

Runtime Debugging

Set breakpoints, step through code, and inspect variables across 6 languages via DAP.

Supported Languages

Language Debugger Adapter Status
Python debugpy TCP Stable
Node.js js-debug TCP Stable
Go Delve TCP Stable
Rust CodeLLDB TCP Stable
Java java-debug-adapter TCP Stable
C/C++ GDB 14+ / lldb-dap stdio Stable

Debug CLI

krometrail launch "python app.py" --break order.py:147
krometrail step over
krometrail eval "discount"
krometrail vars --scope local
krometrail continue
krometrail stop

Debug MCP Tools

Tool Description
debug_launch Launch a program with initial breakpoints
debug_attach Attach to a running process
debug_stop Terminate the debug session
debug_status Query session state and capabilities
debug_continue Resume execution until next breakpoint
debug_step Step over, into, or out
debug_run_to Run to a specific line
debug_set_breakpoints Set breakpoints with conditions, hit counts, logpoints
debug_set_exception_breakpoints Filter by exception type
debug_list_breakpoints List all active breakpoints
debug_evaluate Evaluate an expression in the current frame
debug_variables Inspect variables by scope with regex filtering
debug_stack_trace Get the full call stack
debug_source Read source code around a location
debug_watch Add/remove persistent watch expressions
debug_action_log Review the investigation log
debug_output Capture stdout/stderr
debug_threads List threads, goroutines, etc.

Features

  • Passive browser recording — capture network, console, DOM, storage, and screenshots without code changes
  • Framework-aware — React and Vue state tracking with bug pattern detection
  • Session investigation — search, inspect, diff, and replay recorded browser sessions
  • Compact viewport — debugger state rendered in ~400 tokens per stop, optimized for LLM context windows
  • Conditional breakpoints — order.py:147 when discount < 0, hit counts, logpoints
  • Watch expressions — persistent expressions auto-evaluated on every stop
  • Framework detection — auto-detects pytest, Django, Flask, jest, mocha, go test
  • Multi-threaded — thread/goroutine listing and selection
  • Shell completions — tab-completion for bash, zsh, and fish via krometrail completions

Skill File

Install the agent skill for CLI-based workflows. Install via skilltap or print to stdout:

skilltap install ./skill  # Install via skilltap
krometrail skill            # Or print skill to stdout

Development

bun install              # Install dependencies
bun run dev              # Run CLI in dev mode
bun run mcp              # Run MCP server
bun run build            # Compile single binary
bun run build:all        # Build for all platforms (Linux, macOS, Windows)

Testing

bun run test             # All tests
bun run test:unit        # Unit tests (no external deps)
bun run test:integration # Integration tests (needs debuggers)
bun run test:e2e         # E2E tests (full MCP path)
bun run test:agent       # Agent harness scenarios

Integration and E2E tests require debuggers to be installed. Run krometrail doctor to check availability. Tests skip cleanly per-adapter when a debugger is not found.

Agent Harness

The agent harness (tests/agent-harness/) is a scenario-based test suite for evaluating how well agents debug with Krometrail. It contains 35 scenarios across 3 languages at 5 difficulty levels:

  • Python — 12 scenarios (closure bugs, mutation errors, float accumulation, deep pipelines)
  • Node.js — 11 scenarios (async races, event loop ordering, regex state, this binding)
  • TypeScript — 12 scenarios (type assertion escapes, generic constraints, runtime registries)
bun run test:agent          # Run scenarios
bun run test:agent:report   # Generate report with token/cost metrics

Linting

bun run lint             # Check with Biome
bun run lint:fix         # Auto-fix

Architecture

src/
  mcp/          MCP server + tool handlers
  cli/          CLI entry point + commands (citty)
  core/         Session manager, viewport renderer, DAP client, compression
  adapters/     Language-specific debugger adapters (6 languages)
  browser/      Chrome CDP recording, investigation engine, framework observers
  daemon/       Session persistence over Unix socket
  frameworks/   Auto-detection for test/web frameworks

The MCP server and CLI share the same core. Browser tools use CDP to record events into a SQLite-backed session store with JSONL event storage. Debug tools use the session manager to orchestrate DAP communication. The viewport renderer formats state for agents, and adapters handle language-specific debugger setup.

Documentation

Document Contents
VISION.md Problem statement, prior art, roadmap
ARCH.md System layers, data flow, viewport rendering
UX.md Viewport abstraction, agent interaction patterns
SPEC.md Adapter contract, type definitions
INTERFACE.md MCP tool + CLI command reference
TESTING.md Testing philosophy and tiers

License

MIT

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选