Skip to main content
Glama
canonical-vault-mcp-server

canonical-vault-mcp-server

canonical-vault-mcp-server

只读 MCP 服务器,将 canonical-vault GitHub 仓库暴露给任何 MCP 客户端 —— GitHub Copilot、Claude,或任何支持 Streamable HTTP MCP 的客户端。

五个工具,全部只读,全部限定于 kushkillerjsixx66/canonical-vault:

工具

用途

vault_list_directory

列出指定路径下的文件/目录

vault_get_file

获取文件的解码后文本内容

vault_get_file_history

谱系 —— 指定路径的提交历史

vault_get_commit

单个提交的完整详情 + 差异统计

vault_search_files

跨仓库代码搜索

此服务器有意不包含任何写入工具 —— 这里没有任何东西可以提交、推送或修改 vault。


1. 部署到 Vercel

npm install -g vercel   # if you don't have it
cd canonical-vault-mcp-server
vercel login
vercel

接受默认设置(Vercel 会自动将 api/mcp.ts 检测为 Node 无服务器函数)。运行 vercel --prod 后,你会得到一个类似这样的 URL:

https://canonical-vault-mcp-server.vercel.app

你的 MCP 端点是:

https://canonical-vault-mcp-server.vercel.app/api/mcp

环境变量(在 Vercel 控制台 → 设置 → 环境变量中设置)

变量

必需

默认值

备注

GITHUB_TOKEN

强烈建议

无

具有 repo(或仅 public_repo,因为 vault 是公开的)读取权限的 GitHub PAT。没有它,你将被限制为 60 次/小时的 GitHub API 请求,且由所有调用者共享;有了它,则为 5000 次/小时。

GITHUB_OWNER

否

kushkillerjsixx66

仅在仓库迁移时更改

GITHUB_REPO

否

canonical-vault

仅在仓库重命名时更改

GITHUB_DEFAULT_REF

否

main

未提供 ref 时工具读取的默认分支

添加环境变量后,重新部署(vercel --prod),以便函数读取到它们。


Related MCP server: GitHub MCP

2. 将 GitHub Copilot 连接到它

Copilot(在 VS Code 中,以及 Copilot 编码代理)会从工作区中的 .vscode/mcp.json 或 VS Code 的全局 MCP 设置中读取 MCP 服务器配置。添加:

{
  "servers": {
    "canonical-vault": {
      "type": "http",
      "url": "https://canonical-vault-mcp-server.vercel.app/api/mcp"
    }
  }
}

然后在 VS Code 中:命令面板 → "MCP: List Servers" → canonical-vault → 启动。Copilot Chat 会自动识别这五个 vault_* 工具,并可在代理模式下调用它们。

对于 Copilot 的远程编码代理(非 VS Code 本地),同一个 URL 可以注册到 github.com 上你组织的 MCP 服务器设置中,无论你的套餐中 Copilot 代理 MCP 配置位于何处 —— 这部分由 GitHub 负责,与本服务器无关。


3. 本地测试(部署之前)

npm install
npm run build
npx @modelcontextprotocol/inspector node dist/index.js

这会打开 MCP Inspector UI,你可以在将 Copilot 接入之前,针对实时仓库手动调用每个工具。

要在本地测试 HTTP 路径而不是 stdio:

npm install -g vercel
vercel dev
# endpoint: http://localhost:3000/api/mcp

设计选择说明

  • 无状态按请求传输:api/mcp.ts 在每次 POST 时都会创建一个全新的 McpServer + StreamableHTTPServerTransport。这是无服务器架构的正确模式 —— Vercel 函数在调用之间不会保留内存,因此无需维护会话,而且可以避免两个调用者同时访问端点时发生请求 ID 冲突。

  • 谱系 = 提交历史,而非自定义概念 —— vault_get_file_history 实际上就是 GET /commits?path=...,这是将"谱系"映射到 GitHub API 实际提供能力的最忠实方式。如果你的 vault 谱系链概念(治理/vault 流水线)需要更具体的内容 —— 例如读取位于仓库内的谱系清单文件 —— 那么更好的做法是让 vault_get_file 直接指向该清单,而不是由我们重新实现 git 历史。

  • 按你的要求设计为只读 —— 此服务器无法写入 canonical-vault。如果你之后希望 Copilot 提交回写(例如通过 PR),那需要单独一套带有真正破坏性操作审查的写入工具,而不是悄悄附加的功能。

  • 搜索注意事项:GitHub 的代码搜索 API 只索引默认分支,并且有自身的传播延迟 —— 几秒前刚提交的文件可能还不会出现在 vault_search_files 中。vault_get_file 和 vault_list_directory 始终反映实时文件树。

Available Tools

5 tools
vault_get_commitGet Vault Commit DetailA
Read-onlyIdempotent

Get full detail for a single commit in canonical-vault: message, author, stats, and the list of files it changed (with per-file diff stats).

Args:

  • sha (string): Full or abbreviated commit SHA (get one from vault_get_file_history)

  • response_format ('markdown' | 'json'): Output format (default: 'markdown')

Returns: For JSON format: { "sha": string, "message": string, "author": string, "date": string, "stats": {...}, "files": [{ "filename": string, "status": string, "additions": number, "deletions": number }] }

Examples:

  • Use when: "What exactly changed in commit a1b2c3d?" -> sha="a1b2c3d"

  • Don't use when: You just want the commit list for a path (use vault_get_file_history instead)

Error Handling:

  • Returns "Error: ... not found" if the SHA doesn't exist in this repo

Inputs: sha (required), response_format.

vault_get_fileGet Vault FileA
Read-onlyIdempotent

Fetch the decoded text content of a single file from the canonical-vault repository (kushkillerjsixx66/canonical-vault).

Args:

  • path (string): File path relative to repo root, e.g. 'governance/CONSTITUTION.md'

  • ref (string): Branch, tag, or commit SHA (default: 'main')

Returns: The raw file text, prefixed with a small header (path, ref, sha, size). Binary or oversized files (> 500000 bytes) return an error instead of garbled content.

Examples:

  • Use when: "Read me the current Constitution" -> path="governance/CONSTITUTION.md"

  • Use when: "What does vara.py look like right now?" -> path="vara.py"

  • Don't use when: You just want to know if a file exists or how big it is (use vault_list_directory instead)

Error Handling:

  • Returns "Error: ... not found" if the path doesn't exist on that ref

  • Returns an error for directories (use vault_list_directory instead) or binary files

Inputs: path (required), ref.

vault_get_file_historyGet Vault File/Path LineageA
Read-onlyIdempotent

Get the commit lineage (history) affecting a file or directory in canonical-vault — i.e. every commit that touched that path, most recent first.

Args:

  • path (string): File or directory path to trace (default: "" for whole-repo history)

  • ref (string): Branch, tag, or commit SHA to start from (default: 'main')

  • limit (number): Max commits to return, 1-100 (default: 20)

  • offset (number): Commits to skip for pagination (default: 0)

  • response_format ('markdown' | 'json'): Output format (default: 'markdown')

Returns: For JSON format: { "path": string, "count": number, "commits": [{ "sha": string, "message": string, "author": string, "date": string, "url": string }], "has_more": boolean }

Examples:

  • Use when: "How has VARA_SPEC_1.0 evolved?" -> path="system-specs/VARA_SPEC_1.0.md"

  • Use when: "What's the recent commit lineage for the whole vault?" -> path=""

  • Don't use when: You need the full diff of one specific commit (use vault_get_commit instead)

Error Handling:

  • Returns "Error: ... not found" if the path or ref doesn't exist

Inputs: ref, path, limit, offset, +1 more.

vault_list_directoryList Vault DirectoryA
Read-onlyIdempotent

List the files and subdirectories at a given path in the canonical-vault repository (kushkillerjsixx66/canonical-vault).

Args:

  • path (string): Directory path relative to repo root (default: "" for root)

  • ref (string): Branch, tag, or commit SHA (default: 'main')

  • response_format ('markdown' | 'json'): Output format (default: 'markdown')

Returns: For JSON format: { "path": string, "ref": string, "entries": [{ "name": string, "path": string, "type": "file"|"dir", "size": number }] }

Examples:

  • Use when: "What's in the governance directory?" -> path="governance"

  • Use when: "Show me the top-level structure of the vault" -> path=""

  • Don't use when: You need the actual contents of a file (use vault_get_file instead)

Error Handling:

  • Returns "Error: ... not found" if the path doesn't exist on that ref

  • Returns a rate limit message if GitHub's API limit is exceeded (set GITHUB_TOKEN to raise it)

Inputs: ref, path, response_format.

vault_search_filesSearch Vault FilesA
Read-onlyIdempotent

Search file names and contents across the canonical-vault repository (kushkillerjsixx66/canonical-vault) using GitHub code search.

Args:

  • query (string): Search terms. Supports GitHub code search qualifiers like 'path:governance' or 'extension:md'

  • limit (number): Max results, 1-50 (default: 20)

  • offset (number): Results to skip for pagination (default: 0)

  • response_format ('markdown' | 'json'): Output format (default: 'markdown')

Returns: For JSON format: { "total": number, "count": number, "results": [{ "path": string, "url": string }], "has_more": boolean }

Examples:

  • Use when: "Where is Coherence defined?" -> query="Coherence path:governance"

  • Use when: "Find every mention of vara.py" -> query="vara.py"

  • Don't use when: You already know the exact path (use vault_get_file instead)

Error Handling:

  • Returns "No files found matching ''" if the search returns empty

  • GitHub code search only indexes the default branch and repos under ~size limits; very new commits may lag briefly

Inputs: query (required), limit, offset, response_format.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4.7/5.0

    Scored across 5 tools

    Disambiguation5/5

    Each tool has a distinctly separate purpose: listing a directory, reading a file, tracing commit history, inspecting a single commit, and searching the repository. The descriptions even include explicit 'Don't use when' guidance to prevent confusion.

    Naming Consistency5/5

    All tools follow a uniform `vault_` prefix with a verb_noun pattern (list_directory, get_file, get_file_history, get_commit, search_files). Naming is idiomatic, consistent, and immediately signals the action and target.

    Tool Count5/5

    Five tools is a well-scoped set for a read-only repository browsing server. Each tool covers a core operation without redundancy or bloat, making the surface easy to grasp and use.

    Completeness5/5

    For a read-only vault browsing use case, the set fully covers the necessary operations: navigating (list), reading content (get file), exploring change history (history/commit), and searching. There are no obvious missing capabilities that would block an agent.

    Maintenance

    ActivitySlowing
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers