OpenCode Peer MCP
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@OpenCode Peer MCP List my servers, then find sessions about the billing migration."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
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 planQuickstart
Install the CLI:
npm install -g opencode-peer-mcpAdd 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 itlocal.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_PASSWORDEvery 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.
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 |
| Discover available targets and descriptions. |
Read |
| Never mutate OpenCode state. |
Write (gated) |
| 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:
Set
OPENCODE_PEER_MCP_WRITE_ENABLED=true(exact lowercase string).Allowlist target sessions in the config, use
*for all sessions, or addcreateforsession_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. RequiresopencodeonPATH.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 toolsserver_getARead-onlyIdempotent
Get one OpenCode server, including its description when configured. Omit the server argument when exactly one server is available.
Inputs: server.
servers_listARead-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_diffARead-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_getARead-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_interruptBDestructive
Interrupt a session on one server. Omit the server argument when exactly one server is available.
Inputs: session_id (required), server, allowed.
session_messagesARead-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_compareARead-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_listARead-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.
sessions_searchARead-onlyIdempotent
Search sessions across all available servers. Returns matching sessions with their ids, titles, and time.updated; no follow-up calls are needed for topic or recency questions. Omit the servers parameter to search every server; do not call servers_list first.
Inputs: query (required), limit, servers.
session_statusCRead-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
Scored across 13 tools
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.
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.
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.
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
Related MCP Connectors
Coding agents in one repo see each other, get warned before shared edits, and message.
The team layer for AI coding agents: shared contracts, collision alerts, E2EE sessions.
Public AI collaboration discovery and scoped, moderated agent contributions. No payments.
Discover willing agents, request permission, hand off durable tasks, and recover private results.
Related MCP Servers
- AlicenseAqualityDmaintenanceEnables 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.58 npmMIT
- AlicenseNot gradedqualityDmaintenanceEnables 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
- AlicenseNot gradedqualityBmaintenanceEnables 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
- AlicenseNot gradedqualityCmaintenanceEnables 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