opencode-session-context-mcp
opencode-session-context-mcp
osc-mcp
데모
https://github.com/user-attachments/assets/d41fb2b8-96ca-4a03-9bcd-afede68212e2
Related MCP server: agent-mem0
목차
설명
opencode-session-context-mcp (일명 osc-mcp)는 동일한 프로젝트 내의 이전 세션에서 컨텍스트를 가져와 새로운 세션에 제공하는 MCP 서버입니다. 이를 통해 OpenCode 인스턴스가 중단된 지점부터 작업을 이어가고 프로젝트의 지속적인 요구 사항에 더 잘 맞출 수 있습니다.
⚠️ 주의: 이 도구는 현재 활발히 개발 중이며, 특히 컨텍스트를 가져올 때 토큰 사용량을 최적화하는 부분에 집중하고 있습니다. 기여를 환영합니다.
작동 원리
세션이 시작되면 서버는 이전 세션의 필터링된 요약을
mcp.db에 저장합니다.새 세션이 컨텍스트를 요청하면 현재 프로젝트에 대한 최근 요약을 조회합니다.
클라이언트(OpenCode)는 해당 요약을 사용하여 새 세션에 관련 컨텍스트를 제공합니다.
도구
store_previous_session_content: 가장 최근 이전 세션의 필터링된 콘텐츠를mcp.db에 저장합니다.get_relevant_sessions: 현재 프로젝트에 대한 최근 세션 요약의 가벼운 목록을 반환합니다.
요구 사항
bungitOpenCode (설치 및 구성 완료 상태)
설치
빠른 시작 (권장)
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 | iex보안 참고: 실행하기 전에 scripts/install.sh를 검토하거나 아래의 수동 단계를 사용하십시오. Windows의 경우 실행하기 전에 scripts/install.ps1을 검토하십시오.
설치 프로그램 수행 작업 (Linux/mac):
opencode.json을 찾습니다 (XDG_CONFIG_HOME준수).bun및git이 설치되어 있는지 확인합니다.OpenCode 데이터 디렉토리가 존재하는지 확인합니다 (
XDG_DATA_HOME준수).~/.local/share/opencode/osc-mcp에 저장소를 복제하거나 업데이트합니다.bun install을 실행하고 서버를 빌드합니다.opencode.json을 업데이트하여"osc-mcp"MCP 항목을 추가합니다.구성 편집에 실패하거나
--no-config가 설정된 경우 수동 단계를 출력합니다.
구성 파일이 유효한 JSON이 아니거나 --no-config를 전달하는 경우 아래의 수동 단계를 따르십시오.
수동 설치
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/opencode/opencode.json):
지침 파일이 나열되어 있지 않으면 추가하십시오:
"instructions": [
"~/.local/share/opencode/osc-mcp/instructions/session-start.md",
"~/.local/share/opencode/osc-mcp/instructions/context-lookup.md"
]그런 다음 로컬 MCP 항목을 추가하십시오 (없는 경우):
"osc-mcp": {
"type": "local",
"enabled": true,
"command": ["bun", "~/.local/share/opencode/osc-mcp/src/index.ts"]
}실행
# Run the MCP server
bun src/index.ts팁
MCP가 세션을 올바른 프로젝트에 매핑할 수 있도록 프로젝트 루트에서 OpenCode를 시작하십시오.
세션이 안정적인 저장소 컨텍스트와 연결될 수 있도록 프로젝트를 git으로 관리하십시오.
환경
OPENCODE_DB: OpenCode DB 경로 (기본값~/.local/share/opencode/opencode.db)
기본 경로가 설정에서 작동하지 않으면 OpenCode/MCP를 시작하기 전에 명시적으로 설정하십시오.
예시:
export OPENCODE_DB="$HOME/.local/share/opencode/opencode.db"
opencode설치 프로그램 재정의 (선택 사항):
OSC_MCP_REPO_URL: 복제할 Git 저장소 URL (기본값https://github.com/vohs-1980/osc-mcp.git).OSC_MCP_INSTALL_DIR: 설치 디렉토리 (기본값~/.local/share/opencode/osc-mcp).OSC_MCP_REF: 체크아웃할 Git 참조 (태그/브랜치/커밋, 기본값main).XDG_CONFIG_HOME: 기본 구성 디렉토리 (기본값~/.config).XDG_DATA_HOME: 기본 데이터 디렉토리 (기본값~/.local/share).
재정의 예시:
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 참고 사항
macOS/Linux:
scripts/install.sh사용 (bash,git,bun필요)Windows: PowerShell에서
scripts/install.ps1사용.
구성 경로 감지 (설치 프로그램은 다음 순서로 검색):
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
기본 데이터 위치 (데이터베이스):
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
라이선스
MIT. LICENSE를 참조하십시오.
This server cannot be deployed
Related MCP Connectors
Shared memory across AI dev tools: each session hands its context to the next, not starting cold.
Bring your saved preferences, project decisions, and useful context into your next AI conversation.
Persistent memory for Claude Code and Cursor. Stop re-explaining your project every session.
Shared memory for coding agents. Stop re-explaining your codebase every session.
Related MCP Servers
- AlicenseNot gradedqualityNot gradedmaintenanceEnables AI coding assistants like Claude Code, Cursor, and Codex to share chat logs, terminal history, and session context with each other. Eliminates the need to re-explain context when switching between different AI coding tools.2MIT
- AlicenseNot gradedqualityDmaintenanceProvides persistent cross-session memory for Claude Code, enabling it to remember user preferences, decisions, and project context across new sessions.Apache 2.0
- AlicenseNot gradedqualityDmaintenanceProvides persistent memory for Claude Code, automatically extracting and surfacing relevant context from past sessions to avoid re-explaining issues and decisions.MIT
- AlicenseAqualityDmaintenanceProvides cross-session memory for Claude Code by extracting structured handoffs at session end and retrieving relevant past context at session start.27MIT