Skip to main content

AIS MCP

GitHub 仓库

TorchV AIS 知识库 MCP Server,提供 读 / 写 / 修改 / 文件传输 四类工具,直接操作 AIS 企业知识库。

特性

  • 统一访问 AIS 知识库
  • 完整 MCP 工具链(读 / 写 / 管理)
  • 支持 npx 一键启动
  • 同时支持 STDIO / HTTP 两种模式
  • 权限分级(readonly / write / admin)

安装与运行

npx -y @torchv-team/ais-mcp

必填配置

启动前需要设置以下环境变量:

export KB_EXECUTE_URL="https://bot.torchv.com"
export KB_TOKEN="your-token"

获取 KB_EXECUTE_URL

获取方式:

  1. 打开你正在使用的 AIS 页面
  2. 从浏览器地址栏复制网址

示例:

https://bot.torchv.com

获取 KB_TOKEN

推荐方式:

AIS → 管理中心 → 开放密钥 → 创建密钥

临时方式(不推荐长期使用):

浏览器开发者工具 → Network → 找到请求 → 复制 token

可选配置

export KB_MODE="readonly"   # readonly | write | admin
export KB_TIMEOUT_SECONDS="30"
export KB_DEFAULT_REPO_CODE="TEAM_DOCS"
export KB_EXTRA_HEADERS_JSON='{"x-foo":"bar"}'

权限说明

  • readonly:只读
  • write:允许写入 / 上传 / 发布
  • admin:允许移动 / 删除(最高权限)

启动方式

STDIO 模式(本地客户端)

npm run build
node dist/cli.js

或:

npm run dev
npm run start

Streamable HTTP 模式

npm run build
node dist/cli.js --transport streamable-http --host 127.0.0.1 --port 3000 --path /mcp

或:

npm run dev:http
npm run start:http

参数说明:

--transport streamable-http
--host 127.0.0.1
--port 3000
--path /mcp

Claude / Codex 配置示例

STDIO 模式

{
"mcpServers": {
"ais": {
"command": "npx",
"args": ["-y", "@torchv-team/ais-mcp"],
"env": {
"KB_EXECUTE_URL": "https://bot.torchv.com",
"KB_TOKEN": "your-token",
"KB_MODE": "readonly"
}
}
}
}

HTTP 模式

{
"mcpServers": {
"ais-http": {
"type": "streamable-http",
"url": "http://127.0.0.1:3000/mcp"
}
}
}

工具列表

Readonly

工具名说明
kb_list_repos列出仓库
kb_list_path列出路径内容
kb_tree树形展示目录
kb_search搜索文档
kb_read_document读取文档
kb_render_link渲染链接
kb_download_file下载文件
kb_get_download_link获取下载链接

Write

工具名说明
kb_write_document写入文档
kb_patch_documentPatch 修改文档
kb_create_directory创建目录
kb_copy_document复制文档
kb_publish_document发布文档
kb_upload_file上传文件

Admin

工具名说明
kb_move_document移动文档
kb_delete_document删除文档