@ 后端kit- labs/ mcp- 服务器
MCP(模式上下文协议)服务器将代码智能,技能管理和项目上下文暴露为任何MCP相容的AI客户端(Claude Desktop,代理-core,Cursor等)的工具.
状态 :
stable——保持并做好生产准备. 在试验阶段没有新的特点.
目录
安装
npm install -g @backendkit-labs/mcp-server
# or use via npx:
npx @backendkit-labs/mcp-server
二进制 : bk-mcp
运行服务器
Stdio 模式( 默认—— 用于 Claude 桌面, 代理核心)
bk-mcp
# Against a specific project
BK_CWD=/my-project bk-mcp
# With a custom app name
BK_APP_NAME=my-app BK_CWD=/my-project bk-mcp
HTTP 模式( 多会话)
bk-mcp --http --port 3100
工具参考
stack_detect
使用文件检测和代码索引检测项目的技术堆栈.
Args:
cwd string? Project directory (defaults to server cwd)
示例
What stack does this project use?
→ stack_detect()
→ "Detected stack: typescript, node, react, docker"
code_index
将代码库索引为 SQLite 图表数据库。 递增式——只有再索引更改了文件.
Args:
cwd string? Project directory
watch boolean? Enable file watcher for live updates (default: false)
示例
Index this codebase
→ code_index({ watch: true })
→ "Indexed 234 files, 4,821 symbols. File watcher enabled."
被索引的内容 : 函数,类,接口,类型,来自TypeScript/JS/Go/Python/Java/Kotlin的enum. 每个符号(呼叫图)都记录有呼叫者和被呼叫者.
code_search
以名称或关键词搜索符号 .
Args:
query string Symbol name or keyword
limit number? Max results (default 20)
示例
Where is TokenValidator defined?
→ code_search({ query: "TokenValidator" })
→ "**TokenValidator** (class) — src/auth/token-validator.ts:15
class TokenValidator { validate(token: string): DecodedToken | null }"
模糊搜索 :
All functions related to payment
→ code_search({ query: "payment", limit: 30 })
→ PaymentProcessor, processPayment, validatePayment, createPaymentIntent, ...
code_context
鉴于任务描述,找到最相关的符号并返回他们的代码,呼叫者,被呼叫者. 没有手动读取文件的编码任务的靴子上下文 .
Args:
task string Task or feature description
max_symbols number? Max symbols (default 10)
示例
I need to add rate limiting to the login endpoint
→ code_context({ task: "add rate limiting to login endpoint" })
→
### loginHandler (function) — src/routes/auth.ts:67-89
> calledBy: router.post | calls: validateCredentials, createSession
\`\`\`typescript
async function loginHandler(req: Request, res: Response) {
const { email, password } = req.body;
...
}
\`\`\`
特工立即知道哪些文件和符号是相关的.
skills_search
通过查询搜索可用的技能 .
Args:
query string Search term
cwd string? Project directory for stack detection
示例
Find skills for TypeScript testing
→ skills_search({ query: "typescript testing" })
→ "- **ts-jest-setup** ✓ [global, typescript, ACTIVE]
Configure Jest for TypeScript with proper transforms
- **vitest-config** [node, typescript]
Set up Vitest for unit testing"
✓ 表示技能与检测到的堆栈相匹配.
skills_install
从 GitHub 或本地路径安装技能包 .
Args:
source string GitHub URL or local path
skill string? Install only a specific skill
pack string? Override the derived pack name
示例
Install our company skills repo
→ skills_install({ source: "https://github.com/my-org/agent-skills" })
→ "Installed pack "backend" with 12 skill(s)."
skills_list
列出所有已安装的技能包 .
Args: (none)
示例
What packs are installed?
→ skills_list()
→ "**global** (builtin)
Skills: code-review, refactor-pattern, ...
**my-org-backend** (installed 2026-06-01)
Skills: stripe-integration, postgres-pattern, ..."
代码情报索引
索引器使用 植树人 (WASM)将源代码解析为带有符号及其关系的 SQLite 图. 存储位置 :
~/.{BK_APP_NAME}/code-index/{base64url(CWD)}.db
默认 : ~/.deepseek-code/code-index/{hash}.db
所支持的语言: TypeScript, JavaScript, Go, Python, Java, Kotlin, Rust.
通过代理核心连接
import { createCodingEngine } from '@backendkit-labs/agent-coding';
const engine = createCodingEngine({
providers: { deepseek: { apiKey: process.env.DEEPSEEK_API_KEY! } },
defaultProvider: 'deepseek',
mcpServers: [
{
name: 'code-intelligence',
command: 'bk-mcp',
args: [],
env: {
BK_APP_NAME: 'my-app',
BK_CWD: process.cwd(),
},
},
],
subAgentContextMessages: 20,
});
// Index then query
await engine.run('Index this codebase');
await engine.run('Find all functions that directly access the database without using the repository layer');
通过 Claude 桌面连接
添加到您的 Claude 桌面配置 :
马可斯: ~/Library/Application Support/Claude/claude_desktop_config.json
窗口 : %APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"bk-code": {
"command": "bk-mcp",
"env": {
"BK_APP_NAME": "claude-code",
"BK_CWD": "/path/to/your/project"
}
}
}
}
重新启动克洛德桌面——工具会出现在取取取器中.
多个项目
{
"mcpServers": {
"bk-api": {
"command": "bk-mcp",
"env": { "BK_CWD": "/projects/api-server", "BK_APP_NAME": "claude-code" }
},
"bk-frontend": {
"command": "bk-mcp",
"env": { "BK_CWD": "/projects/frontend", "BK_APP_NAME": "claude-code" }
}
}
}
HTTP 模式
BK_CWD=/my-project bk-mcp --http --port 3100
连接 :
await mcp.connectStreamableHTTP({
name: 'code-intelligence',
baseUrl: 'http://localhost:3100',
});
环境变量
| 变量 | 默认 | 说明 |
|---|---|---|
BK_APP_NAME | deepseek-code | App 名称 - 决定 ~/.{name}/ 存储 |
BK_CWD | process.cwd() | 索引和服务的项目目录 |