# Code Analyze MCP [Health: Active]

**Category:** 💻 Developer Tools  
**Repository:** https://github.com/clouatre-labs/code-analyze-mcp  
**GitHub Stars:** 7  
**Views:** 0  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/code-analyze-mcp

## Description
MCP server for code structure analysis using tree-sitter.

## Tools
Capabilities this server exposes over MCP:

- **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

## Claude Desktop Quick Installation
No generated config for this server: it installs through its own setup steps.

The project's own setup steps (from https://github.com/clouatre-labs/code-analyze-mcp), copied verbatim. Follow them in order; they are not an mcpServers config.

1. Install:

```sh
brew install clouatre-labs/tap/aptu-coder
```

2. Install:

```sh
cargo binstall aptu-coder
```

3. Start the server:

```sh
brew services start aptu-coder
```

4. Add to Claude Code:

```sh
claude mcp add --transport http aptu-coder http://127.0.0.1:49200/mcp
```

5. Start the server:

```sh
APTU_CODER_PORT=4000 brew services restart aptu-coder
```

6. Start the server:

```sh
aptu-coder --port 49200
```

## Documentation

## What Code Analyze MCP does

Code Analyze MCP provides local code intelligence for MCP-compatible coding agents. It parses supported source files with tree-sitter and returns structural information such as functions, classes, imports, signatures, line ranges, directory statistics, and symbol relationships. Results are designed to give an agent a compact view of a repository without repeatedly reconstructing its structure from raw file contents.

The server supports Astro, C and C++, C#, CSS, Fortran, Go, HTML, Java, JavaScript, JSON, Kotlin, Markdown, Python, Rust, TOML, TSX, TypeScript, and YAML through their listed file extensions. It also includes workspace mutation and command-execution tools, making it useful for workflows that need both repository understanding and controlled changes.

## How it works

Parsing happens on the local machine, so source code is not sent to a hosted indexing service. An on-disk cache keyed by Blake3 content hashes allows structural results to be reused while remaining tied to file contents. The same structural graph supports analysis results and the server's knowledge-graph resource surface.

The server offers two MCP transports. Stdio lets one client own the process lifecycle, while streamable HTTP allows multiple processes or delegated agents to share one running instance. The HTTP mode is suited to orchestrated multi-agent setups where separate server processes could otherwise maintain different instances.

Analysis responses can be compacted automatically when they become large, and analysis tools support cursors for pagination. Directory analysis follows `.gitignore`, and reported paths are relative to the working directory.

## Setup and configuration

Install the `aptu-coder` binary with Homebrew, `cargo binstall`, or `cargo install`; building from source uses the Rust toolchain and produces a release binary under `target/release`. Start the HTTP server directly with `aptu-coder --port 49200`, or run it as a Homebrew service. The listening port can be changed with `APTU_CODER_PORT`.

For stdio, configure an MCP client to launch `aptu-coder` as its command. For HTTP, point the client at the server's `/mcp` endpoint. Claude Code supports both documented transport styles, while a project-level `.mcp.json` can store the stdio configuration for team use.

## Tools and capabilities

- `analyze_directory` reports a directory tree plus lines-of-code, function, and class counts.
- `analyze_file` extracts functions, classes, imports, signatures, and line ranges. Unsupported extensions produce a fallback containing a line count and file head rather than an AST.
- `analyze_module` returns a smaller function and import index. Unsupported files produce an empty index with a note.
- `analyze_symbol` traces callers, callees, and call depth for a named symbol across a directory.
- `edit_overwrite` creates or replaces a file and creates missing parent directories.
- `edit_replace` replaces an exact text block once or across non-overlapping matches. It can delete a block with empty replacement text and reject stale content using a Blake3 hash.
- `exec_command` runs shell commands and returns output and an exit code, with output filtering and cancellation handling.
- `verify_anchors` checks `path:line` or `path:line:symbol` references against a workspace, including optional nearby word-boundary symbol matching, and returns one structured verdict per anchor.

## Limitations and notes

Unsupported file extensions receive graceful fallbacks from the analysis tools rather than parsed syntax trees. The server owns analysis page sizes; clients should use returned cursors and should not send a `page_size` parameter. `edit_replace` requires a unique match unless replacement-all mode is selected, and expected content hashes can cause an edit to fail when the file changed. Shell execution is bounded and applies command and output safeguards, including cancellation behavior and a post-exit drain window.

_Full upstream README: https://allmcps.com/mcp/code-analyze-mcp/readme_

