Clangaroo

by jasondk

Not rated
GitHub

About

Provides fast C++ code intelligence for LLMs using the clangd language server.

Details

Author
jasondk
Categories
Developer Tools, AI

Setup

Install Clangaroo in your MCP client (Claude Desktop, Cursor, Windsurf, and others).

Repository: https://github.com/jasondk/clangaroo

Follow the installation instructions in the repository README, then restart your MCP client.

🦘 Clangaroo: Fast C++ code intelligence for LLMs via MCP

NOTE (January 2026): Claude Code now has built-in support for LSPs, making this unnecessary. Since it may still be useful in other agentic harnesses I'll leave the project here for now.

Clangaroo enablesClaude Code,Gemini CLI, and other coding agents to jump around your C++ codebase with ease. Clangaroo provides fast, direct lookup of C/C++ symbols, functions, definitions, call hierarchies, type hierarchies, and more by your bestest LLM pals.

Clangaroo combines the speed ofTree-sitterparsing with the accuracy ofclangd LSP, optionally enhanced byGoogle Gemini FlashAI for deeper insights.Let your AI buddies spend more time coding and less time stumbling around.

But WHY did you make this?I ❀️ using Claude Code, but every time it auto-compacts and then starts grepping around for the function we've been working on for forever, I die a little bit inside.But aren't there already a few MCPs that do this- why do we need another? I spent some time searching and found bothMCP-language-serverandSerena, which both look perfectly nice! Unfortunately, neither worked for me 😭

Clangaroo is meant to be super simple and is intended to 'just work'.

- πŸš€ Quick Start
-
🎯 Features
-
πŸ’¬ Usage Examples
-
πŸ› οΈ Available Tools
-
πŸ€– AI Features (Optional)
-
βš™οΈ Configuration Reference
-
πŸ“‹ Requirements
-
πŸ”§ Troubleshooting
-
πŸ“„ License
-
πŸ™ Acknowledgments

git clone https://github.com/jasondk/clangaroo cd clangaroo pip install -e .

2. Special compilation step for your C++ project

The clang LSP needs you to do this once:

# For Makefile-based projects make clean compiledb make # (Some people prefer using 🐻) bear -- make
# For CMake projects cmake -B build -DCMAKE_EXPORT_COMPILE_COMMANDS=ON cp build/compile_commands.json .

This will create a specialcompile_commands.jsonfile in your project root.

3. Configure Claude Desktop or other MCP client

Did you know you can nowadd MCP serverstoLM Studio?

N.B.: Use of--ai-enabledwill use Google Gemini and will incur a small cost via your Gemini API key, if provided. This is usually very minor as long as you use Gemini Flash or Flash Lite.

Note:Please replace 'command' and 'project' with correct paths for your system, and replaceyour-google-ai-api-keywith your API key (if using one). If you don't wish to use the AI enhanced services, simply leave out all the--aioptions and the API key.

{ "mcpServers": { "clangaroo": { "command": "/usr/local/bin/clangaroo", "args": [ "--project", "/path/to/your/cpp/project", "--warmup", "--warmup-limit", "10", "--log-level", "info", "--ai-enabled", "--ai-provider", "gemini-2.5-flash", "--ai-cache-days", "14", "--ai-cost-limit", "15.0", "--call-hierarchy-depth", "10", "--ai-analysis-level", "summary", "--ai-context-level", "minimal" ], "env": { "CLANGAROO_AI_API_KEY": "your-google-ai-api-key" } } } }

- macOS:~/Library/Application Support/Claude/claude_desktop_config.json
- Windows:%APPDATA%\Claude\claude_desktop_config.json

Default depth of AI analysis (--ai-analysis-level, default:summary).

- summary: Quick overview with key points

- detailed: Comprehensive analysis with examples and context

Default depth of context (--ai-context-level, default:minimal).

- minimal: Just the symbol and immediate documentation

- local: Include surrounding code in the same file

- full: Include dependencies and related files

Quit and restart Claude. You're ready to explore your C++ code! πŸŽ‰

claude mcp add-from-claude-desktop(and make sureclangaroois checked)

claude mcp add /usr/local/bin/clangaroo --project /path/to/your/cpp/project --warmup --warmup-limit 10 --log-level info --ai-enabled --ai-provider gemini-2.5-flash --ai-cache-days 14 --ai-cost-limit 15.0 --call-hierarchy-depth 10 --ai-analysis-level summary --ai-context-level minimal --name clangaroo --env CLANGAROO_AI_API_KEY=your-google-ai-api-key

- ⚑Ultra-Fast Navigation: Fast response times for code structure queries
- πŸ”Smart Symbol Search: Hybrid Tree-sitter + clangd search with automatic fallback
- πŸ“ŠDeep Code Analysis: Call hierarchies, type hierarchies, and reference tracking
- πŸ€–AI-Powered Insights: Documentation summarization, pattern detection, and architectural analysis
- πŸ’ͺRobust: Works even with compilation errors thanks to Tree-sitter fallback
- πŸš€Zero Configuration: Just point to a project withcompile_commands.json

This is really meant for coding agents like Claude Code more than you, but if you want to use it, you can just talk to your LLM naturally about your code once the MCP server is hooked up:

"Uncover the cryptic lair where the UserManager class is conjured from the void." "Reveal every shadowy corner that invokes the dreaded summonSoulPayment() ritual." "Expose the unholy powers inherited by the DatabaseConnection class from its ancient ancestors." "Dissect the twisted call hierarchy of unleashChaos() and narrate the program's descent into madness." #YMMV

- Get your API key fromGoogle AI Studio
- Add to your environment (bash):

export CLANGAROO_AI_API_KEY="your-api-key"

- πŸ“šSmart Documentation: Complex C++ docs explained clearly
- πŸ”Pattern Analysis: Understand why and how functions are called
- πŸ›οΈArchitecture Insights: Identify design patterns automatically
- πŸ’‘Refactoring Tips: Get improvement recommendations
- πŸ’°Cost Effective: $3-7/month typical usage with smart caching

- --project PATH- Path to C++ project root (required)
- --log-level LEVEL- Logging verbosity: debug, info, warning, error
- --timeout SECONDS- LSP request timeout (default: 5.0)

- --warmup- Pre-warm the index by opening key files
- --warmup-limit N- Number of files to warm up (default: 10)
- --wait-for-index- Wait for clangd indexing to complete
- --index-timeout SECONDS- Timeout for index wait (default: 300)
- --index-path PATH- Custom clangd index location

- --ai-enabled- Enable AI features
- --ai-provider PROVIDER- AI provider: gemini-2.5-flash or gemini-2.5-flash-lite
- --ai-api-key KEY- Google AI API key
- --ai-cache-days DAYS- Cache AI summaries for N days (default: 7)
- --ai-cost-limit AMOUNT- Monthly cost limit in USD (default: 10.0)
- --ai-analysis-level LEVEL- Default analysis depth: summary or detailed
- --ai-context-level LEVEL- Code context depth: minimal, local, or full

- --call-hierarchy-depth DEPTH- Maximum depth (1-10, default: 3)
- --call-hierarchy-max-calls NUM- Total call limit (default: 100)
- --call-hierarchy-per-level NUM- Calls per depth level (default: 25)

- Python 3.10+
- clangd 16+ (brew install llvmorapt install clangd)
- C++ project withcompile_commands.json
- (Optional) Google AI API key for AI features
- Check the config file location and JSON syntax
- Use absolute paths in the configuration
- Restart Claude Desktop completely
- Check logs with--log-level debug
- Verifycompile_commands.jsonincludes the files
- Wait for indexing: add--wait-for-indexflag
- Test clangd directly:clangd --check=file.cpp

- Enable warmup:--warmup --warmup-limit 30
- Use shared index:--index-path /shared/clangd-index
- Reduce call hierarchy depth for large codebases

- clangdfor C++ language server
-
Tree-sitterfor syntax parsing
-
MCPfor the protocol specification
-
Google Geminifor AI capabilities

This is a web browser that enables your coding agent, such as Claude Code, to visit websites on your behalf and assist you in identifying bugs or creating UI test cases.

Automatically generates documentation for code repositories by analyzing directory structures and code files using the OpenRouter API.

Diagnoses token waste in Claude Code sessions with 6 anomaly types and severity scoring. Fully local.

A server for code modification and generation using Large Language Models.

Your AI Code Review Council - Get diverse perspectives from multiple AI models in parallel.

CLI token optimizer and AI context generator with built-in MCP server. Scans codebases to extract routes, schema, components, and dependencies 9x–13x token reduction for Claude Code, Cursor, Copilot, Codex, and Windsurf.

An MCP server for the codetoprompt library, enabling integration with LLM agents.

An MCP server that wraps the OpenAI Codex CLI, exposing its functionality through the MCP API.

A coding assistant server that provides context-aware code suggestions, documentation integration, and technology detection.

Rewrites coding prompts for optimal results with AI IDEs like Cursor AI, powered by Claude by Anthropic.

Performs complementary code analysis by combining Claude Code and Google's Gemini AI.

No reviews yet β€” be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.