Claude Bridge Mcp

io.github.rahuljava2807由 GitHub 账号 rahuljava2807 发布v2.2.0更新于 Nov 3, 2026

Pipes Claude Code session output into Claude Chat — no more copy-paste between tools

发布方自己的服务:Claude Platform Docs

已验证STDIO仅桌面文件与存储开发者工具

概览

AI 生成的概览

本地 MCP 服务器,读取 Claude Code 会话日志并暴露给任意 MCP 客户端,让助手输出无需复制粘贴即可带入 Claude Chat。

可以做什么
  • 列出并查看本地 Claude Code 会话,含项目路径、消息数与时间戳
  • 读取某会话最新的助手消息或最近 N 条消息作为上下文
  • 轮询会话文件,仅返回上次调用以来的新消息
  • 把最近消息快照成本地 markdown 文件并按定时器持续刷新
  • 可选地通过 Drive API 将快照写入一个 Google 文档
  • 通过文件系统收件箱向指定 Claude Code 会话投递提示词
适用场景
适合在终端用 Claude Code 干活、又想让 Claude Chat、Claude Desktop、Cursor 或 Claude Project 了解该会话刚做了什么,或把后续提示词交回该会话,而不必在工具间复制文本的场景。
运行要求
以本地 Node.js 进程通过 stdio 运行,可从 npm 安装或从源码构建。需要主目录下 .claude/projects 中的 Claude Code 会话日志。Google Drive 上传为可选项,需设置 GOOGLE_DRIVE_ENABLED=true、提供 Google Cloud OAuth 桌面客户端 JSON,并完成一次浏览器授权。仅限桌面端。
安装前请注意
它会读取本地 Claude Code 会话记录,其中可能含敏感代码与提示词,并向主目录和 Documents 写入 markdown 快照。启用 Drive 上传会把内容发送给 Google,并在磁盘保存 OAuth 刷新令牌。收件箱工具会覆盖文件,且依赖粘贴进 Claude Code 的一次性设置指令,该指令会让 Claude Code 读取并删除收件箱文件。

安装

在 SourceWeft 中

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

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

其他 MCP 客户端

参照 仓库 中的启动说明。

README

claude-code-bridge-mcp

[npm version] [License: MIT] [Node.js]

MCP server that pipes Claude Code session output directly into Claude Chat — no more copy-paste between tools.

claude-code-bridge-mcp is a Model Context Protocol (MCP) server that reads Claude Code's local session logs from ~/.claude/projects/<project-hash>/ and exposes them as tools to any MCP-compatible client (Claude Desktop, Claude Chat, Cursor, etc.). Run Claude Code in your terminal and pull its latest output into Claude Chat with a single tool call.

Features

  • get_latest_output — grab the most recent assistant message from any (or the most-recent) Claude Code session.
  • list_sessions — enumerate all local sessions with project path, message count, and timestamps.
  • get_session_context — fetch the last N messages from a session for context injection.
  • watch_session — poll a session file every 2 seconds and drain new messages on demand.
  • write_context (v2) — snapshot the last N messages into ~/.claude/bridge-context.md and ~/Documents/claude-bridge-context.md as clean markdown.
  • start_auto_sync (v2) — keep that markdown snapshot live: rewrites both files every 30 seconds (configurable) so a synced folder stays current without manual calls.
  • setup_drive_sync (v2.1) — authorize direct Google Drive upload. Each sync tick then upserts a Google Doc named claude-bridge-context via the Drive API — no Drive desktop client required.
  • send_to_session (v2.2) — queue a prompt for a specific Claude Code session via a cooperative inbox at ~/.claude/bridge-inbox/<session_id>.txt. Closes the read-only gap: Projects Claude → inbox → Claude Code acts on it.

What's new in v2.2 — send_to_session (cooperative dispatch)

v1 read sessions. v2 wrote context out to Drive. v2.2 lets the other side push prompts back in.

send_to_session overwrites ~/.claude/bridge-inbox/<session_id>.txt with the latest prompt and writes a human-readable receipt to ~/.claude/bridge-inbox/latest.md. The target Claude Code session picks it up via a one-time setup instruction that send_to_session returns in its response — paste that once into your Claude Code terminal (or add it to your project's CLAUDE.md) and every subsequent prompt arrives automatically.

Why cooperative instead of direct injection: Claude Code's JSONL is append-only from the CLI's perspective — it doesn't re-read the file mid-session. A real dispatch channel exists (POST /v1/sessions/{id} via Anthropic's relay, the same channel /remote-control uses) but is undocumented and requires reading the CLI's OAuth token from the macOS Keychain. Shipping against an undocumented internal API would break on every Claude Code release and leak credentials from every install — so v2.2 uses the filesystem inbox instead. See GitHub issue for the v3 path.

Example:

jsonc
// send_to_session → response{  "session_id": "15ef12ba-851e-4591-bbd4-c23170e15919",  "project_path": "/Users/you/Documents/my-app",  "written": true,  "inbox_path": "/Users/you/.claude/bridge-inbox/15ef12ba-....txt",  "receipt_path": "/Users/you/.claude/bridge-inbox/latest.md",  "prompt_preview": "refactor the auth middleware to use Fluid Compute",  "setup_instruction": "Before each response, check ~/.claude/bridge-inbox/15ef12ba-....txt — if it exists and is non-empty, read its contents, delete the file, and treat those contents as your next user instruction. You only need to be told this once per session.",  "remote_control_url": "https://claude.ai/code/session_..."}

dry_run: true returns the same shape without touching the filesystem.

What's new in v2 — Google Drive bridge

Claude Projects can't talk to an MCP server directly, but it can read files from a connected Google Drive. v2 closes that loop:

Claude Code → claude-bridge-mcp.write_context → ~/Documents/claude-bridge-context.md             → Google Drive sync → Projects Claude reads via Drive connector

No more copy-paste, and it works inside Projects too.

Workflow:

  1. Make ~/Documents (or any subfolder holding claude-bridge-context.md) part of your Google Drive sync.
  2. Add this MCP server to Claude Desktop, Claude Code, or any MCP client.
  3. In that client, call start_auto_sync once — it returns immediately and keeps the markdown fresh in the background.
  4. In a Claude Project, add Google Drive as a source and point it at claude-bridge-context.md. Ask Projects Claude what Claude Code is up to — it reads the live file.

What's new in v2.1 — Direct Drive API upload

v2 relied on the Google Drive desktop client to sync ~/Documents/claude-bridge-context.md up to Drive. v2.1 removes that dependency: the MCP server now talks to the Drive API itself and upserts a Google Doc named claude-bridge-context every sync tick.

Setup (one time):

  1. Create OAuth credentials in Google Cloud Console:

    • Go to console.cloud.google.com, create a project (or use an existing one).
    • Enable the Google Drive API for the project.
    • Under APIs & Services → Credentials, create an OAuth client ID of type Desktop app.
    • Download the client JSON and save it to ~/.claude/bridge-google-credentials.json.
  2. Enable the Drive sync and (re)start the MCP server with GOOGLE_DRIVE_ENABLED=true in its environment. In Claude Desktop's claude_desktop_config.json:

    json
    {  "mcpServers": {    "claude-bridge": {      "command": "node",      "args": ["/absolute/path/to/claude-code-bridge-mcp/dist/index.js"],      "env": { "GOOGLE_DRIVE_ENABLED": "true" }    }  }}
  3. Call the setup_drive_sync tool from any connected client. It opens a browser tab for Google consent, saves the refresh token to ~/.claude/bridge-google-token.json, and performs an initial upload. The response includes the Doc URL.

  4. Call start_auto_sync. From now on, every tick writes the local markdown and pushes the same content to the Google Doc. The refresh token is reused silently on future server restarts.

What the user sees:

  • A single Google Doc in Drive root named claude-bridge-context, live-updated every 30s with the most recent Claude Code session output.
  • Add it as a source to any Claude Project, or open it directly — no Drive desktop client, no copy-paste.

Opting out: Omit GOOGLE_DRIVE_ENABLED (or set it to anything other than true) and the server behaves exactly like v2 — local markdown only, no Drive calls.

Installation

bash
git clone https://github.com/rahuljava2807/claude-code-bridge-mcp.gitcd claude-code-bridge-mcpnpm installnpm run build

Add it to Claude Desktop

Edit claude_desktop_config.json:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
json
{  "mcpServers": {    "claude-bridge": {      "command": "node",      "args": ["/absolute/path/to/claude-code-bridge-mcp/dist/index.js"]    }  }}

Restart Claude Desktop. The claude-bridge tools will appear in the tool picker.

Usage

Typical workflow:

  1. Run claude in a terminal to start a Claude Code session and do some work.
  2. In Claude Chat, ask:

    "Use list_sessions to find my most recent Claude Code session, then call get_latest_output on it and summarize what Claude Code just did."

  3. For continuous streaming during a long-running Claude Code task, call watch_session repeatedly — each call returns only new messages since the last call.

Example tool call

jsonc
// get_latest_output with no arguments → uses the most recently updated session{  "content": "I've refactored the auth middleware to use Fluid Compute...",  "timestamp": "2026-04-16T15:32:11.441Z",  "session_id": "01HZ...",  "project_path": "/Users/you/code/my-app"}

Claude Code log format

Sessions are stored as JSONL at:

~/.claude/projects/<project-hash>/<session-id>.jsonl~/.claude/projects/<project-hash>/sessions/<session-id>.jsonl

Each line is one JSON event with fields like type, role, content, and timestamp. The parser tolerates variations in shape and extracts assistant text from both string and content-block payloads.

Development

bash
npm run dev      # tsc --watchnpm run build    # compile to dist/npm start        # run the compiled server over stdio

License

MIT — see LICENSE.

来源:README.md,提交 28ff778

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

1
  1. v2.2.0最新Sep 16, 2026

评分

已满足适用检查项的 50%

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

  • 近 30 天内可连通25 分

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

  • 已声明认证方式10 分

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

  • 已列出工具15 分

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

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

其他 Claude 集成