Skip to main content
Glama

Why this exists

  • Sessions are isolated. OpenCode sessions cannot share context, even on the same machine.

  • Same machine, no setup. Without a config file, the bridge discovers the local OpenCode server from its service registration and exposes it as local.

  • Across machines, when needed. Add remote servers in config to read, search, and compare sessions on a workstation without copying context by hand.

Related MCP server: sangam

Demo

Illustrative session with two configured servers:

> List my servers, then find sessions about the billing migration.

servers_list
  laptop       General coding and repository work
  workstation  Data analysis, reporting, and dashboards

sessions_search  query="billing migration"
  laptop/ses_4f2a       Refactor invoice retry logic
  workstation/ses_9c1d  Billing migration rollout plan

Quickstart

  1. Install the CLI:

    npm install -g opencode-peer-mcp
  2. Add the bridge to your MCP client. For OpenCode, edit ~/.config/opencode/opencode.json:

    {
      "mcp": {
        "opencode-peer": {
          "type": "local",
          "command": ["opencode-peer-mcp"]
        }
      }
    }

    Without a servers.yaml, the bridge discovers the OpenCode server running on this machine and calls it local.

  3. Restart your client and ask:

    List my servers, then find sessions about the billing migration.

Discovery reads OpenCode's service registration at $XDG_STATE_HOME/opencode/service.json, or ~/.local/state/opencode/service.json when XDG_STATE_HOME is unset. For a server started manually, add it to servers.yaml with its URL and password.

Cross-machine use

Create ~/.config/opencode-peer-mcp/servers.yaml only when you want additional machines:

servers:
  - id: laptop
    description: General coding and repository work
    url: http://127.0.0.1:49374
    password_env: OPENCODE_LOCAL_PASSWORD
  - id: workstation
    description: Data analysis, reporting, and dashboards
    url: http://127.0.0.2:49374
    password_env: OPENCODE_WORKSTATION_PASSWORD

Every server uses HTTP Basic auth. password_env names the environment variable holding its password; the username is fixed to opencode. Secrets are referenced by name, never stored in the file.

When a config file exists, discovery does not run and only configured servers are used. With multiple servers, pass server on server-addressed tools. With exactly one server, you can omit it. sessions_search always searches every server unless you pass servers.

IMPORTANT

Keep OpenCode servers on a trusted private network. We highly recommendTailscale or a similar private subnetting service for cross-machine access. Do not expose an OpenCode server directly to the public internet.

What you get

Group

Tools

Notes

Servers

servers_list, server_get

Discover available targets and descriptions.

Read

sessions_list, session_get, session_status, session_messages, session_diff, sessions_search, sessions_compare

Never mutate OpenCode state.

Write (gated)

session_create, session_prompt, session_interrupt, session_schedule

Require the write gate and allowlist.

Full parameters and return shapes: docs/tools.md.

Write access and audit

Writes are disabled by default. To enable them:

  1. Set OPENCODE_PEER_MCP_WRITE_ENABLED=true (exact lowercase string).

  2. Allowlist target sessions in the config, use * for all sessions, or add create for session_create.

The implicit local server allows all sessions. Configured servers use their own allowlists. Each write tool also accepts allowed: true, which is caller-supplied and bypasses the allowlist, so do not expose write tools to untrusted clients.

Denied and allowed writes go to ~/.opencode-peer-mcp/audit.log. Override the path with OPENCODE_PEER_MCP_AUDIT_LOG.

Documentation

Development

Use the Bun canary build. bun lint exists only in canary builds: bun upgrade --canary.

  • bun install: installs dependencies and points Git at the committed .githooks/ directory.

  • bun run test: unit tests.

  • bun run test:integration: starts fixture OpenCode servers. Requires opencode on PATH.

  • bun run typecheck, bun run lint, bun run format:check: static checks.

The pre-commit hook runs bun fmt --staged, bun lint --staged --fix, bun check, and bun check -p tsconfig.tests.json. Run the commit with the canary bun first on PATH.

Contributing

See CONTRIBUTING.md.

License

This project is licensed under the MIT License. See LICENSE.

Available Tools

13 tools
server_getA
Read-onlyIdempotent

Get one OpenCode server, including its description when configured. Omit the server argument when exactly one server is available.

Inputs: server.

servers_listA
Read-onlyIdempotent

List available OpenCode servers. Without a config file, the local server on this machine is discovered automatically.

Inputs: no named parameters.

session_createA

Create a session on one server. Omit the server argument when exactly one server is available.

Inputs: directory (required), agent, model, title, +2 more.

session_diffA
Read-onlyIdempotent

Get structured diffs for a session turn. Returns only the diff; does not fetch messages or session details.

Inputs: session_id (required), to, from, server, +1 more.

session_getA
Read-onlyIdempotent

Get a session by ID from one server. Omit the server argument when exactly one server is available.

Inputs: session_id (required), server.

session_interruptB
Destructive

Interrupt a session on one server. Omit the server argument when exactly one server is available.

Inputs: session_id (required), server, allowed.

session_messagesA
Read-onlyIdempotent

Get messages for a session. Returns only the message list; does not fetch session details or status.

Inputs: session_id (required), type, limit, order, +2 more.

session_promptB

Prompt a session on one server. Omit the server argument when exactly one server is available.

Inputs: prompt (required), session_id (required), server, allowed, +1 more.

session_scheduleA

Schedule a message on a session after a delay. Fire-and-forget: does not survive server restart. For recurring checks, use OpenCode built-in automations.

Inputs: delay (required), prompt (required), session_id (required), server, +1 more.

sessions_compareA
Read-onlyIdempotent

Compare two sessions. Returns both sessions side by side; does not fetch messages or diffs. Omit a server argument when exactly one server is available.

Inputs: session_a (required), session_b (required), server_a, server_b.

sessions_listA
Read-onlyIdempotent

List sessions on one server. Use this for a single server, including filtered listings; sessions_search is for searches across servers. Omit the server argument when exactly one server is available.

Inputs: limit, order, cursor, search, +6 more.

session_statusC
Read-onlyIdempotent

Get derived status for a session.

Inputs: session_id (required), server.

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A3.6/5.0

    Scored across 13 tools

    Disambiguation5/5

    Descriptions actively carve out boundaries: sessions_list vs sessions_search (single server vs cross-server), session_get vs session_status (raw vs derived), and session_messages/session_diff/sessions_compare each explicitly state what they do NOT return. Similar-sounding pairs (session_prompt vs session_schedule, server_get vs servers_list) are separated by immediate-vs-delayed semantics and cardinality.

    Naming Consistency4/5

    The pattern is <noun>_<action> throughout, with a meaningful singular/plural convention: singular session_/server_ for one-entity operations, plural sessions_/servers_ for collection operations. The only rough edges are noun-style suffixes (session_status, session_messages, session_diff) instead of a pure verb, which slightly breaks the verb_noun expectation.

    Tool Count5/5

    13 tools sit in the sweet spot and each maps to a distinct session lifecycle action (create, prompt, interrupt, schedule, inspect, compare, search). Nothing appears redundant or bolted on.

    Completeness4/5

    The session lifecycle is well covered end-to-end — create, prompt, interrupt, schedule, read messages, diff, compare, status, search — plus read access to servers. Missing a session delete/cleanup or rename/update operation, which leaves a dead end for housekeeping tasks.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      D
      maintenance
      Enables multiple coding agents (Claude Code, Codex, Cursor) to discover each other's sessions, search transcripts, ask questions, and handoff tasks through a shared MCP server.
      5
      8 npm
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables coding agents on different machines to share verbatim session context and coordinate file leases, preventing concurrent edits and allowing each agent to query the other's exact actions and words.
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables a coding agent to ask another person's coding agent questions across different machines, networks, and subscriptions, with revocable directional permission and a locked-down responder session enforced by configuration.
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables coding agents to discover projects, models, and sessions on an existing OpenCode server; delegate and supervise tasks; inspect progress, tool results, and diffs; answer authorized permission requests; and interrupt or redirect work via MCP or a JSON CLI.
      MIT