Clangaroo logo

Clangaroo

Community
jasondk

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

Publisherjasondk
Repositoryclangaroo
LanguagePython
Forks
3
Stars
23
Available tools
0
Transport typestdio
Categories
LicenseMIT
Links
  • Connect tools to AI workflows

    Clangaroo exposes MCP capabilities that can be used by compatible AI clients and agents.

  • 0 available tools

    Browse the callable actions below, including names and descriptions when provided by the server.

  • Ready-to-copy setup

    Use the installation snippets to configure this server in your preferred MCP client.

  • Open source signals

    23 stars and 3 forks from the linked repository.

Clangaroo Banner

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

MIT License Python 3.10+ clangd 16+ Buy Me A Coffee

✨ About

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 enables Claude 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 of Tree-sitter parsing with the accuracy of clangd LSP, optionally enhanced by Google Gemini Flash AI 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 both MCP-language-server and Serena, which both look perfectly nice! Unfortunately, neither worked for me 😭

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

📚 Table of Contents

🚀 Quick Start

1. Install Clangaroo

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:

bash
# For Makefile-based projects
make clean
compiledb make

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

This will create a special compile_commands.json file in your project root.

3. Configure Claude Desktop or other MCP client

Did you know you can now add MCP servers to LM Studio?

N.B.: Use of --ai-enabled will 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 replace your-google-ai-api-key with your API key (if using one). If you don't wish to use the AI enhanced services, simply leave out all the --ai options 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

4. Restart Claude Desktop

Quit and restart Claude. You're ready to explore your C++ code! 🎉

5. Add MCP server to Claude Code

claude mcp add-from-claude-desktop (and make sure clangaroo is checked)

OR

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

🎯 Features

  • ⚡ 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 with compile_commands.json

💬 Usage Examples

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

🛠️ Available Tools

Tool CategoryToolsDescription
🔍 Discoverycpp_list_filescpp_search_symbolsFind files and symbols in your codebase
📍 Navigationcpp_definitioncpp_referencescpp_hoverJump to definitions, find references, get type info
📞 Call Analysiscpp_incoming_callscpp_outgoing_callsTrace function relationships
🏗️ Type Hierarchycpp_prepare_type_hierarchycpp_supertypescpp_subtypesAnalyze inheritance
⚡ Structurecpp_list_functionscpp_list_classescpp_get_outlinecpp_extract_signaturesFast structural analysis

🤖 AI Features (Optional)

Setup

  1. Get your API key from Google AI Studio
  2. Add to your environment (bash):
    export CLANGAROO_AI_API_KEY="your-api-key"

What You Get

  • 📚 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

⚙️ Configuration Reference

Basic Options

  • --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)

Performance Options

  • --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 Options

  • --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 Options

  • --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)

📋 Requirements

  • Python 3.10+
  • clangd 16+ (brew install llvm or apt install clangd)
  • C++ project with compile_commands.json
  • (Optional) Google AI API key for AI features

🔧 Troubleshooting

  1. Check the config file location and JSON syntax
  2. Use absolute paths in the configuration
  3. Restart Claude Desktop completely
  4. Check logs with --log-level debug
  1. Verify compile_commands.json includes the files
  2. Wait for indexing: add --wait-for-index flag
  3. 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

📄 License

MIT License - see the file for details.

🙏 Acknowledgments


Use Clangaroo MCP with multiple AI models

TypingMind connects MCP tools at the workspace level, so once Clangaroo is connected, you can use it with different AI models in TypingMind instead of setting it up separately for each model. This MCP runs locally through the TypingMind MCP connector on your device.

Setup guide to use the local connector

Use this when the MCP server needs access to local files, apps, or private resources on your computer.

1

Open the MCP settings

In TypingMind, go to Settings, Advanced Settings, then Model Context Protocol and choose Setup Connector.

  1. Open TypingMind in your browser.
  2. Click the Settings icon.
  3. Go to Advanced Settings.
  4. Open the Model Context Protocol section.
  5. Click Setup Connector and choose This Device.
TypingMind MCP connector setup screen with This Device selected
2

Run the connector command

Choose This Device, copy the command from TypingMind, and run it in Terminal. Keep the process running while you use MCP.

  1. Copy the setup command shown by TypingMind.
  2. Open Terminal on macOS or Windows Terminal on Windows.
  3. Paste and run the command.
  4. Approve the package install if Terminal asks you to proceed.
  5. Keep the Terminal window running while using MCP tools.
3

Add Clangaroo as a server

When the connector status is Ready, click Edit Servers and paste the MCP server configuration.

  1. Wait until the connector status shows Ready.
  2. Click Edit Servers.
  3. Paste the Clangaroo MCP server configuration.
  4. Save the server list.
  5. Refresh if you want to confirm the connector is still ready.
TypingMind MCP settings showing active server and Edit Servers button
{
  "mcpServers": {
    "clangaroo": {
      "command": "npx",
      "args": [
        "-y",
        "<mcp-server-package>"
      ]
    }
  }
}
4

Use it across models

Save the server list, open Plugins, enable the Clangaroo MCP tools, then select any supported AI model in TypingMind and use the tools in chat or assign them to an AI agent.

  1. Open the Plugins page in TypingMind.
  2. Enable the Clangaroo MCP tools.
  3. Start a chat and choose the AI model you want to use.
  4. Use the MCP tools in chat or assign them to an AI agent.
  5. Switch to another AI model whenever needed without reconnecting MCP.
TypingMind chat using enabled MCP tools with a selected AI model
Can you use Clangaroo to help me with this task?
Clangaroo
Sure. I read it.
Here is what I found using Clangaroo.

Frequently asked questions

What is the Clangaroo MCP server used for?

Clangaroo is an MCP server that lets compatible AI clients connect to external tools and context. In TypingMind, you can add this MCP server once and make its tools available in your AI workspace.

Can I use Clangaroo MCP with multiple AI models in TypingMind?

Yes. TypingMind connects MCP tools at the workspace level, so you can use Clangaroo with different AI models such as Claude, ChatGPT, Gemini, or other models you have configured in TypingMind without setting up the MCP server separately for each model.

Why use Clangaroo MCP with TypingMind?

TypingMind is one of the best frontends for LLM chat because it brings multiple AI models, prompts, plugins, AI agents, API keys, and MCP tools into one workspace. With Clangaroo connected, you can use its MCP tools across your preferred models while keeping your chat workflow organized in TypingMind.

How do I connect Clangaroo MCP to TypingMind?

Clangaroo runs through the TypingMind local MCP connector. This is best when the MCP server needs access to local files, desktop apps, command-line tools, or private resources on your computer.

What tools does Clangaroo MCP provide in TypingMind?

Clangaroo exposes MCP capabilities that can be enabled from the TypingMind Plugins page and used in chat or assigned to AI agents.

Do I need to share my API keys with TypingMind to use Clangaroo MCP?

No. TypingMind is local-first and lets you keep your model providers, API keys, prompts, and MCP configuration under your control. If Clangaroo requires authentication, add the required headers, OAuth settings, or local configuration for that MCP server when you create the connection.

Related MCP Servers

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇