Skip to main content

MCP server for Cangjie programming language documentation

Project description

Cangjie MCP Server

仓颉编程语言的 MCP (Model Context Protocol) 服务器,提供文档搜索和代码智能功能。

功能

  • 文档搜索: 基于向量检索的仓颉语言文档搜索
  • 代码智能: 基于 LSP 的代码补全、跳转定义、查找引用等功能

安装

pip install cangjie-mcp

或使用 uvx 直接运行(推荐):

uvx cangjie-mcp  # 启动聚合服务器(包含文档搜索 + 代码智能)

快速配置

注意:LSP 功能需要已安装仓颉 SDK,请将 /path/to/cangjie-sdk 替换为实际路径,或设置 CANGJIE_HOME 环境变量。

Claude Code
claude mcp add \
  -e CANGJIE_PREBUILT_URL=https://github.com/Zxilly/cangjie-mcp/releases/download/prebuilt-v1.0.7-zh/cangjie-index-v1.0.7-zh.tar.gz \
  -e CANGJIE_RERANK_TYPE=local \
  -e CANGJIE_HOME=/path/to/cangjie-sdk \
  cangjie -- uvx cangjie-mcp
Cursor / Windsurf / Claude Desktop

配置文件路径:

  • Cursor: ~/.cursor/mcp.json
  • Windsurf: ~/.codeium/windsurf/mcp_config.json
  • Claude Desktop (macOS): ~/Library/Application Support/Claude/claude_desktop_config.json
  • Claude Desktop (Windows): %APPDATA%\Claude\claude_desktop_config.json
{
  "mcpServers": {
    "cangjie": {
      "command": "uvx",
      "args": ["cangjie-mcp"],
      "env": {
        "CANGJIE_PREBUILT_URL": "https://github.com/Zxilly/cangjie-mcp/releases/download/prebuilt-v1.0.7-zh/cangjie-index-v1.0.7-zh.tar.gz",
        "CANGJIE_RERANK_TYPE": "local",
        "CANGJIE_HOME": "/path/to/cangjie-sdk"
      }
    }
  }
}
VS Code (GitHub Copilot)

settings.json:

{
  "mcp": {
    "servers": {
      "cangjie": {
        "command": "uvx",
        "args": ["cangjie-mcp"],
        "env": {
          "CANGJIE_PREBUILT_URL": "https://github.com/Zxilly/cangjie-mcp/releases/download/prebuilt-v1.0.7-zh/cangjie-index-v1.0.7-zh.tar.gz",
          "CANGJIE_RERANK_TYPE": "local",
          "CANGJIE_HOME": "/path/to/cangjie-sdk"
        }
      }
    }
  }
}
Zed

~/.config/zed/settings.json:

{
  "context_servers": {
    "cangjie": {
      "command": {
        "path": "uvx",
        "args": ["cangjie-mcp"],
        "env": {
          "CANGJIE_PREBUILT_URL": "https://github.com/Zxilly/cangjie-mcp/releases/download/prebuilt-v1.0.7-zh/cangjie-index-v1.0.7-zh.tar.gz",
          "CANGJIE_RERANK_TYPE": "local",
          "CANGJIE_HOME": "/path/to/cangjie-sdk"
        }
      }
    }
  }
}

可用工具

文档搜索

工具名称 功能
cangjie_search_docs 语义搜索仓颉文档
cangjie_get_topic 获取指定主题的完整内容
cangjie_list_topics 列出所有可用主题
cangjie_get_code_examples 获取代码示例
cangjie_get_tool_usage 获取工具使用说明

代码智能

工具名称 功能
cangjie_lsp_definition 跳转到符号定义
cangjie_lsp_references 查找符号的所有引用
cangjie_lsp_hover 获取符号的类型信息和文档
cangjie_lsp_symbols 列出文档中的所有符号
cangjie_lsp_diagnostics 获取文件的错误和警告
cangjie_lsp_completion 获取代码补全建议

命令行参考

cangjie-mcp

默认启动聚合服务器,同时提供文档搜索和 LSP 代码智能功能。

Usage: cangjie-mcp [OPTIONS] COMMAND [ARGS]...

Options:
  -v, --version               Show version and exit
  -V, --docs-version TEXT     Documentation version [env: CANGJIE_DOCS_VERSION]
  -l, --lang TEXT             Documentation language (zh/en) [env: CANGJIE_DOCS_LANG]
  -e, --embedding TEXT        Embedding type (local/openai) [env: CANGJIE_EMBEDDING_TYPE]
  -r, --rerank TEXT           Rerank type (none/local/openai) [env: CANGJIE_RERANK_TYPE]
  -d, --data-dir PATH         Data directory path [env: CANGJIE_DATA_DIR]
  --help                      Show this message and exit.

Commands:
  docs   Documentation search MCP server (standalone)
  lsp    LSP code intelligence MCP server (standalone)

子命令

如果只需要单独功能,可以使用子命令:

cangjie-mcp docs  # 仅文档搜索
cangjie-mcp lsp   # 仅代码智能

许可证

MIT License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cangjie_mcp-0.2.0.tar.gz (292.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cangjie_mcp-0.2.0-py3-none-any.whl (82.3 kB view details)

Uploaded Python 3

File details

Details for the file cangjie_mcp-0.2.0.tar.gz.

File metadata

  • Download URL: cangjie_mcp-0.2.0.tar.gz
  • Upload date:
  • Size: 292.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.1

File hashes

Hashes for cangjie_mcp-0.2.0.tar.gz
Algorithm Hash digest
SHA256 0b0e6e97f90acb1a95c453bbd1247a95de145a94e75a0a37fb0aa03b405a56a2
MD5 fe58d2f46cf1cd3c86b5e56b85d20686
BLAKE2b-256 37f1fb50ce05ad276913dab297261ff68798956ef62a7501e8e865bfaa71c24d

See more details on using hashes here.

File details

Details for the file cangjie_mcp-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: cangjie_mcp-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 82.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.1

File hashes

Hashes for cangjie_mcp-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a032f73760c1d2371ef8b760cefa930fd515608616688c41c474057b9702f9bb
MD5 6a40d8de0ca1fa8ecc7b8a363efee3c6
BLAKE2b-256 439d0b69b8892f85b38238c85d0de554e818e3a657a678727adcca69fec5ec4b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page