Metadata-Version: 2.4
Name: codekb-mcp
Version: 0.1.0
Summary: CodeKB Search MCP Server — AI Agent 代码知识库检索服务
Project-URL: Homepage, https://github.com/your-org/codekb
Project-URL: Repository, https://github.com/your-org/codekb
Project-URL: Issues, https://github.com/your-org/codekb/issues
License-Expression: MIT
License-File: LICENSE
Keywords: ai-agent,code-retrieval,code-search,codekb,mcp
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Software Development :: Libraries
Requires-Python: >=3.11
Requires-Dist: httpx>=0.27
Requires-Dist: mcp[cli]>=1.0.0
Description-Content-Type: text/markdown

# CodeKB Search MCP Server

AI Agent 代码知识库检索服务 — 通过 MCP 协议将代码检索能力接入 Claude Code / OpenCode / Codex 等 AI 终端。

## 安装

```bash
# 推荐：uvx 自动拉取运行，无需预装
uvx codekb-mcp

# 或 pip 安装
pip install codekb-mcp
```

## 配置

### 环境变量

| 变量 | 默认值 | 说明 |
|------|--------|------|
| `CODEKB_API_URL` | `http://localhost:8000/api/v1` | CodeKB API 地址 |

### OpenCode (opencode.json)

```json
{
  "mcp": {
    "codekb-search": {
      "type": "local",
      "command": ["uvx", "codekb-mcp"],
      "enabled": true,
      "environment": {
        "CODEKB_API_URL": "http://your-server:8000/api/v1"
      }
    }
  }
}
```

### Claude Code (.mcp.json)

```json
{
  "mcpServers": {
    "codekb-search": {
      "command": "uvx",
      "args": ["codekb-mcp"],
      "env": {
        "CODEKB_API_URL": "http://your-server:8000/api/v1"
      }
    }
  }
}
```

### Codex (.codex/config.toml)

```toml
[mcp_servers.codekb-search]
command = "uvx"
args = ["codekb-mcp"]
env = { CODEKB_API_URL = "http://your-server:8000/api/v1" }
enabled = true
startup_timeout_sec = 30
```

## 可用工具

| 工具 | 说明 |
|------|------|
| `codekb_list_repos` | 列出可用仓库 |
| `codekb_get_repo_card` | 仓库导航卡片（首次必调） |
| `codekb_search` | 多路代码检索 (<200ms) |
| `codekb_symbol_search` | 符号搜索 |
| `codekb_graph_expand` | 调用链扩展 |
| `codekb_graph_path` | 调用路径查询 |
| `codekb_file_knowledge` | 文件级知识 |

## 使用流程

1. `codekb_list_repos` → 了解有哪些仓库
2. `codekb_get_repo_card` → 获取仓库结构、业务域、可用过滤条件
3. `codekb_search` → 按语义/代码/结构/关键词多路检索
4. `codekb_graph_expand` / `codekb_graph_path` → 追踪调用链
5. `codekb_file_knowledge` → 深入了解文件设计

## License

MIT