opencode-session-context-mcp
Click on "Install 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-session-context-mcpwhat was discussed in the previous session?"
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.
opencode-session-context-mcp
osc-mcp
Demo
https://github.com/user-attachments/assets/d41fb2b8-96ca-4a03-9bcd-afede68212e2
Dictionary
Description
opencode-session-context-mcp (aka osc-mcp) is an MCP server that supplies new sessions
with context from prior sessions in the same project, so your OpenCode instance can pick
up where you left off and better align with your project’s ongoing needs.
⚠️ Caution: this tool is under active development, especially around optimizing token spend when fetching context. Contributions are welcome.
How It Works
On session start, the server stores a filtered summary of the previous session into
mcp.db.When a new session asks for context, it looks up recent summaries for the current project.
The client (OpenCode) uses those summaries to seed your new session with relevant context.
Tools
store_previous_session_content: stores filtered content from the most recent previous session intomcp.db.get_relevant_sessions: returns a lightweight list of recent session summaries for the current project.
Requirements
bungitOpenCode (installed and configured)
Install
Quick Start (best UX)
Linux/mac
curl -fsSL https://github.com/vohs-1980/osc-mcp/blob/main/scripts/install.sh?raw=1 | bashWindows (PowerShell):
irm https://github.com/vohs-1980/osc-mcp/blob/main/scripts/install.ps1?raw=1 | iexSecurity note: review scripts/install.sh before running or use the manual
steps below. For Windows, review scripts/install.ps1 before running.
What the installer does (Linux/mac):
Finds your
opencode.json(honorsXDG_CONFIG_HOME).Verifies
bunandgitare installed.Verifies the OpenCode data dir exists (honors
XDG_DATA_HOME).Clones or updates the repo in
~/.local/share/opencode/osc-mcp.Runs
bun installand builds the server.Updates
opencode.jsonto add the"osc-mcp"MCP entry.If config editing fails or
--no-configis set, prints manual steps.
If your config is invalid JSON or you pass --no-config, follow the manual
steps below.
Manual Install
git clone https://github.com/vohs-1980/osc-mcp.git \
~/.local/share/opencode/osc-mcp
cd ~/.local/share/opencode/osc-mcp
bun install
bun run buildOpenCode config (~/.config/opencode/opencode.json):
If you don't already have the instruction files listed, add them:
"instructions": [
"~/.local/share/opencode/osc-mcp/instructions/session-start.md",
"~/.local/share/opencode/osc-mcp/instructions/context-lookup.md"
]Then add the local MCP entry (if not present):
"osc-mcp": {
"type": "local",
"enabled": true,
"command": ["bun", "~/.local/share/opencode/osc-mcp/src/index.ts"]
}Run
# Run the MCP server
bun src/index.tsTips
Start OpenCode from your project root so the MCP can map sessions to the correct project.
Keep your project in git so sessions can be tied to a stable repo context.
Environment
OPENCODE_DB: Path to OpenCode DB (default~/.local/share/opencode/opencode.db)
If the default path doesn’t work for your setup, set it explicitly before launching OpenCode/MCP.
Example:
export OPENCODE_DB="$HOME/.local/share/opencode/opencode.db"
opencodeInstaller overrides (optional):
OSC_MCP_REPO_URL: Git repo URL to clone (defaulthttps://github.com/vohs-1980/osc-mcp.git).OSC_MCP_INSTALL_DIR: Install directory (default~/.local/share/opencode/osc-mcp).OSC_MCP_REF: Git ref to checkout (tag/branch/commit, defaultmain).XDG_CONFIG_HOME: Base config directory (default~/.config).XDG_DATA_HOME: Base data directory (default~/.local/share).
Example override:
export OSC_MCP_REPO_URL="https://github.com/vohs-1980/osc-mcp.git"
export OSC_MCP_INSTALL_DIR="$HOME/.local/share/opencode/osc-mcp"
export OSC_MCP_REF="v0.1.0"
export XDG_CONFIG_HOME="$HOME/.config"
export XDG_DATA_HOME="$HOME/.local/share"OS Notes
macOS/Linux: use
scripts/install.sh(requiresbash,git,bun)Windows: use
scripts/install.ps1in PowerShell.
Config path detection (installers search in this order):
macOS/Linux:
$XDG_CONFIG_HOME/opencode/opencode.json~/.config/opencode/opencode.json~/Library/Application Support/opencode/opencode.json
Windows:
%XDG_CONFIG_HOME%\opencode\opencode.json%APPDATA%\opencode\opencode.json%LOCALAPPDATA%\opencode\opencode.json~\.config\opencode\opencode.json~\Library\Application Support\opencode\opencode.json
Default data locations (databases):
macOS/Linux:
~/.local/share/opencode/opencode.db~/.local/share/opencode/osc-mcp/mcp.db
Windows:
%USERPROFILE%\.local\share\opencode\opencode.db%USERPROFILE%\.local\share\opencode\osc-mcp\mcp.db
License
MIT. See LICENSE.
This server cannot be installed
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/v-o-h-s/osc-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server