MCP Hub
Back to servers

claude-bridge-mcp

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

Registry
Stars
1
Updated
Apr 17, 2026

Quick Install

npx -y @rahulonramp2807/claude-bridge-mcp

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.

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:

    {
      "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

git clone https://github.com/rahuljava2807/claude-code-bridge-mcp.git
cd claude-code-bridge-mcp
npm install
npm 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
{
  "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

// 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

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

License

MIT — see LICENSE.

Reviews

No reviews yet

Sign in to write a review