aptu-coder

aptu-coder

code-analyze-mcp•byclouatre-labs

A local Model Context Protocol code-intelligence server that parses codebases with tree-sitter and serves directory trees, symbol tables, and structural code search to AI coding agents.

License: Apache-2.0•Runtime: Awaiting documentation review•Category: developer tools

WHAT IT DOES

  • •Analyzes directories to produce a tree with line-of-code, function, and class counts while respecting .gitignore.
  • •Analyzes individual files to return functions, classes, and imports with signatures and line ranges.
  • •Provides a lightweight function and import index via analyze_module.
  • •Offers structural code search in pattern and symbol modes to find definitions, callers, and implementors.

BEST FOR

  • •Giving coding agents structural context about large or unfamiliar codebases without reading raw files.
  • •Premise grounding for multi-agent workflows and non-agentic MCP consumers such as IDE assistants, CI jobs, and scoring pipelines.
  • •On-device code analysis where no source code leaves the machine.

ABOUT CODE-ANALYZE-MCP

aptu-coder is cataloged as an MCP server attributed to clouatre-labs. A local Model Context Protocol code-intelligence server that parses codebases with tree-sitter and serves directory trees, symbol tables, and structural code search to AI coding agents. It is categorized under developer tools. See the capability inspector for recorded interfaces and their independent review status; consult upstream documentation for the current interface.

HOW TO INSTALL

Installation configuration is not reviewed. No executable setup is offered for this entry; inspect the source repository before proceeding.

LICENSE

Catalog license label: Apache-2.0. Check the source repository's current license and terms before using, modifying or distributing this software.

能力检查器

能力定义尚未审核。未核验的采集内容不会作为可信接口展示。

Tools (0)

暂无可展示的已审核记录。这不表示上游不支持此能力。

Resources (0)

暂无可展示的已审核记录。这不表示上游不支持此能力。

Prompts (0)

暂无可展示的已审核记录。这不表示上游不支持此能力。

NEWSLETTER - COMING LATER

Newsletter subscriptions are not open yet

Email delivery is not connected. This page does not collect email addresses or create subscriptions.

Browse the registry for current listings instead.

Community Reviews

Coming later

Reviews for aptu-coder are not available yet

Review publishing and storage are not connected. This page does not collect or publish ratings or comments, including after sign-in.

FREQUENTLY ASKED QUESTIONS

Which languages does aptu-coder support?

It supports 18 languages: Astro, C/C++, C#, CSS, Fortran, Go, HTML, Java, JavaScript, JSON, Kotlin, Markdown, Python, Rust, TOML, TSX, TypeScript, and YAML.

How does it prevent large analysis output from overflowing the context?

It uses pagination with NEXT_CURSOR tokens, output caps on exec_command, and summary mode that auto-triggers above 50K chars.

上游原版 README

在 GitHub 查看同一版本原文

README.md · 5a71673a8737 · 采集于 2026-11-13 10:32:10 UTC

保留上游原文,不做 AI 改写。为安全起见过滤脚本、表单和不安全链接。

当前显示最后一次成功采集的文档快照,请以来源页面为准。

aptu-coder

crates.io SLSA Level 3 OpenSSF Best Practices

A Model Context Protocol (MCP) code-intelligence server that gives AI coding agents pre-parsed symbol tables and structural code search instead of raw file bytes, cutting token usage by up to 59% in the cited benchmark conditions (see Benchmarks). OpenSSF silver certified: fewer than 1% of open source projects reach this level.

[!NOTE] Native agent tools (regex search, path matching, file reading) handle targeted lookups well. aptu-coder handles the mechanical, non-AI work: mapping directory structure, extracting symbols, and locating callers and implementors via structural search, so a coding agent's context window is spent reasoning instead of re-deriving structure on every call.

Most code-intelligence tooling for AI agents indexes a codebase into a cloud embedding or vector store and retrieves by similarity search. aptu-coder instead parses the codebase into a structural graph on-device with tree-sitter and serves it locally over MCP: no source code leaves the machine, and retrieval is exact (symbol tables and structural code search) rather than approximate (nearest-neighbor similarity).

Benchmarks

Paired comprehension tasks on Claude Code (MCP mode vs native shell search). Methodology: Django auth migration (v12) and OpenFAST AeroDyn integration audit (v13).

TaskModeSonnet 4.6Haiku 4.5Savings
Django (Python)MCP112k tokens, $0.39406k tokens, $0.4259% fewer tokens, 59% cheaper (Sonnet)
Django (Python)Native276k tokens, $0.95473k tokens, $0.5314% fewer tokens, 21% cheaper (Haiku)
OpenFAST (Fortran)MCP472k tokens, $1.65687k tokens, $0.7246% fewer tokens, 42% cheaper (Sonnet)
OpenFAST (Fortran)Native877k tokens, $2.852162k tokens, $2.2168% fewer tokens, 68% cheaper (Haiku)

A real end-to-end multi-agent run against this repository itself: five refactoring issues (#1578–#1582) fixed by the coder skill in one orchestrated session — 23 subagent spawns (5 scout, 1 guard, 10 build, 7 check), ~1h42m, three human interventions — producing PRs #1584–#1588, all merged with CI green. Case study.

Scope of the benchmark claims

The token-savings figures above come from single, focused comprehension tasks where the agent used aptu-coder instead of shell search. Agentic coding loops have bash and ripgrep and can search the repo directly. The v19 benchmark program (N=20 paired sessions, pre-registered claim gate) measured aptu-coder in those loops: no measurable answer-quality gain over bash + ripgrep on structural fan-in tasks (pooled paired F1 diff mean -0.071, 95% CI [-0.179, +0.038]; gate NOT-SUPPORTED); tool activation itself was reliable when tools were surfaced directly. Recommended uses: premise grounding for multi-agent workflows, and non-agentic MCP consumers (IDE assistants, CI jobs, scoring pipelines).

Overview

aptu-coder is a comprehension layer for coding agents: it gives an agent harness precise structural context about a codebase, directory trees, symbol definitions, and callers and implementors via structural search, without the agent reading raw files or re-deriving structure on every call. That prevents context starvation on large or unfamiliar codebases while keeping the result set small enough to fit the model's context window. It supports 18 languages (see Supported Languages) and integrates with any MCP-compatible orchestrator.

Structural context is built once and reused: an on-disk cache keyed by blake3 content hashes keeps results correct across concurrent writes. For consumers that hold source text without an on-disk path, aptu-coder-core also exposes analyze_str as a public Rust library API (see ARCHITECTURE.md).

Further reading on the design philosophy, from the author's blog: The Agentic SDLC Governance Stack, Context Engineering for Multi-Agent Reliability, and Orchestrating AI Agents: Subagent Architecture.

Supported Languages

Astro, C/C++, C#, CSS, Fortran, Go, HTML, Java, JavaScript, JSON, Kotlin, Markdown, Python, Rust, TOML, TSX, TypeScript, YAML. The full extension map lives in crates/aptu-coder-core/src/lang.rs.

Installation

Homebrew (macOS and Linux)

brew install clouatre-labs/tap/aptu-coder

Update: brew upgrade aptu-coder

cargo-binstall (no Rust required)

cargo binstall aptu-coder

cargo install (requires Rust toolchain)

cargo install aptu-coder

Quick Start

Build from source

cargo build --release

The binary is at target/release/aptu-coder.

Configure MCP Client

stdio (default) — the client spawns and owns the server process; this works with orchestrators that spawn delegates (goose, pi) as well as single clients:

claude mcp add --transport stdio aptu-coder -- aptu-coder

Or add manually to .mcp.json at your project root (shared with your team via version control):

{
  "mcpServers": {
    "aptu-coder": {
      "command": "aptu-coder",
      "args": []
    }
  }
}

Streamable HTTP (optional) — runs a single shared server process instead of one per client. Only worth it if you specifically want a daemon-style setup:

aptu-coder --port 49200            # or: brew services start aptu-coder
claude mcp add --transport http aptu-coder http://127.0.0.1:49200/mcp

For goose, add to ~/.config/goose/config.yaml:

extensions:
  aptu-coder:
    type: streamable_http
    uri: http://127.0.0.1:49200/mcp
    name: aptu-coder
    timeout: 300

Tools

All optional parameters may be omitted. analyze_directory, analyze_file, and analyze_module accept summary (compact output, auto-triggers above 50K chars) and cursor (pagination token). Page size is server-owned; there is no client page_size parameter (passing one returns INVALID_PARAMS).

  • analyze_directory -- directory tree with LOC, function, and class counts; respects .gitignore
  • analyze_file -- functions, classes, and imports with signatures and line ranges; graceful fallback for unsupported extensions
  • analyze_module -- lightweight function and import index (~75% smaller than analyze_file)
  • edit_overwrite -- create or overwrite a file; creates parent directories
  • edit_replace -- replace a unique exact text block (or all occurrences with replace_all); batch form edits[] applies multiple replacements atomically; optional expected_content_hash rejects stale edits
  • exec_command -- run a shell command; output is capped, filtered, and returned with exit code; cancelled requests kill the command
  • search_code -- structural code search in two modes: pattern (metavariable patterns with $X and $$$REST; Rust, Go, Python, and TypeScript) and symbol (definitions, callers, and implementors via the structural graph, all supported languages); byte-exact spans suitable for edit_replace; cursor-paginated

Tool parameters, constraints, and examples are available via your MCP client's tool inspector or tools/list response.

Output Management

For large codebases, several mechanisms prevent context overflow.

Pagination

analyze_file appends a NEXT_CURSOR: line when output is truncated. Pass the token back as cursor to fetch the next page. summary=true and cursor are mutually exclusive; passing both returns an error.

# Response ends with:
NEXT_CURSOR: eyJvZmZzZXQiOjUwfQ==

# Fetch next page:
analyze_file path: /my/project/src/lib.rs cursor: eyJvZmZzZXQiOjUwfQ==

exec_command output caps

exec_command applies three independent byte-level caps to prevent large command outputs from flooding the context:

stdout keeps the last 30,000 chars, stderr the last 10,000 (tail-preserving, so errors appear at the end), and the combined output_text is capped at 50,000 chars as a safety net after interleaving.

The 30k stdout cap is data-driven: analysis of 27,981 observed exec_command calls shows only 0.33% exceed this limit. When any cap fires, output_truncated: true is set in the response and recorded in the JSONL metrics.

Recovering capped output: when output is capped, the response includes MCP resource links (aptu-overflow://slot-{seq}/stdout, /stderr, /interleaved) pointing to the full raw capture for that invocation (last-run-wins); read them via resources/read. If a filter capped the output, a hint line points to the pre-filter capture file.

A server-owned post-exit drain window (500 ms) waits for any background subprocess still holding the pipe open. If it expires before the pipe closes, exit_code is null and output_truncated: true is set.

exec_command output filters

A built-in filter table suppresses per-file noise from chatty CLI tools before output reaches the model. Filters apply to stdout, stderr, and interleaved output on success only; raw output is always preserved on failure.

Built-in rules cover the usual suspects: git pull/fetch/push strip diff-stat, remote-progress, and ref noise; git log/status cap at 20 lines; git show strips patch hunks; git diff strips ANSI escapes; git commit/add strip hook output; cargo build/test strip Compiling/Checking/Fresh progress lines. Clean output collapses to a short ok confirmation.

Project-local rules can be added in .aptu/filters.toml. Parse errors and unrecognized schema_version values (version != 1) fall back to the built-in table with a logged warning; no crash occurs. When a filter fires, filter_applied in structuredContent identifies which rule matched.

Non-Interactive Pipelines

In single-pass subagent sessions, prompt caches are written but never reused. Benchmarks showed MCP responses writing ~2x more to cache than native-only workflows, adding cost with no quality gain. Set DISABLE_PROMPT_CACHING=1 (or DISABLE_PROMPT_CACHING_HAIKU=1 for Haiku-specific pipelines) to avoid this overhead.

The server's own instructions are deliberately minimal, a single short paragraph: start with analyze_directory for a package/module map, then use analyze_module/analyze_file for per-file detail, with a pointer to docs/METRICS.md for JSONL metrics and jq recipes. MCP clients that surface server instructions will present this guidance automatically to the agent.

Environment Variables

Cache and runtime

VariableDefaultDescription
APTU_CODER_DIR_CACHE_CAPACITY20LRU cache size for directory-analysis results.
APTU_CODER_DISK_CACHE_DIR$XDG_DATA_HOME/aptu-coder/analysis-cacheDirectory for the L2 analysis disk cache. Created automatically if it does not exist.
APTU_CODER_DISK_CACHE_DISABLEDunsetSet to 1 to disable the L2 analysis disk cache entirely.
APTU_CODER_FILE_CACHE_CAPACITY100LRU cache size for file-analysis results.
APTU_CODER_METRICS_EXPORT_FILEunsetAbsolute path for a one-shot JSONL metrics export on shutdown.
APTU_CODER_PORTunsetPort for streamable HTTP mode. Equivalent to --port N; --port takes precedence. When unset and --port is not passed, stdio mode is used.
APTU_CODER_BEARER_TOKENunsetBearer token for Streamable HTTP transport authentication. A warning is logged if the value is fewer than 32 characters.
APTU_CODER_SESSION_ORIGINunsetMarks the session origin for JSONL metrics: agent, maintainer, or test. Invalid values log a one-time warning and are treated as unset.
APTU_SHELLunsetShell for exec_command. Defaults to bash then /bin/sh.

Observability

For the JSONL schema, OTel configuration, and span attribute policy, see:

Documentation

  • Blog - Design philosophy and agent-harness engineering behind aptu-coder
  • AGENTS.md - Contributor reference: project structure, commands, rmcp footguns, tool parameter constraints
  • ARCHITECTURE.md - Design goals, module map, data flow, language handler system, caching strategy
  • CONTRIBUTING.md - Development workflow, commit conventions, PR checklist
  • DESIGN-GUIDE.md - Design decisions, rationale, and replication guide for building high-performance MCP servers
  • MCP Best Practices - Best practices for agentic loops, orchestration patterns, MCP tool design, memory management, and safety controls
  • METRICS.md - Metrics schema, JSONL format, and retention policy
  • ROADMAP.md - Development history and future direction
  • SECURITY.md - Security policy and vulnerability reporting

License

Apache-2.0. See LICENSE for details.

Install configuration

Are you the maintainer?

Claim this server with your GitHub account to request manual ownership verification.

README Embed Badge
Markdown

Link to the catalog listing for aptu-coder from your README. This badge does not certify ownership, compatibility or security.

[![MCP catalog listing](https://img.shields.io/badge/MCP-awesome--mcp-orange?style=flat-square)](https://awesome-mcp.com/servers/code-analyze-mcp)

REPOSITORY STATS

GitHub StarsUnavailable
ForksUnavailable

Public repository statistics could not be verified. Check the configured source address; unavailable counts are not zero.

下载与拉取统计

来源、范围和时段分别列出;不相加,不代表安装人数、活跃用户或安全审核。

尚无已审核的包 / 镜像标识,暂不展示下载统计。

Related developer tools MCP Servers

Alternative and complementary servers in the same category

View all in developer tools →
Postbye
postbye-mcp•postbye-team

A directory listing describing a cancellation-letter and mailing-address service. The configured public GitHub repository returned 404 during source verification.

Repository stats unavailable
Developer Tools
Singapore Proxy MCP
singapore-proxy-mcp•Xavierfok

A hosted MCP service for browsing and searching through Singapore mobile-network proxies.

0
Developer Tools

A directory listing describing a Markdown-to-PDF service. The configured public GitHub repository returned 404 during source verification.

Repository stats unavailable
Developer Tools