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.
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
First, create a configuration file that defines which projects are available to the MCP server:
~/.config/code-assistant/projects.json
{
"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.
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.
Start the MCP server directly with:
code-assistant server [OPTIONS]
Available options:
-v, --verbose
: Enable verbose loggingCode Assistant can also run as a standalone agent without requiring an MCP client:
code-assistant --task <TASK> [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 recordingsANTHROPIC_API_KEY
: Required for Anthropic providerOPENAI_API_KEY
: Required for OpenAI providerGOOGLE_API_KEY
: Required for Vertex providerOPENROUTER_API_KEY
: Required for OpenRouter providerPERPLEXITY_API_KEY
: Required for Perplexity search tools# 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
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.
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.
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"
]
}
}
}
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.
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.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.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