Detrix 标志

Detrix

社区
flashus

Observe any line of running code — no restarts, no code changes, production-safe

发布者flashus
代码仓库detrix
语言Rust
复刻数
5
星标数
23
可用工具
0
传输类型stdio
分类
许可协议MIT
链接
  • 将工具接入 AI 工作流

    Detrix 提供 MCP 功能,可供兼容的 AI 客户端和智能体使用。

  • 0 个可用工具

    浏览下方可调用的操作;如果服务器提供了名称和描述,也会一并显示。

  • 可直接复制的配置

    使用安装配置片段,在您首选的 MCP 客户端中配置此服务器。

  • 开源社区热度

    关联的代码仓库有 23 个 Star 和 5 个 Fork。

Detrix

Give your AI agent eyes inside any running program.

  • Watch any variable at any line — agent sets an observation point in seconds, zero code changes during debugging
  • Local or cloud — same workflow for Docker containers and remote hosts
  • Python, Go, Rust — observation points capture values without pausing, without restarting
  • Built for agents — observe, query, manage observations via natural language; Claude Code, Cursor, Windsurf

Tests CI Rust Docker crates.io PyPI Go License


See It in Action

1-minute demo: A Go service in Docker starts reporting wrong numbers. Nothing in the client code changed. Claude watches it live and finds the cause.

Here's what the session looks like:

You:    "The order-service in Docker is reporting wildly inflated revenue.
         Daily total is in the thousands when transactions should be $20-200."

Agent:  → reads the source, spots dead unit-conversion code
        → wakes the service via Detrix
        → observes txn.Amount, txn.Unit, total
          (no line number — find_variable locates it in the running container)

        "Found it. The pricing API changed what it's returning.

        txn.Amount = 8957, txn.Unit = "cents" → should be $89.57, summed as $8957

        In calculateRevenue, the unit field is fetched and discarded:

        unit := txn.Unit
        _ = unit          // ← conversion was intended, never implemented
        total += amount   // ← adds cents as if they were dollars

        This didn't matter before. It matters now."

        → fixed the client code
        → reported the API contract change upstream

No code was modified to instrument. No restarts. The old workflow — add a log line, rebuild, redeploy, wait for the bug to reproduce — replaced by watching it live.

You don't need to know the line number either — describe the behavior and the agent finds where to look.


Why Detrix?

You hit a bug. The old workflow: add a print, restart, reproduce, remove the print, repeat. If it's in production, redeploy. If it's in a Docker container, get into the container. If it's intermittent, wait.

With Detrix, you just ask the agent. It finds the right line, plants an observation point, and tells you what it sees — live, nothing restarting.

That bug that cost you hours last week — redeploy after redeploy, still can't reproduce — your agent can investigate it in minutes, while your app keeps running.

print() / loggingDetrix
Iteration speedHours (edit → rebuild → deploy)Minutes
Add new observationEdit code → restartAsk the agent — no code, no restart¹
Production-safeOutput pollution, perf riskNon-breaking observation points
EventsEphemeral streamStored, queryable by metric and time
Capture controlEvery hit, no filteringThrottle, sample, first-hit, interval
CleanupManual (easy to forget, ships to prod)One command — or automatic expiry
Sensitive dataSecrets can leak via log outputSensitive-named vars blocked by default; configurable blacklist + whitelist in detrix.toml

¹ Embed detrix.init() once for zero restarts forever. Or restart once to attach the debugger (--debugpy, dlv, lldb-dap) — from that point on, the agent adds and removes observations without any further restarts.


Quick Start

Try it in 2 minutes. Your agent handles everything after step 3.

1. Install Detrix

macOS (Homebrew):

bash
brew install flashus/tap/detrix

macOS / Linux (shell script):

bash
curl --proto '=https' --tlsv1.2 -LsSf \
  https://github.com/flashus/detrix/releases/latest/download/detrix-installer.sh | sh

Windows (PowerShell):

powershell
irm https://github.com/flashus/detrix/releases/latest/download/detrix-installer.ps1 | iex

Docker (linux/amd64, linux/arm64):

bash
docker pull ghcr.io/flashus/detrix:latest

Build from source:

bash
cargo install --git https://github.com/flashus/detrix detrix

Then initialise (creates config and sets up local storage):

bash
detrix init

2. Add to your app

One line — the debugger sleeps until your agent needs it, zero overhead when idle:

python
import detrix
detrix.init(name="my-app")

Go and Rust work the same way — see App Integration.

3. Connect your agent

Claude Code:

bash
claude mcp add --scope user detrix -- detrix mcp

Cursor / Windsurf — add to .mcp.json in your project root:

json
{
  "mcpServers": {
    "detrix": {
      "command": "detrix",
      "args": ["mcp"]
    }
  }
}

For cloud setup and other editors, see the setup guide.

That's it. Ask your agent to observe any line in your running app — no restarts, nothing ships to prod.


Alternative: connect without embedding

Don't want to add a dependency? Start your app directly under a debugger instead:

bash
# Python
python -m debugpy --listen 127.0.0.1:5678 app.py

# Go
dlv debug --headless --listen=127.0.0.1:5678 --api-version=2 main.go

# Rust
lldb-dap --port 5678

Listens on 127.0.0.1 — local only. See the language setup guide for remote and Docker.


How It Works

Detrix is a daemon that runs locally or in the cloud and connects your AI agent to any running process via 29 MCP tools. Under the hood, it talks to your app's debugger via the Debug Adapter Protocol (DAP). It sets logpoints — breakpoints that evaluate an expression and log the result instead of pausing. Your application runs at full speed; Detrix captures the values.

  AI Agent                 Detrix Daemon              Debugger (DAP)         Your App
  (Claude Code, Cursor,    (local or Docker/cloud)    debugpy / dlv /        (Python/Go/Rust,
    Windsurf, local)                                  lldb-dap               local/cloud)
      │                         │                          │                      │
      │── "observe line 127" ──▶│                          │                      │
      │                         │── set logpoint ─────────▶│                      │
      │                         │                          │── captures value ───▶│
      │                         │◀────────────── captured values ─────────────────│
      │◀── structured events ───│                          │                      │
      │                         │                          │                      │
      │         App never pauses. No code changes. No restarts.                   │

The daemon runs locally or alongside your service in Docker — same protocol either way. In cloud mode, source files are fetched automatically so the agent can find the right lines without them on your machine. See the Installation Guide for cloud setup.


App Integration

python
import detrix
detrix.init(name="my-app")   # That's it. Agent controls the rest.
LanguageInstallDocs
Pythonpip install detrix-pyPython Client
Gogo get github.com/flashus/detrix/clients/goGo Client
Rustdetrix-rs = "1.2.0" in Cargo.tomlRust Client

Production pattern: Build one service instance with debug symbols and a Detrix client. Route suspect traffic to it via Kafka, a sidecar, or your load balancer. The rest of your fleet runs unaffected — full-speed, no instrumentation overhead. You get deep observability on one instance without touching production.

See the Clients Manual for full documentation.


Build Configuration for Observability

Detrix uses debugger logpoints to observe variables. For expressions to evaluate successfully, the binary needs debug symbols (DWARF info). The good news: you don't need a debug build. Each language has a production-friendly strategy that preserves most variable visibility with minimal performance impact.

Go

Go's default go build already produces an optimized binary with DWARF debug symbols. Delve attaches to it and evaluates logpoint expressions on most variables — especially heap-allocated struct fields. No special flags needed.

bash
# This is already debuggable. Nothing to change.
go build -o myservice ./cmd/myservice

If the optimizer hides a specific local variable (<optimized out>), use per-package debug flags to disable optimizations only where you need visibility:

bash
# Disable optimizations in the payments package only.
# net/http, encoding/json, and all other packages stay fully optimized.
go build -gcflags="myservice/internal/payments=-N -l" -o myservice ./cmd/myservice
BuildPerformanceVariable visibility
go build (default)Full speedHigh — struct fields, most locals
go build -gcflags="pkg=-N -l"One package slower~100% in that package
go build -gcflags="all=-N -l"All packages slower100% everywhere (dev only)

Stripping symbols (-ldflags="-s -w") removes DWARF info and makes debugging impossible. If you strip for production, keep one instance with symbols for Detrix.

Rust

Rust debug builds (cargo build) are 10-100x slower than release — unusable in production. Instead, use a custom Cargo profile that compiles your dependencies at full optimization (O3) and your code at a lower level (O1) that preserves most variable visibility:

toml
# Cargo.toml — add a "detrix" profile for observable production builds

[profile.detrix]
inherits = "release"
opt-level = 1              # Your code: light optimization, most variables visible
debug = 2                  # Full DWARF debug info
codegen-units = 16         # Default parallelism

[profile.detrix.package."*"]
opt-level = 3              # All dependencies: full optimization
debug = false              # No debug info needed for deps (smaller binary)
bash
cargo build --profile detrix
ProfileYour codeDependenciesPerformance vs releaseVariable visibility
releaseO3, no debugO3, no debugBaselineCannot observe
release + debug = 2O3, DWARFO3, no debug~0-2% overheadLow — many locals optimized out
detrix (recommended)O1, DWARFO3, no debug~5-15% overheadHigh — most variables visible
dev (debug)O0, DWARFO0, DWARF10-100x slower100% (dev only)

Generics caveat: Generic code from dependencies (serde, tokio, axum) is monomorphized in your crate and compiles at your opt-level (O1), not the dependency's (O3). For most services this is negligible since I/O dominates, but serialization-heavy hot paths may see a larger impact.

For functions you want to keep fully visible regardless of optimization:

rust
#[inline(never)]  // Prevents inlining — always visible as a separate stack frame
fn process_order(order: &Order) -> Result<ProcessedOrder> {
    // Detrix can always set logpoints here
}

Python

No special build configuration needed. CPython is always debuggable — debugpy attaches to the running interpreter as-is.

python
import detrix
detrix.init(name="my-app")  # Works on any Python 3.10+ installation

See the Clients Manual for full documentation.


Features

No code changes. The agent instruments your running code via observation points — nothing gets committed, nothing ships to prod.

No pausing. Observation points evaluate expressions at full execution speed, with no breakpoint-style halting. For high-frequency code paths, use sample or throttle modes to control event volume.

No forgotten cleanup. Metrics expire automatically via TTL, or remove everything with one command.

Agent tools29 MCP tools — observe any line, query events, enable/disable observation groups, and clean up; no line number needed
Zero-downtime instrumentationAdd metrics without restarting your app
Multi-variable captureCapture multiple variables per observation point
Capture modesStream, sample, throttle, first-hit, periodic sampling (every N sec)
Runtime introspectionStack traces, memory snapshots, variable inspection, expression evaluation
Multi-languagePython (debugpy), Go (delve), Rust (lldb-dap)
Cloud debuggingObserve Docker containers and remote hosts — no VPN, no port forwarding
Durable storageEvents stored in SQLite on the daemon host. Run Detrix on a remote server, connect your agent in the morning and ask what happened overnight. Daemon auto-reconnects to the debug adapter if it restarts.
ExtensibleNew frontends via open API; new language support by implementing a language adapter — Adding Languages
Safety validationSensitive variable names (password, api_key, token, secret, private_key, etc.) blocked before capture. Configurable blacklist + whitelist for variable names and functions in detrix.toml. Enable safe mode per connection to allow only variable watching — no expression execution, no stack traces, no memory snapshots. Blocked operations return a clear named error so the agent can explain the constraint.
AuthMulti-tenant access control: per-user static tokens or JWT/JWKS, role-based authorization (Admin/User), per-agent metric isolation — Auth Guide
Event streamingForward captured events to Graylog
4 API protocolsMCP (stdio), gRPC, REST, WebSocket

Documentation

Installation GuideInstall, language setup, agent config, cloud debugging
Standalone Agent ModeCentralized Linux/Go/eBPF observation with authenticated agents
AuthenticationAuth modes, per-user tokens, JWT/JWKS, access control
CLI ReferenceCommand-line interface
Clients ManualPython, Go, Rust client libraries
ArchitectureClean Architecture with 13 Rust crates
Adding LanguagesExtend Detrix to new languages

Contributing

bash
cargo fmt --all && cargo clippy --all -- -D warnings && cargo test --all
  1. Fork the repository
  2. Create a feature branch
  3. Run the checks above
  4. Submit a Pull Request

License

MIT License — see LICENSE.

Found a bug? Open an issue. Found in minutes what took you days? Tell us in Discussions.

将 Detrix MCP 与多个 AI 模型配合使用

TypingMind 在工作区级别连接 MCP 工具,因此连接 Detrix 后,您就可以在 TypingMind 中搭配不同的 AI 模型使用,无需为每个模型单独设置。 此 MCP 通过您设备上的 TypingMind MCP 连接器在本地运行。

本地连接器设置指南

如果 MCP 服务器需要访问您电脑上的本地文件、应用或私有资源,请选择此方式。

1

打开 MCP 设置

在 TypingMind 中,依次前往“设置”、“高级设置”和“模型上下文协议”,然后选择“设置连接器”。

  1. 在您的浏览器中打开 TypingMind。
  2. 点击“设置”图标。
  3. 进入“高级设置”。
  4. 打开“模型上下文协议”部分。
  5. 点击“设置连接器”,然后选择“此设备”。
TypingMind MCP 连接器设置界面,已选择“此设备”
2

运行连接器命令

选择“此设备”,从 TypingMind 复制命令并在终端中运行。使用 MCP 时,请保持该进程运行。

  1. 复制 TypingMind 显示的设置命令。
  2. 在 macOS 上打开“终端”,或在 Windows 上打开 Windows Terminal。
  3. 粘贴并运行命令。
  4. 如果终端询问您是否继续,请确认安装软件包。
  5. 使用 MCP 工具时,请保持终端窗口及其中的进程运行。
3

将 Detrix 添加为服务器

当连接器状态为“就绪”时,点击“编辑服务器”,然后粘贴 MCP 服务器配置。

  1. 等待连接器状态显示为“就绪”。
  2. 点击“编辑服务器”。
  3. 粘贴 Detrix MCP 服务器配置。
  4. 保存服务器列表。
  5. 如需确认连接器是否仍处于就绪状态,请刷新。
TypingMind MCP 设置界面,显示正在运行的服务器和“编辑服务器”按钮
{
  "mcpServers": {
    "detrix": {
      "command": "npx",
      "args": [
        "-y",
        "<mcp-server-package>"
      ]
    }
  }
}
4

在不同模型中使用同一连接

保存服务器列表,打开“插件”,启用 Detrix MCP 工具,然后在 TypingMind 中选择任意受支持的 AI 模型,即可在聊天中使用这些工具,或将其分配给智能体。

  1. 在 TypingMind 中打开“插件”页面。
  2. 启用 Detrix MCP 工具。
  3. 开始聊天并选择您想使用的 AI 模型。
  4. 在聊天中使用 MCP 工具,或将其分配给 AI 智能体。
  5. 根据需要随时切换到其他 AI 模型,无需重新连接 MCP。
在 TypingMind 聊天中使用已启用的 MCP 工具和选定的 AI 模型
您能使用 Detrix 帮我完成这项任务吗?
Detrix
当然。我已阅读。
以下是我使用 Detrix 得到的结果。

常见问题

Detrix MCP 服务器有什么用途?

Detrix 是一个 MCP 服务器,可让兼容的 AI 客户端连接外部工具并获取上下文。在 TypingMind 中,只需添加一次此 MCP 服务器,即可在您的 AI 工作区中使用其工具。

可以在 TypingMind 中让多个 AI 模型使用 Detrix MCP 吗?

可以。TypingMind 在工作区层面连接 MCP 工具,因此您可以让 Claude、ChatGPT、Gemini 等不同 AI 模型,或您在 TypingMind 中配置的其他模型使用 Detrix,而无需为每个模型单独配置 MCP 服务器。

为什么在 TypingMind 中使用 Detrix MCP?

TypingMind 将多个 AI 模型、提示词、插件、AI 智能体、API 密钥和 MCP 工具整合到同一个工作区中,是优秀的大语言模型聊天前端之一。连接 Detrix 后,您可以在偏好的不同模型中使用其 MCP 工具,同时在 TypingMind 中井然有序地管理聊天工作流程。

如何将 Detrix MCP 连接到 TypingMind?

Detrix 通过 TypingMind 本地 MCP 连接器运行。当 MCP 服务器需要访问您计算机上的本地文件、桌面应用、命令行工具或私有资源时,这种方式最合适。

Detrix MCP 在 TypingMind 中提供哪些工具?

Detrix 提供 MCP 功能,您可以在 TypingMind 的插件页面启用这些功能,然后在聊天中使用,或将其分配给 AI 智能体。

使用 Detrix MCP 需要向 TypingMind 提供我的 API 密钥吗?

不需要。TypingMind 采用本地优先的设计,让您自行掌控模型提供商、API 密钥、提示词和 MCP 配置。如果 Detrix 需要身份验证,请在创建连接时,为该 MCP 服务器添加所需的请求头、OAuth 设置或本地配置。

相关 MCP 服务器

查看全部

立即创建您自己的 AI 工作区

订阅我们的电子简报,获取新功能和后续赠奖活动的通知 👇