Code Assistant MCP server

Rust-based code exploration server that enables reading, writing, and understanding codebases through autonomous navigation, file summarization, and multi-provider LLM support.
Back to servers
Setup instructions
Provider
stippi
Release date
Mar 20, 2025
Language
Rust
Stats
68 stars

This CLI tool serves as a Model Context Protocol (MCP) server that provides code-related assistance to LLM clients. Acting as a bridge between language models and your local codebase, it enables models to explore, read, and modify code files while offering interactive capabilities through a variety of tools.

Installation

Ensure you have Rust installed on your system, then build the tool from source:

# Clone the repository
git clone https://github.com/stippi/code-assistant

# Navigate to the project directory
cd code-assistant

# Build the project
cargo build --release

# The binary will be available in target/release/code-assistant

Setting Up as an MCP Server for Claude Desktop

Configure Your Projects

First, create a configuration file that defines which projects are available to the MCP server:

  1. Create the file at ~/.config/code-assistant/projects.json
  2. Add your projects using the following structure:
{
  "code-assistant": {
    "path": "/Users/<username>/workspace/code-assistant"
  },
  "asteroids": {
    "path": "/Users/<username>/workspace/asteroids"
  },
  "zed": {
    "path": "Users/<username>/workspace/zed"
  }
}

Note: You can edit this file without restarting the MCP server or Claude Desktop.

Configure MCP Server in Claude Desktop

  1. Open Claude Desktop application settings (ClaudeSettings)
  2. Switch to the Developer tab
  3. Click the Edit Config button
  4. Edit the claude_desktop_config.json file as follows:
{
  "mcpServers": {
    "code-assistant": {
      "command": "/Users/<username>/workspace/code-assistant/target/release/code-assistant",
      "args": [
        "server"
      ],
      "env": {
        "PERPLEXITY_API_KEY": "pplx-...", 
        "SHELL": "/bin/zsh"
      }
    }
  }
}

The PERPLEXITY_API_KEY is optional and enables the perplexity_ask tool. The SHELL variable should be set to your login shell.

Running the MCP Server

Start the MCP server directly with:

code-assistant server [OPTIONS]

Available options:

  • -v, --verbose: Enable verbose logging

Using as a Standalone CLI Tool

Code Assistant can also run as a standalone agent without requiring an MCP client:

code-assistant --task <TASK> [OPTIONS]

Command Options

  • --path <PATH>: Path to the code directory (default: current directory)
  • -t, --task <TASK>: Task to perform on the codebase
  • --ui: Start with GUI interface
  • --continue-task: Continue from previous state
  • -v, --verbose: Enable verbose logging
  • -p, --provider <PROVIDER>: LLM provider [ai-core, anthropic, open-ai, ollama, vertex, open-router]
  • -m, --model <MODEL>: Model name to use
  • --base-url <BASE_URL>: API base URL for the LLM provider
  • --tools-type <TOOLS_TYPE>: Type of tool declaration [native, xml]
  • --num-ctx <NUM_CTX>: Context window size in tokens (default: 8192, for Ollama)
  • --record <RECORD>: Record API responses to a file
  • --playback <PLAYBACK>: Play back a recorded session
  • --fast-playback: Ignore chunk timing when playing recordings

Environment Variables

  • ANTHROPIC_API_KEY: Required for Anthropic provider
  • OPENAI_API_KEY: Required for OpenAI provider
  • GOOGLE_API_KEY: Required for Vertex provider
  • OPENROUTER_API_KEY: Required for OpenRouter provider
  • PERPLEXITY_API_KEY: Required for Perplexity search tools

Usage Examples

# Analyze code in current directory using Anthropic's Claude
code-assistant --task "Explain the purpose of this codebase"

# Use a different provider and model
code-assistant --task "Review this code for security issues" --provider openai --model gpt-4o

# Analyze a specific directory with verbose logging
code-assistant --path /path/to/project --task "Add error handling" --verbose

# Start with GUI interface
code-assistant --ui

# Use Ollama with a local model
code-assistant --task "Document this API" --provider ollama --model llama2 --num-ctx 4096

# Record a session for later playback (Anthropic only)
code-assistant --task "Optimize database queries" --record ./recordings/db-optimization.json

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

claude mcp add-json "code-assistant" '{"command":"/Users/<username>/workspace/code-assistant/target/release/code-assistant","args":["server"]}'

See the official Claude Code MCP documentation for more details.

For Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "code-assistant": {
            "command": "/Users/<username>/workspace/code-assistant/target/release/code-assistant",
            "args": [
                "server"
            ]
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

2. Add this to your configuration file:

{
    "mcpServers": {
        "code-assistant": {
            "command": "/Users/<username>/workspace/code-assistant/target/release/code-assistant",
            "args": [
                "server"
            ]
        }
    }
}

3. Restart Claude Desktop for the changes to take effect

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later