silvabyte/OpenCodeMCP
If you are the rightful owner of OpenCodeMCP and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.
The Conversational Coding MCP Server enables natural language interaction with your codebase through ChatGPT and MCP-enabled LLMs, allowing you to explore, read, modify, and run code commands conversationally.
Conversational Coding MCP Server
An MCP (Model Context Protocol) server that enables conversational coding via ChatGPT or any MCP-enabled LLM. Talk to your codebase from anywhere - on a bike ride, fishing, or walking the dog.
What It Does
This server bridges ChatGPT to OpenCode, allowing you to:
- Explore projects - "Show me the folder structure of the horizon backend"
- Read code - "What does the status-change handler do?"
- Modify code - "Refactor this function to use async/await"
- Search - "Find all files that import the auth module"
- Run commands - "Run the tests and tell me what fails"
All through natural conversation.
Architecture
You (speaking) → ChatGPT → MCP Server → OpenCode → Your Codebase
- ChatGPT: Interprets your intent and calls MCP tools
- MCP Server: Routes requests to OpenCode (this project)
- OpenCode: AI coding agent that actually reads/writes files
Quick Start
Prerequisites
Installation
# Clone and install
git clone <repo>
cd opencodemcp
bun install
# Configure
cp .env.example .env
# Edit .env and set your MCP_API_KEY
Running
# Development (with hot reload)
bun run dev
# Production
bun run start
The server starts at http://localhost:9000/mcp
Exposing to ChatGPT
Use Cloudflare Tunnel to expose your local server:
# Install cloudflared
brew install cloudflared
# Create a tunnel (one-time)
cloudflared tunnel create mcp
# Run the tunnel
cloudflared tunnel run --url http://localhost:9000 mcp
Then configure ChatGPT to use your tunnel URL as an MCP endpoint.
Configuration
Environment variables (see .env.example):
| Variable | Required | Description |
|---|---|---|
MCP_API_KEY | Yes | API key for authenticating requests |
MCP_PORT | No | Port to run on (default: 9000) |
OPENCODE_URL | No | URL of existing OpenCode server |
PROJECT_ALIASES | No | JSON array of project aliases |
Project Aliases
Define friendly names for your projects:
PROJECT_ALIASES='[{"name":"horizon backend","path":"/Users/mat/dev/Horizon"},{"name":"my app","path":"/Users/mat/dev/MyApp"}]'
Then say "open the horizon backend" instead of the full path.
MCP Tools
The server exposes these tools to ChatGPT:
| Tool | Description |
|---|---|
conversation | Main interface - send any coding instruction |
list_files | List files and directories |
read_file | Read file contents |
find_text | Search for text patterns |
find_files | Find files by name |
get_project | Get current project info |
list_projects | List all projects |
list_sessions | List active sessions |
get_messages | Get session message history |
abort_session | Stop current operation |
add_alias | Add a project alias |
Example Conversations
Opening a project:
"Open the horizon backend and show me the folder structure"
Exploring code:
"What files implement the analytics storage? Show me the main ones."
Making changes:
"Refactor the status-change handler - extract the shared logic into a utility"
Debugging:
"Run the tests and fix any failures"
Development
# Type check
bun run typecheck
# Run with hot reload
bun run dev
Project Structure
src/
├── index.ts # Server bootstrap
├── routes.ts # MCP tool definitions
├── auth.ts # API key authentication
├── opencodeClient.ts # OpenCode SDK wrapper
├── sessionManager.ts # Session tracking
└── types.ts # TypeScript interfaces
License
MIT