CodeAlive深度上下文
STDIO为AI代理提供代码库的深度上下文
为AI代理提供代码库的深度上下文
This MCP (Model Context Protocol) server for the CodeAlive API enables AI clients like Claude Desktop, Cursor, Windserf, VS Code (GitHub Copilot), Cline, Roo-Code, and Refact to access CodeAlive's advanced semantic code search and codebase interaction features.
CodeAlive MCP enhances these agents by providing enriched context from your project's codebase, enabling more intelligent and efficient interactions.
CodeAlive is a platform that analyzes your entire codebase, including documentation and dependencies, to understand its structure, patterns, and logic. It creates a detailed internal map of your repositories or workspaces, enabling fast, reliable, and high-quality answers to questions about your solution for any IT professional.
Using this MCP server allows AI agents (like Claude, Copilot, etc.) to leverage CodeAlive's deep code understanding. This helps agents:
The MCP server provides the following tools:
chat_completions
: Access the CodeAlive Chat API with codebase context. If your API key is assigned to exactly one datasource, specifying the datasource is optional.get_data_sources
: List available repositories and workspaces indexed by CodeAlive.search_code
: Search for code snippets across your datasources using CodeAlive's semantic search. If your API key is assigned to exactly one datasource, specifying the datasource is optional.# Clone the repository git clone https://github.com/CodeAlive-AI/codealive-mcp.git cd codealive-mcp # Create a virtual environment and install dependencies uv venv source .venv/bin/activate # On Windows use: .venv\\Scripts\\activate uv pip install -e .
# Clone the repository git clone https://github.com/CodeAlive-AI/codealive-mcp.git cd codealive-mcp # Create a virtual environment and install dependencies python -m venv .venv source .venv/bin/activate # On Windows use: .venv\\Scripts\\activate pip install -e .
To install CodeAlive for Claude Desktop automatically via Smithery:
npx -y @smithery/cli install @CodeAlive-AI/codealive-mcp --client claude
Configure the server using environment variables or command-line arguments.
The following environment variables are supported:
CODEALIVE_API_KEY
: Your CodeAlive API key. (Required unless passed via --api-key
)--api-key
: Your CodeAlive API key. Overrides the CODEALIVE_API_KEY
environment variable.--transport
: Transport type: "stdio"
(default) or "sse"
.--host
: Host address for SSE transport (default: 0.0.0.0
).--port
: Port for SSE transport (default: 8000
).--debug
: Enable debug mode with verbose logging to standard output/error.Below are configuration examples for popular AI clients. Remember to replace placeholders like /path/to/your/codealive-mcp
and YOUR_API_KEY_HERE
with your actual values. Using environment variables (env
block) is generally recommended over putting the API key directly in the configuration file.
Configure the MCP server in your project's .continue/config.yaml
or globally in ~/.continue/config.yaml
:
# ~/.continue/config.yaml or ./.continue/config.yaml mcpServers: - name: CodeAlive command: /path/to/your/codealive-mcp/.venv/bin/python # Or use 'uv' if preferred (see Cursor example) args: - /path/to/your/codealive-mcp/src/codealive_mcp_server.py - --debug # Optional: Enable debug logging env: CODEALIVE_API_KEY: YOUR_API_KEY_HERE
Restart Continue or reload the configuration.
Claude Code reads settings from the following locations:
User-wide (global):
~/.claude/settings.json
%USERPROFILE%\.claude\settings.json
Project-level (overrides global):
<project-root>/.claude/settings.json
<project-root>/.claude/settings.local.json
If the file doesn’t exist, create it.
Edit your chosen settings.json
and add (or merge) a top-level "mcpServers"
block:
{ // ...existing settings... "mcpServers": { "codealive": { "command": "/path/to/your/codealive-mcp/.venv/bin/python", "args": [ "/path/to/your/codealive-mcp/src/codealive_mcp_server.py", "--debug" // Optional: enable debug logging ], "env": { "CODEALIVE_API_KEY": "YOUR_API_KEY_HERE" } } } }
command
: Path to the executable (Python, Node, etc.) for your MCP server.args
: Arguments for launching the server.env
: Environment variables (API keys, etc.) needed by your server.If you already have settings, merge this block without removing other configuration.
/tools
or verifying that your tools appear in the tool list.CodeAlive MCP server should now be available in Claude Code! For more details, see Anthropic’s MCP docs.
Edit your Claude Desktop configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
(usually C:\Users\YourUsername\AppData\Roaming\Claude\claude_desktop_config.json
)Add the MCP server configuration:
{ "mcpServers": { "codealive": { "command": "/path/to/your/codealive-mcp/.venv/bin/python", "args": [ "/path/to/your/codealive-mcp/src/codealive_mcp_server.py", "--debug" // Optional: Enable debug logging ], "env": { "CODEALIVE_API_KEY": "YOUR_API_KEY_HERE" } } } }
(Ensure this merges correctly if the file already has content)
Restart Claude Desktop completely.
Open VS Code settings (JSON) using the Command Palette (Ctrl+Shift+P
or Cmd+Shift+P
) and selecting "Preferences: Open User Settings (JSON)".
Add the MCP server configuration to your settings.json
:
{ // ... other settings ... "mcp": { "servers": { "codealive": { "command": "uv", "args": [ "--directory", "/path/to/your/codealive-mcp", // Path to the MCP server project root "run", "python", "src/codealive_mcp_server.py", "--debug" // Optional: Enable debug logging ], "env": { "CODEALIVE_API_KEY": "YOUR_API_KEY_HERE" } } } } // ... other settings ... }
(Ensure this merges correctly with existing settings)
Restart VS Code. Ensure the GitHub Copilot extension is configured to potentially use MCP servers if required by its version/settings.
Open Cursor settings (Cmd+,
or Ctrl+,
).
Navigate to the "MCP" section in the left panel.
Click "Add new global MCP server".
Enter the following JSON configuration, updating paths and API key:
{ "mcpServers": { "codealive": { "command": "uv", "args": [ "--directory", "/path/to/your/codealive-mcp", // Path to the MCP server project root "run", "python", "src/codealive_mcp_server.py", "--debug" // Optional: Enable debug logging ], "env": { "CODEALIVE_API_KEY": "YOUR_API_KEY_HERE" } } } }
Save the configuration.
Restart Cursor completely.
If you prefer not to use uv
, you can invoke the server script directly using the Python interpreter from your virtual environment. Update the command
and args
in the client configurations accordingly.
{ "mcpServers": { "codealive": { "command": "/path/to/your/codealive-mcp/.venv/bin/python", // Full path to python in venv "args": [ "/path/to/your/codealive-mcp/src/codealive_mcp_server.py", "--debug" // Optional ], "env": { "CODEALIVE_API_KEY": "YOUR_API_KEY_HERE" } } } }
{ "mcpServers": { "codealive": { "command": "/path/to/your/codealive-mcp/.venv/bin/python", "args": [ "/path/to/your/codealive-mcp/src/codealive_mcp_server.py", "--debug" // Optional ], "env": { "CODEALIVE_API_KEY": "YOUR_API_KEY_HERE" } } } }
If the MCP server isn't working correctly with your AI client, follow these steps:
--debug
flag to the args
in your client's MCP configuration. This will print verbose logs from the MCP server itself to its standard output/error stream. Where this stream goes depends on how the client manages the MCP process.# Activate venv first! export CODEALIVE_API_KEY="YOUR_API_KEY_HERE" python src/codealive_mcp_server.py --debug --transport stdio
~/Library/Logs/Claude/mcp.log
and ~/Library/Logs/Claude/mcp-server-codealive.log
%LOCALAPPDATA%\Claude\Logs\mcp.log
and %LOCALAPPDATA%\Claude\Logs\mcp-server-codealive.log
(Path is typically C:\Users\YourUsername\AppData\Local\Claude\Logs
)Cmd+Shift+P
/ Ctrl+Shift+P
) -> Developer: Toggle Developer Tools
-> Console tab (for browser-level errors).View
-> Output
(or click Output
in the bottom panel). In the dropdown menu on the right side of the Output panel, look for a channel named CodeAlive
, MCP
, or related to the server process. This often contains the direct stdout/stderr from the MCP server if --debug
is enabled.Developer: Open Logs Folder
. Check files within, especially related to the main process or extension host.~/Library/Application Support/Cursor/logs/
%APPDATA%\Cursor\logs\
(Typically C:\Users\YourUsername\AppData\Roaming\Cursor\logs\
)Cmd+Shift+P
/ Ctrl+Shift+P
) -> Developer: Toggle Developer Tools
-> Console tab (for browser-level errors).View
-> Output
(or click Output
in the bottom panel). In the dropdown menu on the right side of the Output panel, look for a channel named CodeAlive
, MCP
, GitHub Copilot
, or Continue
. The MCP server logs (especially with --debug
) might be routed here.Developer: Show Logs...
-> Select Extension Host
from the dropdown. Look for errors related to Copilot or Continue extensions trying to communicate via MCP.Continue: Focus on Continue Console View
(requires enabling Continue: Enable Console
in settings). See Continue Troubleshooting Docs.command
, args
, and env
paths and values in your client's MCP configuration file. Ensure JSON/YAML syntax is correct.CODEALIVE_API_KEY
is correct.If problems persist, consider opening an issue on the CodeAlive MCP server repository (if available) with relevant logs and configuration details (masking your API key).
You can also contact our support team at [email protected] for further assistance.
This project is licensed under the MIT License - see the LICENSE file for details.