CodeAlive MCP:为您的项目(尤其是大型代码库)提供最深入的上下文引擎

在几秒钟内将您的AI助手连接到CodeAlive强大的代码理解平台!
此MCP(模型上下文协议)服务器使Claude Code、Cursor、Claude Desktop、Continue、VS Code(GitHub Copilot)、Cline、Codex、OpenCode、Qwen Code、Gemini CLI、Roo Code、Goose、Kilo Code、Windsurf、Kiro、Qoder、n8n和Amazon Q Developer等AI客户端能够访问CodeAlive的高级语义代码搜索和代码库交互功能。
什么是CodeAlive?
最准确、最全面的上下文引擎即服务,针对大型代码库进行了优化,由先进的GraphRAG提供支持,可通过MCP访问。它丰富了Cursor、Claude Code、Codex等AI代理的上下文,使它们的效率提高了35%,速度提高了84%。
它类似于Context7,但适用于您的(大型)代码库。
它允许AI编码代理:
- 更快地找到相关代码 语义搜索
- 了解大局 超越孤立文件
- 提供更好的答案 具有完整的项目背景
- 减少成本和时间 通过消除猜测
🛠 可用工具
连接后,您将可以访问这些强大的工具:
get_data_sources-列出您的索引存储库和工作区semantic_search-跨索引工件的规范语义搜索grep_search-具有行级匹配的精确文本或正则表达式搜索fetch_artifacts-加载相关搜索结果的完整来源get_artifact_relationships-扩展一个工件的调用图、继承和引用关系chat-合成代码库问答速度较慢,通常仅在搜索后codebase_search-保留弃用的遗留语义搜索别名以实现向后兼容性codebase_consultant-已弃用的别名chat
🎯 使用示例
设置完成后,使用您的AI助手尝试以下命令:
- *“显示所有可用存储库”* → Uses
get_data_sources - *“在用户服务中查找身份验证码”* → Uses
semantic_search - *“查找与JWT令牌匹配的确切正则表达式”* → Uses
grep_search - *“解释支付流在此代码库中是如何工作的”* → 通常以
semantic_search/grep_search,然后可选择使用chat
semantic_search 和 grep_search 应该是大多数代理的默认工具。 chat 是一种较慢的合成回退,可能需要30秒,当代理可以运行包含搜索、获取、关系和本地文件读取的多步骤工作流时,通常是不必要的。如果您的代理支持子代理,那么最可靠的方法是委派一个专注的子代理来协调 semantic_search 和 grep_search 第一。
📚 代理技能
为了获得更好的体验,请安装 CodeAlive代理技能 在MCP服务器旁边。MCP服务器允许您的代理访问CodeAlive的工具;该技能教给它最好的工作流程和查询模式,以便有效地使用它们。
对于大多数代理商来说 (光标、复制、Gemini CLI、Codex和 30+其他)--安装技能:
npx skills add CodeAlive-AI/codealive-skills@codealive-context-engine克劳德代码 --安装插件(推荐),其中包括技能和克劳德特定的增强功能:
/plugin marketplace add CodeAlive-AI/codealive-skills
/plugin install codealive@codealive-marketplace目录
🚀 快速启动(远程)
最快的开始方式 -无需安装!我们的远程MCP服务器位于 https://mcp.codealive.ai/api 提供对CodeAlive功能的即时访问。
步骤1:获取API密钥
- 注册地址: https://app.codealive.ai/
- 导航到 MCP和API
- 点击 “+创建API密钥”
- 立即复制您的API密钥-您不会再看到它了!
第二步:选择你的AI客户端
在下面选择您首选的AI客户端进行即时设置:
🚀 快速启动(代理安装)
您可以要求您的AI代理为您安装CodeAlive MCP服务器。
- 复制-将以下提示粘贴到您的AI代理中(记住插入API密钥):
Here is CodeAlive API key: PASTE_YOUR_API_KEY_HERE
Add the CodeAlive MCP server by following the installation guide from the README at https://raw.githubusercontent.com/CodeAlive-AI/codealive-mcp/main/README.md
Find the section "AI Client Integrations" and locate your client (Claude Code, Cursor, Gemini CLI, etc.). Each client has specific setup instructions:
- For Gemini CLI: Use the one-command setup with `gemini mcp add`
- For Claude Code: Use `claude mcp add` with the --transport http flag
- For other clients: Follow the configuration snippets provided
Prefer the Remote HTTP option when available. If API key is not provided above, help me issue a CodeAlive API key first.然后允许执行。
- 重新启动AI代理。
🤖 AI客户端集成
Claude Code
选项1:远程HTTP(推荐)
claude mcp add --transport http codealive https://mcp.codealive.ai/api --header "Authorization: Bearer YOUR_API_KEY_HERE"选项2:Docker(STDIO)
claude mcp add codealive-docker /usr/bin/docker run --rm -i -e CODEALIVE_API_KEY=YOUR_API_KEY_HERE ghcr.io/codealive-ai/codealive-mcp:main替换 YOUR_API_KEY_HERE 使用您的实际API密钥。
Cursor
选项1:远程HTTP(推荐)
- 打开的游标→ 设置(
Cmd+,或Ctrl+,) - 导航到 “工具和MCP” 在左侧面板中(旧版本称为 “工具和集成”)
- 点击 “新建MCP服务器”
- 粘贴此配置:
{
"mcpServers": {
"codealive": {
"url": "https://mcp.codealive.ai/api",
"headers": {
"Authorization": "Bearer YOUR_API_KEY_HERE"
}
}
}
}- 保存--Cursor会自动重新加载服务器。条目存储在
.cursor/mcp.json(项目)或~/.cursor/mcp.json(全球)。
提示: Cursor还支持一键安装deeplink-- cursor://anysphere.cursor-deeplink/mcp/install?name=codealive&config=BASE64_CONFIG。只关注来自可信来源的深度链接。选项2:Docker(STDIO)
{
"mcpServers": {
"codealive": {
"command": "docker",
"args": [
"run", "--rm", "-i",
"-e", "CODEALIVE_API_KEY=YOUR_API_KEY_HERE",
"ghcr.io/codealive-ai/codealive-mcp:main"
]
}
}
}Codex (CLI, App, IDE Extension)
OpenAI Codex以三种形状因子发货 共享相同的配置:the Codex CLI,the Codex应用程序 (macOS/Windows),以及 Codex IDE扩展 (VS代码 openai.chatgpt JetBrains 2025.3+)。三读 ~/.codex/config.toml,所以一个片段覆盖了每个Codex表面。项目级别 .codex/config.toml 在repo中,受信任的项目也支持根。
选项1:添加一行(推荐)
codex mcp add codealive --url https://mcp.codealive.ai/api然后打开 ~/.codex/config.toml 并添加承载令牌引用和Streamable HTTP特征标志:
[features]
rmcp_client = true
[mcp_servers.codealive]
url = "https://mcp.codealive.ai/api"
bearer_token_env_var = "CODEALIVE_API_KEY"最后,导出密钥:
export CODEALIVE_API_KEY="YOUR_API_KEY_HERE"证实 codex mcp list.
注: 流式HTTP需要[features].rmcp_client = true.旧的顶级experimental_use_rmcp_client = true标志已弃用。bearer_token_env_var优于内联headers = { Authorization = "Bearer …" }因为它将秘密隐藏在配置文件之外。
选项2:内联标头(HTTP)
[features]
rmcp_client = true
[mcp_servers.codealive]
url = "https://mcp.codealive.ai/api"
headers = { Authorization = "Bearer YOUR_API_KEY_HERE" }选项3:Docker(STDIO)
[mcp_servers.codealive]
command = "docker"
args = ["run", "--rm", "-i", "ghcr.io/codealive-ai/codealive-mcp:main"]
env_vars = ["CODEALIVE_API_KEY"]export CODEALIVE_API_KEY="YOUR_API_KEY_HERE"不 [features] stdio需要标志。 env_vars 从父shell转发值——比将密钥嵌入更安全 args.
Codex应用程序用户界面: 设置→ MCP服务器→ 添加服务器。UI写的内容相同 ~/.codex/config.toml 进入。CLI和IDE扩展会自动拾取它。
Gemini CLI
一个命令设置(完成):
gemini mcp add --transport http secure-http https://mcp.codealive.ai/api --header "Authorization: Bearer YOUR_API_KEY_HERE"替换 YOUR_API_KEY_HERE 使用您的实际API密钥。就是这样-不需要配置文件! 🎉
Continue
选项1:远程HTTP(推荐)
- 创建/编辑
.continue/config.yaml在您的项目或~/.continue/config.yaml - 添加此配置:
mcpServers:
- name: CodeAlive
type: streamable-http
url: https://mcp.codealive.ai/api
requestOptions:
headers:
Authorization: "Bearer YOUR_API_KEY_HERE"- 重新启动VS代码
选项2:Docker(STDIO)
mcpServers:
- name: CodeAlive
type: stdio
command: docker
args:
- run
- --rm
- -i
- -e
- CODEALIVE_API_KEY=YOUR_API_KEY_HERE
- ghcr.io/codealive-ai/codealive-mcp:mainVisual Studio Code with GitHub Copilot
选项1:远程HTTP(推荐)
注: VS Code支持Streamable HTTP和SSE传输,如果Streamable HTTP失败,则自动回退到SSE。
- 打开命令选项板(
Ctrl+Shift+P或Cmd+Shift+P) - 跑 “MCP:添加服务器”
- 选择 “HTTP” 服务器类型
- 输入此配置:
{
"servers": {
"codealive": {
"type": "http",
"url": "https://mcp.codealive.ai/api",
"headers": {
"Authorization": "Bearer YOUR_API_KEY_HERE"
}
}
}
}- 重新启动VS代码
选项2:Docker(STDIO)
创建 .vscode/mcp.json 在您的工作空间中:
{
"servers": {
"codealive": {
"command": "docker",
"args": [
"run", "--rm", "-i",
"-e", "CODEALIVE_API_KEY=YOUR_API_KEY_HERE",
"ghcr.io/codealive-ai/codealive-mcp:main"
]
}
}
}Claude Desktop
选项1:扩展包 .mcpb (推荐)
这 .mcpb bundle为您提供一键安装、安全令牌存储和自托管 baseUrl 配置——不需要Docker或CLI。
- 下载
codealive-mcp.mcpb从 - 在Claude Desktop中,打开 设置→ 扩展→ 安装扩展。..
- 选择已下载的
.mcpb文件和配置:
- CodeAlive API密钥:您的持票人代币 - Codealive基本URL:默认为 https://app.codealive.ai;对于自托管,请使用您的部署源(例如。 https://codealive.yourcompany.com) - 忽略TLS错误:仅适用于开发/自签名环境
选项2:Docker(STDIO)
- 编辑您的配置文件:
- macOS: ~/Library/Application Support/Claude/claude_desktop_config.json - 窗户: %APPDATA%\Claude\claude_desktop_config.json
- 添加此配置:
{
"mcpServers": {
"codealive": {
"command": "docker",
"args": [
"run", "--rm", "-i",
"-e", "CODEALIVE_API_KEY=YOUR_API_KEY_HERE",
"ghcr.io/codealive-ai/codealive-mcp:main"
]
}
}
}- 重新启动克劳德桌面
Cline
选项1:远程HTTP(推荐)
- 在VS Code中打开Cline扩展
- 单击MCP服务器图标进行配置
- 将此配置添加到MCP设置中:
{
"mcpServers": {
"codealive": {
"url": "https://mcp.codealive.ai/api",
"headers": {
"Authorization": "Bearer YOUR_API_KEY_HERE"
}
}
}
}- 保存并重新启动VS Code
选项2:Docker(STDIO)
{
"mcpServers": {
"codealive": {
"command": "docker",
"args": [
"run", "--rm", "-i",
"-e", "CODEALIVE_API_KEY=YOUR_API_KEY_HERE",
"ghcr.io/codealive-ai/codealive-mcp:main"
]
}
}
}OpenCode
将CodeAlive添加为 远程 您的MCP服务器 opencode.json.
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"codealive": {
"type": "remote",
"url": "https://mcp.codealive.ai/api",
"enabled": true,
"headers": {
"Authorization": "Bearer YOUR_API_KEY_HERE"
}
}
}
}Qwen Code
Qwen Code通过以下方式支持MCP mcpServers 在其中 settings.json 以及多种传输方式(stdio/SSE/可流式传输http)。使用 可流式传输http 如果可用;否则使用Docker(stdio)。
~/.qwen/settings.json (流式HTTP)
{
"mcpServers": {
"codealive": {
"type": "streamable-http",
"url": "https://mcp.codealive.ai/api",
"requestOptions": {
"headers": {
"Authorization": "Bearer YOUR_API_KEY_HERE"
}
}
}
}
}回退:Docker(stdio)
{
"mcpServers": {
"codealive": {
"type": "stdio",
"command": "docker",
"args": ["run", "--rm", "-i",
"-e", "CODEALIVE_API_KEY=YOUR_API_KEY_HERE",
"ghcr.io/codealive-ai/codealive-mcp:main"]
}
}
}Roo Code
Roo Code读取类似于Cline的JSON设置文件。
全局配置: mcp_settings.json (Roo)或 cline_mcp_settings.json (Cline风格)
选项A——远程HTTP
{
"mcpServers": {
"codealive": {
"type": "streamable-http",
"url": "https://mcp.codealive.ai/api",
"headers": {
"Authorization": "Bearer YOUR_API_KEY_HERE"
}
}
}
}选项B——Docker(STDIO)
{
"mcpServers": {
"codealive": {
"type": "stdio",
"command": "docker",
"args": [
"run", "--rm", "-i",
"-e", "CODEALIVE_API_KEY=YOUR_API_KEY_HERE",
"ghcr.io/codealive-ai/codealive-mcp:main"
]
}
}
}提示: 如果您的Roo构建不支持HTTP标头,请使用Docker/STDIO选项。
Goose
UI路径: 设置→ MCP服务器→ Add → 选择流式HTTP
流式HTTP配置:
- 姓名:
codealive - 终结点URL:
https://mcp.codealive.ai/api - 标题:
Authorization: Bearer YOUR_API_KEY_HERE
Docker(STDIO)替代方案:
添加STDIO扩展名:
- 命令:
docker - Args:
run --rm -i -e CODEALIVE_API_KEY=YOUR_API_KEY_HERE ghcr.io/codealive-ai/codealive-mcp:main
Kilo Code
UI路径: 管理→ 集成→ 模型上下文协议(MCP)→ 添加服务器
超文本传输协议
{
"mcpServers": {
"codealive": {
"type": "streamable-http",
"url": "https://mcp.codealive.ai/api",
"headers": {
"Authorization": "Bearer YOUR_API_KEY_HERE"
}
}
}
}STDIO(Docker)
{
"mcpServers": {
"codealive": {
"type": "stdio",
"command": "docker",
"args": [
"run", "--rm", "-i",
"-e", "CODEALIVE_API_KEY=YOUR_API_KEY_HERE",
"ghcr.io/codealive-ai/codealive-mcp:main"
]
}
}
}Windsurf (Codeium)
文件: ~/.codeium/windsurf/mcp_config.json
{
"mcpServers": {
"codealive": {
"type": "streamable-http",
"serverUrl": "https://mcp.codealive.ai/api",
"headers": {
"Authorization": "Bearer YOUR_API_KEY_HERE"
}
}
}
}Kiro
注: Kiro尚未原生支持远程MCP服务器。使用 mcp-remote 连接到远程HTTP服务器的解决方法。先决条件:
npm install -g mcp-remoteUI路径: 设置→ MCP → 添加服务器
全局文件: ~/.kiro/settings/mcp.json 工作空间文件: .kiro/settings/mcp.json
远程HTTP(通过mcp远程解决方法)
{
"mcpServers": {
"codealive": {
"type": "stdio",
"command": "npx",
"args": [
"mcp-remote",
"https://mcp.codealive.ai/api",
"--header",
"Authorization: Bearer ${CODEALIVE_API_KEY}"
],
"env": {
"CODEALIVE_API_KEY": "YOUR_API_KEY_HERE"
}
}
}
}Docker(STDIO)
{
"mcpServers": {
"codealive": {
"type": "stdio",
"command": "docker",
"args": [
"run", "--rm", "-i",
"-e", "CODEALIVE_API_KEY=YOUR_API_KEY_HERE",
"ghcr.io/codealive-ai/codealive-mcp:main"
]
}
}
}Qoder
UI路径: 用户图标→ Qoder设置→ MCP → 我的服务器→ + 添加(代理模式)
SSE(远程HTTP)
{
"mcpServers": {
"codealive": {
"type": "sse",
"url": "https://mcp.codealive.ai/api",
"headers": {
"Authorization": "Bearer YOUR_API_KEY_HERE"
}
}
}
}STDIO(Docker)
{
"mcpServers": {
"codealive": {
"type": "stdio",
"command": "docker",
"args": [
"run", "--rm", "-i",
"-e", "CODEALIVE_API_KEY=YOUR_API_KEY_HERE",
"ghcr.io/codealive-ai/codealive-mcp:main"
]
}
}
}Amazon Q Developer (CLI & IDE)
Q开发人员CLI
配置文件: ~/.aws/amazonq/mcp.json 或工作空间 .amazonq/mcp.json
HTTP服务器
{
"mcpServers": {
"codealive": {
"type": "http",
"url": "https://mcp.codealive.ai/api",
"headers": {
"Authorization": "Bearer YOUR_API_KEY_HERE"
}
}
}
}STDIO(Docker)
{
"mcpServers": {
"codealive": {
"type": "stdio",
"command": "docker",
"args": [
"run", "--rm", "-i",
"-e", "CODEALIVE_API_KEY=YOUR_API_KEY_HERE",
"ghcr.io/codealive-ai/codealive-mcp:main"
]
}
}
}Q开发人员IDE(VS代码/JetBrains)
全球的: ~/.aws/amazonq/agents/default.json 本地(工作区): .aws/amazonq/agents/default.json
最小条目(HTTP):
{
"mcpServers": {
"codealive": {
"type": "http",
"url": "https://mcp.codealive.ai/api",
"headers": {
"Authorization": "Bearer YOUR_API_KEY_HERE"
},
"timeout": 310000
}
}
}使用IDE UI:Q面板→ Chat → 工具图标→ 添加MCP服务器→ 选择http或stdio。
JetBrains AI Assistant
注: JetBrains AI助手需要 mcp-remote 连接到远程HTTP MCP服务器的解决方法。先决条件:
npm install -g mcp-remote配置文件: 设置/首选项→ AI助手→ 模型上下文协议→ 配置
添加此配置:
{
"mcpServers": {
"codealive": {
"command": "npx",
"args": [
"mcp-remote",
"https://mcp.codealive.ai/api",
"--header",
"Authorization: Bearer ${CODEALIVE_API_KEY}"
],
"env": {
"CODEALIVE_API_KEY": "YOUR_API_KEY_HERE"
}
}
}
}用于自托管部署,替换URL:
{
"mcpServers": {
"codealive": {
"command": "npx",
"args": [
"mcp-remote",
"http://your-server:8000/api",
"--header",
"Authorization: Bearer ${CODEALIVE_API_KEY}"
],
"env": {
"CODEALIVE_API_KEY": "YOUR_API_KEY_HERE"
}
}
}
}看 JetBrains MCP文档 了解更多详情。
n8n
使用MCP工具使用AI代理节点
- 添加一个 AI 代理 节点到工作流
- 使用MCP工具配置代理:
Server URL: https://mcp.codealive.ai/api
Authorization Header: Bearer YOUR_API_KEY_HERE- 服务器自动处理n8n的额外参数(sessionId、action、chatInput、toolCallId)
- 使用可用工具:
- get_data_sources -列出可用存储库 - semantic_search -语义搜索代码 - grep_search -按精确文本或正则表达式搜索 - get_artifact_relationships -扩展一个工件的关系 - chat -通常在搜索后,合成代码库问答速度较慢 - codebase_search -遗留语义搜索别名 - codebase_consultant -已弃用的别名 chat
工作流程示例:
Trigger → AI Agent (with CodeAlive MCP tools) → Process Response注: n8n中间件是内置的,因此不需要特殊的配置。服务器将在处理工具调用之前自动删除n8n的额外参数。
______________________________________________________________________
🔧 高级:地方发展
适用于想要定制或为MCP服务器做出贡献的开发人员。
先决条件
- Python 3.11+
- 紫外线 (推荐)或pip
安装
# Clone the repository
git clone https://github.com/CodeAlive-AI/codealive-mcp.git
cd codealive-mcp
# Setup with uv (recommended)
uv venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
uv pip install -e .
# Or setup with pip
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install -e .本地服务器配置
在本地安装后,配置您的AI客户端以使用本地服务器:
克劳德代码(本地)
claude mcp add codealive-local /path/to/codealive-mcp/.venv/bin/python /path/to/codealive-mcp/src/codealive_mcp_server.py --env CODEALIVE_API_KEY=YOUR_API_KEY_HERE其他客户(本地)
替换Docker command 和 args 与:
{
"command": "/path/to/codealive-mcp/.venv/bin/python",
"args": ["/path/to/codealive-mcp/src/codealive_mcp_server.py"],
"env": {
"CODEALIVE_API_KEY": "YOUR_API_KEY_HERE"
}
}在本地运行HTTP服务器
# Start local HTTP server
export CODEALIVE_API_KEY="your_api_key_here"
python src/codealive_mcp_server.py --transport http --host localhost --port 8000
# Test health endpoint
curl http://localhost:8000/health测试本地安装
更改后,快速验证一切正常:
# Quick smoke test (recommended)
make smoke-test
# Or run directly
python smoke_test.py
# With your API key for full testing
CODEALIVE_API_KEY=your_key python smoke_test.py
# Run unit tests
make unit-test
# Run all tests
make test烟雾测试验证:
- 服务器启动并正确连接
- 所有工具均已注册
- 每个工具都会做出适当的响应
- 参数验证工作
- 运行约5秒
Smithery安装
通过以下方式自动安装Claude Desktop 史密瑟里:
npx -y @smithery/cli install @CodeAlive-AI/codealive-mcp --client claude______________________________________________________________________
🌐 社区插件
Gemini CLI——CodeAlive扩展
代表: https://github.com/akolotov/gemini-cli-codealive-extension
Gemini CLI扩展,通过预构建的斜线命令和MCP配置将CodeAlive连接到您的终端。它包括:
GEMINI.md指南,使Gemini知道如何有效地使用CodeAlive工具- Slash命令:
/codealive:chat,/codealive:find,/codealive:search - 通过Gemini CLI的扩展系统轻松设置
安装
gemini extensions install https://github.com/akolotov/gemini-cli-codealive-extension配置
# Option 1: .env next to where you run `gemini`
CODEALIVE_API_KEY="your_codealive_api_key_here"
# Option 2: environment variable
export CODEALIVE_API_KEY="your_codealive_api_key_here"
gemini______________________________________________________________________
🚢 HTTP部署(自托管和云)
将MCP服务器部署为HTTP服务,以便在团队范围内访问或与自托管的CodeAlive实例集成。
部署选项
CodeAlive MCP服务器可以使用Docker部署为HTTP服务。这允许多个AI客户端连接到单个共享实例,并支持与自托管CodeAlive部署的集成。
Docker Compose(推荐)
创建一个 docker-compose.yml 基于我们的示例的文件:
# Download the example
curl -O https://raw.githubusercontent.com/CodeAlive-AI/codealive-mcp/main/docker-compose.example.yml
mv docker-compose.example.yml docker-compose.yml
# Edit configuration (see below)
nano docker-compose.yml
# Start the service
docker compose up -d
# Check health
curl http://localhost:8000/health配置选项:
- 对于CodeAlive Cloud(默认):
- 移除 CODEALIVE_BASE_URL 环境变量(使用默认值 https://app.codealive.ai) - 客户必须通过提供其API密钥 Authorization: Bearer YOUR_KEY 头球
- 对于自托管CodeAlive:
- 集 CODEALIVE_BASE_URL 到您的CodeAlive实例URL(例如。, https://codealive.yourcompany.com) - 客户必须通过提供其API密钥 Authorization: Bearer YOUR_KEY 头球
看 docker-compose.example.yml 获取完整的配置模板。
将AI客户端连接到已部署的实例
部署后,配置您的AI客户端以使用您的HTTP端点:
克劳德代码:
claude mcp add --transport http codealive http://your-server:8000/api --header "Authorization: Bearer YOUR_API_KEY_HERE"VS代码:
code --add-mcp "{\"name\":\"codealive\",\"type\":\"http\",\"url\":\"http://your-server:8000/api\",\"headers\":{\"Authorization\":\"Bearer YOUR_API_KEY_HERE\"}}"光标/其他客户端:
{
"mcpServers": {
"codealive": {
"url": "http://your-server:8000/api",
"headers": {
"Authorization": "Bearer YOUR_API_KEY_HERE"
}
}
}
}替换 your-server:8000 使用您的实际部署URL和端口。
______________________________________________________________________
🪟 Windows和WSL
Overview
Windows上的Claude Code在WSL(Linux的Windows子系统)中运行。Claude Desktop在Windows上本机运行。这在配置MCP服务器时带来了特定的挑战,尤其是在二进制路径、环境变量和网络方面。
Windows上Claude Code和Claude Desktop最简单的解决方案是远程HTTP --它完全避免了所有子流程生成和路径问题。
Claude Code in WSL
当Claude Code在WSL中运行时,它将作为正常的Linux环境运行。使用与Linux/macOS上相同的命令:
远程HTTP(推荐--避免所有WSL问题):
claude mcp add --transport http codealive https://mcp.codealive.ai/api --header "Authorization: Bearer YOUR_API_KEY_HERE"Docker STDIO(如果启用了Docker桌面WSL集成):
claude mcp add codealive-docker /usr/bin/docker run --rm -i -e CODEALIVE_API_KEY=YOUR_API_KEY_HERE ghcr.io/codealive-ai/codealive-mcp:main注: 如果docker未找到,请确保Docker Desktop已为您的发行版启用WSL集成,或使用完整路径/usr/bin/docker.
Claude Desktop on Windows (Docker STDIO)
Windows上的克劳德桌面 不能 直接连接到WSL内部运行的MCP服务器。使用以下方法之一:
选项1:Docker桌面(推荐)
如果Docker Desktop安装在Windows上, docker.exe 位于Windows路径中:
{
"mcpServers": {
"codealive": {
"command": "docker",
"args": [
"run", "--rm", "-i",
"-e", "CODEALIVE_API_KEY=YOUR_API_KEY_HERE",
"ghcr.io/codealive-ai/codealive-mcp:main"
]
}
}
}选项2:wsl.exe代理
如果Docker仅在WSL内部可用,请使用 wsl.exe 作为一座桥梁:
{
"mcpServers": {
"codealive": {
"command": "wsl.exe",
"args": [
"--", "docker", "run", "--rm", "-i",
"-e", "CODEALIVE_API_KEY=YOUR_API_KEY_HERE",
"ghcr.io/codealive-ai/codealive-mcp:main"
]
}
}
}Self-Hosted MCP Server in WSL2
如果在WSL2中运行MCP HTTP服务器并从Windows端客户端连接:
WSL2 NAT网络问题: 默认情况下, localhost 无法从Windows访问WSL2内部。两种解决方法:
- 启用镜像网络 (Windows 11 22H2+)--添加到
%USERPROFILE%\.wslconfig:
[wsl2]
networkingMode=mirrored然后重新启动WSL: wsl --shutdown在此之后, localhost 在Windows和WSL2之间共享。
- 使用WSL2虚拟机IP --奔跑
hostname -I在WSL内部获取IP,然后连接到http://:8000/api而不是http://localhost:8000/api.
Common WSL Pitfalls
| 问题 | 原因 | 修复 |
|---|---|---|
docker: command not found | Docker不在WSL PATH中 | 为您的发行版启用Docker Desktop WSL集成,或使用完整路径 /usr/bin/docker |
ENOENT / spawn error 为了 npx 或 python | 二进制不在非交互式shell PATH中 | 使用绝对路径(例如。, /home/user/.nvm/versions/node/v20/bin/npx) |
| 缺少环境变量 | WSL非登录shell没有源代码 .bashrc | 在MCP配置中显式添加变量 env 挡块 |
Connection refused 到自托管服务器 | WSL2 NAT隔离本地主机 | 启用镜像网络或使用WSL2 VM IP |
| Claude Desktop无法访问WSL MCP服务器 | Claude Desktop不支持WSL子进程生成 | 使用远程HTTP、Docker Desktop或 wsl.exe 代理 |
______________________________________________________________________
🐞 故障排除
快速诊断
- 测试托管服务:
curl https://mcp.codealive.ai/health- 检查您的API密钥:
curl -H "Authorization: Bearer YOUR_API_KEY" https://app.codealive.ai/api/v1/data_sources- 启用调试日志记录: 添加
--debug到本地服务器args
常见问题
- “连接被拒绝” → 检查互联网连接
- “401未经授权” → 验证您的API密钥
- “未找到存储库” → 检查CodeAlive仪表板中的API密钥权限
- 客户端特定日志 → 有关MCP日志,请参阅AI客户端的文档
Windows/WSL问题
docker: command not foundWSL → 为您的发行版启用Docker Desktop WSL集成(设置→ 资源→ WSL集成),或使用完整路径/usr/bin/dockerENOENT或spawn error为了npx/python→ 非交互式WSL shell不继承nvm/pyenv路径。在MCP配置中使用绝对路径Connection refused到WSL2中的自托管服务器 → WSL2使用NAT网络;localhostWindows和WSL2之间存在差异。在中启用镜像网络.wslconfig或使用WSL2 VM IP(hostname -I)- Claude Desktop无法连接到WSL MCP服务器 → Claude Desktop不支持WSL子进程生成。使用远程HTTP(
https://mcp.codealive.ai/api)Docker桌面或wsl.exe代理模式(请参见 Windows和WSL部分)
获取帮助
- 📧 电子邮件:support@codealive.ai
- 🐛 问题:
______________________________________________________________________
📦 发布到MCP注册表
对于维护人员:请参阅 部署.md 有关向MCP注册表发布新版本的说明。
______________________________________________________________________
隐私政策
CodeAlive处理您通过此扩展发送的存储库和查询,以提供语义搜索和代码库分析。有关完整的隐私详细信息,请参阅 CodeAlive隐私政策.
______________________________________________________________________
📄 许可证
MIT许可证-请参阅 许可证 文件以获取详细信息。
______________________________________________________________________
准备好用深入的代码理解来增强你的人工智能助手了吗?\ 立即开始→
