Obsidian GitHub MCP

io.github.SarutobiSasuke8由 GitHub 账号 SarutobiSasuke8 发布v0.1.0更新于 Oct 25, 2026

A permissioned MCP gateway for agent proposals to a Git-backed Obsidian vault.

概览

AI 生成的概览

一个自托管网关,让指定的 AI 代理读取 GitHub 上的 Obsidian 仓库,并按运营方策略在审阅分支上提交文件变更提案。

可以做什么
查看身份与边界:显示已认证身份、broker、分支与策略范围,列出实际生效的读/写/拒绝路径,并对单个路径做不调用 GitHub 的试运行判断。浏览与读取:列出被授权的目录并过滤掉被拒绝的子项,读取允许的 UTF-8 仓库文件。提交变更提案:仅在身份固定的提案分支上创建、更新或追加文件,并遵守可变性规则。所有写入都落在提案分支供人工审阅,而非默认分支。
适用场景
当你希望 AI 代理为 Git 托管的 Obsidian 仓库起草或编辑笔记,又不想把通用 GitHub 令牌交给它,并且愿意自行运行和配置服务器(策略文件、令牌绑定、专用提案分支)时使用。
运行要求
需要 Node.js 22+ 并以本地进程运行;一个位于 GitHub 仓库中的 Obsidian 仓库;每个 broker 一个专用的非默认提案分支;仓库范围的 GITHUB_TOKEN,或一个具备 Contents 读写权限的 GitHub App(GITHUB_APP_ID、GITHUB_APP_INSTALLATION_ID、GITHUB_APP_PRIVATE_KEY_FILE)。必填:VAULT_MCP_GITHUB_OWNER、VAULT_MCP_GITHUB_REPO、VAULT_MCP_POLICY_FILE、VAULT_MCP_TOKEN_FILE;可选 VAULT_MCP_PORT。客户端需发送 Authorization bearer 令牌。README 说明 npm 包尚未发布,目前仅支持从源码安装。
安装前请注意
服务器持有 GitHub 凭据,并签发按代理区分、会过期的 bearer 令牌;原始令牌只交给一个客户端,服务端仅保存其哈希。策略与令牌文件由运营方维护且拒绝未知键,拼错的限制会直接报错而不会被静默忽略。写入会在提案分支上创建、更新或追加文件;没有删除、合并、推送主分支或修改仓库设置的工

安装

在 SourceWeft 中

  1. 打开 控制台中的 Obsidian GitHub MCP,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

Obsidian GitHub MCP

A white-label Model Context Protocol server that gives selected AI agents bounded, auditable access to propose changes to an Obsidian vault stored in GitHub.

Each agent receives its own expiring MCP bearer token. The GitHub credential remains server-side. Read and write paths, denials, protected surfaces, proposal branches, and token revocation are controlled by operator-owned YAML files.

This is an independent open-source project. It is not affiliated with or endorsed by Obsidian or GitHub.

Why use it?

Giving an agent a general GitHub token is difficult to constrain and easy to misuse. This server creates a narrower boundary:

text
AI agent + individual MCP token        |        videntity + fixed broker        |        vagent write scope AND broker publication scope        |        vdeny, path, frontmatter, mutability, size, and secret checks        |        vserver-side GitHub App token        |        vproposal branch for human review

The service has no tools for deleting files, merging branches, pushing to main or master, changing repository settings, editing workflows, or exposing credentials.

Features

  • Stateless MCP Streamable HTTP transport
  • Unique, expiring bearer tokens stored as SHA-256 bindings
  • Per-agent read, write, and deny path globs
  • Separate Git broker allowlists and fixed proposal branches
  • Configurable frontmatter requirements for shared or sensitive surfaces
  • living, review-first, append-only, and immutable note handling
  • Path-traversal prevention and file-extension/size allowlists
  • Credential-shaped-content detection
  • Repository-restricted GitHub App tokens with PAT fallback for local testing
  • Content-free JSONL audit records
  • Host/origin validation, security headers, rate limiting, and HTTP timeouts
  • Docker, CI, tests, and deployment documentation

MCP tools

ToolPurpose
vault_whoamiShow the authenticated identity, broker, branch, and policy scopes.
vault_list_allowed_pathsExplain effective read/write/deny boundaries.
vault_explain_accessDry run a single path. Report whether read, list, or write would be permitted and which policy rule decides it. No GitHub call.
vault_list_filesList an authorised directory while filtering denied children.
vault_read_fileRead an authorised UTF-8 vault file.
vault_create_fileCreate a file on the identity's fixed proposal branch.
vault_update_fileUpdate a permitted file while respecting mutability.
vault_append_fileAppend while preserving all existing bytes.

Requirements

  • Node.js 22+
  • An Obsidian vault in a GitHub repository
  • A dedicated non-default proposal branch for each broker
  • A GitHub App installed only on the vault repository with Contents: read and write, or a fine-grained PAT for local testing

Quick start

Install from source (the current supported path):

bash
git clone https://github.com/YOUR_ACCOUNT/obsidian-github-mcp.gitcd obsidian-github-mcpnpm cicp .env.example .envcp config/policy.example.yaml config/policy.yamlcp config/tokens.example.yaml config/tokens.yamlnpm run token:newnpm run check# Configure .env with your GitHub repository and token/app credentials before starting:npm start

Configure .env (specifying your repository and either a GITHUB_TOKEN or GitHub App credentials), replace the sample policy, and put only the generated token's SHA-256 in config/tokens.yaml. Give the raw bearer token to exactly one MCP client.

To verify a checkout before configuring a running service:

bash
npm cinpm run checknpm run test:e2e

These checks use synthetic notes, mock GitHub responses and loopback transports. They need no GitHub or MCP credentials. Note regressions cover Unicode/path encoding, CRLF frontmatter, malformed metadata, UTF-8 size limits and append-only byte preservation. CI runs the same checks on Linux and Windows with Node.js 22 and 24. The 8 tools listed above are the current server surface; tests do not publish proposals to a real vault.

Once v0.1.0 is published to npm, a global install will also be available:

bash
# Available once v0.1.0 is published (not yet on the npm registry).npm install -g @sarutobi-sasuke/obsidian-github-mcp

The default endpoints are:

text
GET  http://127.0.0.1:3210/healthzPOST http://127.0.0.1:3210/mcp

MCP clients must send:

text
Authorization: Bearer vault_<generated-token>

Permission model

The effective write scope is the intersection of the agent grant and its broker:

yaml
policy_version: 1authority: operator-only
agents:  - id: example-writer    name: Example Writer    role: bounded knowledge worker    disclosure_ceiling: internal    entry_reads: [README.md]    read: [Knowledge/**, Workspace/**]    write: [Workspace/Shared/**, Workspace/Example Writer/**]    deny: [Private/**, People/**, .obsidian/**]
git_brokers:  - broker: example-writer    branch: agent/example-writer    allow: [Workspace/Shared/**, Workspace/Example Writer/**]
never_versioned: [Private/**, People/**, .obsidian/**, secrets/**]
surface_rules:  - path: Workspace/Shared/**    required_frontmatter:      disclosure: public-safe

An auth binding then maps one token hash to that identity and broker. The binding cannot grant paths that the policy does not grant.

See Permissions documentation for provisioning and revocation.

GitHub authentication

Production deployments should use a GitHub App installed only on the vault repository. Configure:

dotenv
GITHUB_APP_ID=123456GITHUB_APP_INSTALLATION_ID=12345678GITHUB_APP_PRIVATE_KEY_FILE=/run/secrets/vault-mcp.pem

The server creates short-lived installation tokens restricted again to the configured repository and contents: write. A repository-scoped GITHUB_TOKEN is supported as a local-development fallback.

Deployment

The included container runs as a non-root user with a read-only root filesystem. Put TLS, a private overlay network, or an authenticated gateway in front of the service before making it remotely reachable.

See Deployment guide.

Verification

bash
npm run checknpm audit --audit-level=high

Tests cover policy parsing, write-scope intersection, deny precedence, traversal attempts, frontmatter rules, mutability, secret detection, token bindings, and fixed-branch GitHub writes.

Run npm run test:e2e for a clean tarball installation and real MCP HTTP client proof against a test-only GitHub substitute. It exercises proposal writes, denied paths/content, immutable and append-only notes, stale-write conflicts, invalid policy reloads, live token revocation and content-free audit records. CI runs this proof on Windows/Linux with Node 22/24, and the release workflow requires it.

Policy and token files reject unknown keys. Only policy_version: 1 and authority: operator-only are supported. Correct misspelt fields or remove unsupported metadata before upgrading; silently ignored restrictions are no longer accepted. Release evidence and remaining gates.

The draft MCP Registry npm entry describes a self-hosted Streamable HTTP process, not a stdio server. A compatible client starts the process with the declared environment and connects to http://127.0.0.1:{VAULT_MCP_PORT}/mcp (port 3210 by default). Supply the existing policy and token-file paths plus the repository owner/name. For GitHub access, use either GITHUB_TOKEN or all three documented GitHub App variables. The manifest cannot express that alternative group; runtime configuration validates it. The process does not create credentials, provision a hosted endpoint or bypass its existing bearer-token checks. The namespace preserves the exact GitHub owner spelling. prepublishOnly includes the registry/package gate; no login or publication is performed by it.

Security

Read Security policy before deployment. Report suspected vulnerabilities privately rather than opening a public issue with exploit details.

License

Apache-2.0. See Apache-2.0 License.

来源:README.md,提交 e82b557

工具

0
SourceWeft 曾在隔离沙箱中以无凭据方式启动该软件包一次,以列出其工具,但未能完成:该软件包类型无法在沙箱中运行。

版本历史

1
  1. v0.1.0最新Oct 25, 2026

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分