Skip to content

OrionPace/opencode-github-skill

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

opencode-github-skill

English | 中文

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.

The Problem with Traditional MCP

Traditional Model Context Protocol (MCP) integrations often require:

  1. Running a persistent local server (Docker or Process) that consumes memory.
  2. Loading ALL tool definitions into the Agent's context window at startup, which wastes tokens and slows down every interaction.

The Solution: "Skill" Shim

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.

Installation

  1. Navigate to your OpenCode configuration directory (usually ~/.config/opencode/skills or your project's skills/ folder).
  2. Create a folder named github.
  3. Copy SKILL.md and call-remote.js from this repository into that folder.
mkdir -p ~/.config/opencode/skills/github
cp SKILL.md call-remote.js ~/.config/opencode/skills/github/

Configuration

This skill requires a GitHub Personal Access Token (PAT) to be available in your environment variables.

  1. Get a Token: Create a GitHub PAT (classic or fine-grained) with appropriate scopes (repo, user, gist, etc.).

  2. Set Environment Variable: Ensure GITHUB_MCP_PAT is set in your shell profile or system environment.

    export GITHUB_MCP_PAT="ghp_your_token_here"

    Note: OpenCode usually inherits your system environment variables.

Usage

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:

  1. Recognize the intent.
  2. "Activate" the GitHub skill.
  3. Execute node call-remote.js with the appropriate parameters.
  4. Return the JSON result from GitHub's MCP API.

Architecture

  • 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 to api.githubcopilot.com/mcp/, and prints the result.

License

MIT

About

A lightweight, serverless-style GitHub integration for OpenCode (and compatible agents), utilizing the Skill architecture to reduce token consumption.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors