Token导航 LogoToken导航TokenDH.com
Git Doc MCP logo
运维云端stdio官方级别未说明来源级核验

Git Doc MCP

MCP Server

git-doc-mcp

git-doc-mcp是一个声明式MCP清单系统,允许用户通过YAML定义自定义工具、资源和提示,无需运行基础设施即可创建和托管MCP服务器。

工具数

5

提示词数

0

GitHub Stars

0

资源数

0
TypeScriptClaude云端部署Claude

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

Z-M-Huang

提供方

Z-M-Huang

最后核验

2026/5/17 20:20

运行时

Node.js

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

命令预览

npx git-doc-mcp --manifest https://example.com/.mcp/manifest.yml

详细介绍

git doc mcp-将任何清单转换为mcp服务器

](https://www.npmjs.com/package/git-doc-mcp) ![License: MIT](https://opensource.org/licenses/MIT) ](https://nodejs.org/) ![TypeScript](https://www.typescriptlang.org/) ![Linux](https://github.com) ![macOS](https://github.com) ![Windows](https://github.com)

编写清单,将其托管在任何地方,用户可以立即使用他们的AI工具。

什么是git doc mcp?

git doc mcp是一个 声明性MCP清单系统 它允许任何人在不运行基础设施的情况下创建和托管MCP服务器。它将任何清单URL转换为具有自定义工具、资源和提示的功能齐全的MCP服务器,所有这些都在YAML中定义。

主要特点:

  • 无需主机 -使用GitHub Pages、GitLab Pages、S3、任何静态托管
  • 自定义JavaScript操作 -定义自己的工具逻辑
  • 能力范围的秘密 -具有URL模式匹配的细粒度访问控制
  • 平台无关 -适用于GitHub、GitLab、S3、本地文件
  • TOFU清单验证 -首次使用时信任,采用故障关闭安全机制
  • 三层隔离 -工作进程+隔离虚拟机+URL验证
  • 跨平台 -Linux、macOS、Windows

快速开始

1.安装

# Using npm
npm install -g git-doc-mcp

# Using npx (no install needed)
npx git-doc-mcp --manifest https://example.com/.mcp/manifest.yml

2.使用Claude代码进行配置

添加 ~/.claude/config.json:

{
  "mcpServers": {
    "my-repo": {
      "command": "npx",
      "args": ["git-doc-mcp", "--manifest", "https://example.com/.mcp/manifest.yml"]
    }
  }
}

3.创建您的清单

创建 .mcp/manifest.yml 在您的存储库中:

schemaVersion: "1.0"
name: my-repo-mcp
version: 1.0.0
description: MCP server for my repository

tools:
  - name: fetch-file
    description: Fetch a file from the repository
    inputSchema:
      type: object
      properties:
        path: { type: string }
      required: [path]
    action: https://example.com/.mcp/actions/fetch-file.v1.js  # URL or local path
    actionHash: "sha256:..."
    annotations:
      readOnlyHint: true
      openWorldHint: true

行动可以参考 HTTP(S)URL本地文件路径 (相对于清单文件的目录):

# Remote action (hosted)
action: https://raw.githubusercontent.com/owner/repo/main/.mcp/actions/fetch-file.v1.js

# Local action (for development)
action: ./actions/fetch-file.v1.js

试试看——现场演示

该项目使用自己的清单系统来提供文档。将其添加到您的AI工具中,以查看git doc mcp的运行情况:

克劳德代码 --添加到您的项目 .mcp.json:

{
  "mcpServers": {
    "git-doc-mcp-docs": {
      "command": "npx",
      "args": [
        "git-doc-mcp",
        "--manifest",
        "https://raw.githubusercontent.com/Z-M-Huang/git-doc-mcp/main/.mcp/manifest.yml"
      ]
    }
  }
}

克劳德桌面 --添加到 ~/.claude/claude_desktop_config.json:

{
  "mcpServers": {
    "git-doc-mcp-docs": {
      "command": "npx",
      "args": [
        "git-doc-mcp",
        "--manifest",
        "https://raw.githubusercontent.com/Z-M-Huang/git-doc-mcp/main/.mcp/manifest.yml"
      ]
    }
  }
}

这为您提供了5个工具、3个资源和3个提示,用于从 维基工程:

工具说明
list_topics浏览文档主题,按标签筛选
get_guide获取特定指南(例如,入门指南、清单参考)
search_docs按关键字搜索所有文档
get_example获取完整的工作示例(GitHub工具、REST包装器等)
get_action_api动作脚本API参考(ctx.fetch、ctx.getSecret等)

清单来源动作脚本 作为构建自己的参考。

安装

npm

npm install -g git-doc-mcp

npx(不安装)

npx git-doc-mcp --manifest 

本地开发

git clone https://github.com/Z-M-Huang/git-doc-mcp.git
cd git-doc-mcp
npm install
npm run build

用法示例

公开清单

npx git-doc-mcp --manifest https://raw.githubusercontent.com/owner/repo/main/.mcp/manifest.yml

带身份验证的私有清单

npx git-doc-mcp --manifest https://private.example.com/.mcp/manifest.yml \
  --manifest-header "Authorization: Bearer $TOKEN"

本地开发

# Manifest and action scripts can all be local files
npx git-doc-mcp --manifest ./path/to/manifest.yml

当使用本地清单时, actionresource.uri 字段可以引用具有相对于清单目录的路径的本地文件。每次工具调用时,都会从磁盘重新读取本地操作,因此编辑无需重新启动服务器即可生效。

带有预先批准的秘密

# Via CLI flag
npx git-doc-mcp --manifest https://example.com/.mcp/manifest.yml \
  --secret GITHUB_TOKEN=$GITHUB_TOKEN

# Via environment variable
export GIT_MCP_SECRET_GITHUB_TOKEN=$GITHUB_TOKEN
npx git-doc-mcp --manifest https://example.com/.mcp/manifest.yml

哈希钉扎(用于CI/CD)

npx git-doc-mcp --manifest https://example.com/.mcp/manifest.yml \
  --manifest-hash sha256:abc123...

速率限制

# Limit to 30 tool calls per minute
npx git-doc-mcp --manifest https://example.com/.mcp/manifest.yml \
  --rate-limit 30

清单架构

schemaVersion: "1.0"           # Required - schema version
name: my-repo-mcp              # Required - server name
version: 1.0.0                 # Required - semantic version
description: Description       # Optional - shown to AI
instructions: Use when...      # Optional - helps AI understand when to use

secrets:                       # Optional - secrets needed
  - name: GITHUB_TOKEN
    description: GitHub token
    scope:
      - "https://api.github.com/*"
    required: false

tools:                         # Optional - tool definitions
  - name: fetch-file
    title: Fetch File          # Optional - human-readable title
    description: Fetch a file  # Required
    inputSchema:               # Required - JSON Schema
      type: object
      properties:
        path: { type: string }
      required: [path]
    action: https://...        # Required - URL or local file path to action script
    actionHash: sha256:...     # Required - SHA-256 hash of action content
    annotations:               # Optional - hints for AI
      readOnlyHint: true
      destructiveHint: false
      idempotentHint: true
      openWorldHint: true

resources:                     # Optional - static resources
  - name: readme
    uri: https://...           # URL or local file path
    description: README
    mimeType: text/markdown

prompts:                       # Optional - prompt templates
  - name: explain-code
    description: Explain code
    args:
      - name: path
        required: true
    messages:                    # Optional - MCP PromptMessage[]
      - role: user
        content:
          type: resource
          resource:
            uri: "https://example.com/{{path}}"
            mimeType: text/plain
      - role: user
        content:
          type: text
          text: "Explain the code above from {{path}}"

提示信息

提示支持完整的MCP PromptMessage 使用多消息模板的格式:

  • 没有 messages:单用户消息由以下内容构建 description +args(简单模式)
  • 随着 messages:消息直接返回 {{argName}} 替换
  • 嵌入资源:如果资源消息省略 resource.text,git doc mcp读取URI,并在请求提示时嵌入获取的内容

每条消息都有一个 role (userassistant)以及 content (要么 text 或嵌入式 resource):

messages:
  - role: user
    content:
      type: text
      text: "Analyze {{path}} for {{focus}}"
  - role: assistant
    content:
      type: text
      text: "I'll analyze the code structure first."
  - role: user
    content:
      type: resource
      resource:
        uri: "https://example.com/{{path}}"
        mimeType: text/plain

行动API

操作是导出默认异步函数的纯JavaScript文件:

export default async function myAction(input, ctx) {
  const { fetch, getSecret, log, manifest } = ctx;

  log('info', `Running action for ${manifest.name}`);

  // Get a secret scoped to the target URL
  const url = 'https://api.example.com/data';
  const token = getSecret('API_KEY', url);

  const response = await fetch(url, {
    headers: token ? { 'Authorization': `Bearer ${token}` } : {}
  });

  // response.text is a property (not a method)
  // response.json() is a synchronous method
  const data = response.json();

  return {
    content: [{ type: 'text', text: JSON.stringify(data, null, 2) }]
  };
}

上下文方法

方法说明
ctx.fetch(url, options)带SSRF保护和重定向验证的作用域获取
ctx.getSecret(name, url)如果URL与secret的作用域模式匹配,则获取secret值
ctx.log(level, message)日志记录(级别:调试、信息、警告、错误)
ctx.manifest清单元数据({ name, version })

获取响应

ctx.fetch 返回序列化响应对象(不是本机对象 Response):

属性/方法类型描述
response.okbooleantrue 如果状态为200-299
response.statusnumberHTTP状态码
response.statusTextstringHTTP状态文本
response.textstring响应体为字符串(属性,而非方法)
response.json()object将正文解析为JSON(同步方法)
response.headersobject响应头作为键值对

返回格式

// Success
return {
  content: [{ type: 'text', text: 'Result' }]
};

// Error
return {
  content: [{ type: 'text', text: 'Error message' }],
  isError: true
};

CLI 参考

选项

选项描述默认值
`--manifest
`manifest.yml的URL或本地路径(必需)
--manifest-header 用于获取清单的标头(可重复)
--manifest-hash 预期用于固定的清单哈希
--action-code-header 下载操作脚本的标头(可重复)
--resource-header 用于获取资源的标头(可重复)
--secret 预先批准的秘密(可重复)
--timeout 工作器超时(毫秒)60000
--memory-limit 沙盒内存限制(8MB-1GB)134217728 (128 MB)
--rate-limit 每分钟最大工具调用次数(0=无限制)0
--allow-http允许不安全的HTTP URL(默认情况下仅HTTPS)false
--trust-changed接受清单哈希更改(TOFU覆盖)false

环境变量

可以通过前缀为的环境变量提供秘密 GIT_MCP_SECRET_:

export GIT_MCP_SECRET_GITHUB_TOKEN=ghp_abc123
export GIT_MCP_SECRET_API_KEY=sk-xyz789

--secret CLI标志优先于环境变量。

示例

# Basic usage
git-doc-mcp --manifest ./manifest.yml

# With authentication headers
git-doc-mcp --manifest https://... \
  --manifest-header "Authorization: Bearer $TOKEN" \
  --action-code-header "Authorization: Bearer $TOKEN"

# Separate resource headers
git-doc-mcp --manifest https://... \
  --resource-header "Authorization: Bearer $RESOURCE_TOKEN"

# With secrets and rate limiting
git-doc-mcp --manifest https://... \
  --secret GITHUB_TOKEN=$TOKEN \
  --rate-limit 60

# Hash pinned (for CI/CD)
git-doc-mcp --manifest https://... --manifest-hash sha256:abc123...

# Accept manifest changes (TOFU override)
git-doc-mcp --manifest https://... --trust-changed

# Custom memory limit (256MB)
git-doc-mcp --manifest https://... --memory-limit 268435456

# Allow HTTP (not recommended for production)
git-doc-mcp --manifest http://localhost:8080/manifest.yml --allow-http

比较

特性git doc mcpContext7idosal/git doc mcp
托管任何静态主机托管服务需要单独的服务器
自定义操作用户自定义JS固定工具有限操作
私有仓库身份验证标头OAuth未知
平台任意(GitHub、GitLab、S3等)任意仅限GitHub
本地开发本地文件
秘密范围界定URL模式匹配N/AN/A
彰显诚信TOFU+哈希钉扎N/AN/A

安全模型

可信清单系统

用户明确配置他们信任的清单URL。这与GitHub MCP Server的官方方法是一致的——用户配置要使用的服务器,因此他们信任服务器作者。

三层隔离

Layer 1: Worker Process (Primary Boundary)
  - Separate Node.js child process
  - Sanitized environment (no inherited credentials)
  - Crash in action doesn't kill CLI

Layer 2: isolated-vm (Defense-in-Depth)
  - Configurable memory limit (default: 128MB)
  - CPU timeout: 30s
  - No direct filesystem/network access

Layer 3: Controlled API Surface
  - ctx.fetch with SSRF protection
  - ctx.getSecret with URL scope validation
  - Audit logging of all network calls

SSRF保护

所有HTTP(S)URL在获取之前都会经过验证:

  • 默认情况下仅使用HTTPS(使用 --allow-http 覆盖)
  • 私有IP范围被阻止(10.x、172.16-31.x、192.168.x、本地主机)
  • 连接前已验证DNS解析
  • 每个重定向URL都经过重新验证
  • 跨源重定向剥离敏感标头(授权、Cookie)

中的本地文件路径 actionresource.uri 直接从磁盘读取,不受SSRF验证。 ctx.fetch 内部操作脚本仍然是HTTP(S),无论操作是如何加载的。

能力范围的秘密

秘密仅限于特定的URL模式:

secrets:
  - name: GITHUB_TOKEN
    scope:
      - "https://api.github.com/*"
      - "https://raw.githubusercontent.com/*"

ctx.getSecret(name, url) 仅当URL与作用域模式匹配时才返回机密值。路径边界感知通配符匹配可防止 /repos-private 从匹配a /repos/* 范围。

TOFU(首次使用信任)

首次使用时,git doc mcp会存储清单的SHA-256哈希值。如果清单发生变化:

Warning: Manifest content has changed since last use!
  Previous: sha256:abc123...
  Current:  sha256:def456...

To accept this change, re-run with: --trust-changed
For CI pinning, use: --manifest-hash sha256:def456...

服务器以非零代码退出,除非 --trust-changed 提供。对于CI/CD,请使用 --manifest-hash 用于硬钉。

速率限制

滑动窗口速率限制器可防止过多的工具调用:

# 60 calls per minute
git-doc-mcp --manifest https://... --rate-limit 60

审计日志

全部 ctx.fetch 通话记录到 ~/.git-doc-mcp/logs/audit.jsonl:

  • URL、HTTP状态、持续时间
  • 重定向跳转
  • 秘密访问(允许/拒绝)
  • 动作开始/结束与计时

贡献

  1. 分叉存储库
  2. 创建要素分支
  3. 进行更改
  4. 构建: npm run build
  5. 运行测试: npm test
  6. 提交拉取请求

开发设置

npm install        # Install dependencies
npm run build      # Build all packages
npm test           # Run all tests (298 tests)

项目结构

git-doc-mcp/
  packages/
    core/          # Manifest loading, sandbox, worker, MCP server
    cli/           # CLI entry point and serve command
    template/      # Example manifest and actions

文档

完整文档可在 :

许可证

MIT许可证-请参阅 许可证 了解详情。

目录标签

目录标签

TypeScriptClaude云端部署MCP服务器本地部署声明式配置无服务器架构自定义工具YAML定义

支持客户端

Claude

接入字段

传输方式(transport,传输协议)

stdio

鉴权方式(authType,认证方式)

oauth

运行时(runtime,运行环境)

Node.js

来源包(packageName,安装包名)

git-doc-mcp

工具数量(toolCount,工具数)

5

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

stdiooauth部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

来源信息

继续浏览同类 MCP