A lightweight, serverless-style GitHub integration for OpenCode (and compatible agents like Claude Code), utilizing the "Skill" architecture to reduce token consumption and resource usage.
Traditional Model Context Protocol (MCP) integrations often require:
- Running a persistent local server (Docker or Process) that consumes memory.
- Loading ALL tool definitions into the Agent's context window at startup, which wastes tokens and slows down every interaction.
This project implements a "Shim" pattern. Instead of a persistent server, it uses a lightweight script that is only invoked when the Agent explicitly decides to use a GitHub tool.
- Zero Token Overhead: The Agent only sees a short description ("I can manage GitHub repos") until it activates the skill.
- On-Demand Execution: The script connects to GitHub's Remote MCP API only when needed.
- Serverless-like: No local Docker container required if using the Remote API.
- Navigate to your OpenCode configuration directory (usually
~/.config/opencode/skillsor your project'sskills/folder). - Create a folder named
github. - Copy
SKILL.mdandcall-remote.jsfrom this repository into that folder.
mkdir -p ~/.config/opencode/skills/github
cp SKILL.md call-remote.js ~/.config/opencode/skills/github/This skill requires a GitHub Personal Access Token (PAT) to be available in your environment variables.
-
Get a Token: Create a GitHub PAT (classic or fine-grained) with appropriate scopes (
repo,user,gist, etc.). -
Set Environment Variable: Ensure
GITHUB_MCP_PATis set in your shell profile or system environment.export GITHUB_MCP_PAT="ghp_your_token_here"
Note: OpenCode usually inherits your system environment variables.
Once installed, simply ask OpenCode (or your agent) to perform GitHub tasks using natural language.
Examples:
- "List the open issues in google/gemini-cli"
- "Create a bug report issue in my repo user/repo"
- "Read the contents of README.md in anomalyco/opencode"
The Agent will automatically:
- Recognize the intent.
- "Activate" the GitHub skill.
- Execute
node call-remote.jswith the appropriate parameters. - Return the JSON result from GitHub's MCP API.
SKILL.md: Defines the skill metadata and provides instructions to the Agent on how to call the shim script.call-remote.js: A Node.js script that acts as a bridge. It accepts CLI arguments, formats them into a JSON-RPC request, sends it toapi.githubcopilot.com/mcp/, and prints the result.
MIT