Sponsored by Deepsite.site

GitHub MCP Server

Created By
tomo-cps7 months ago
GitHub MCP Server implementation and testing repository
Content

GitHub MCP Server

このリポジトリは Model Context Protocol (MCP) サーバーの実装と使用方法のテストを行うためのものです。

概要

Model Context Protocol (MCP) は、大規模言語モデル (LLM) とクライアントアプリケーション間の通信を標準化するためのプロトコルです。このプロトコルを使用することで、エージェントは外部ツールやクライアントアプリケーションと効果的に連携することができます。

GitHub MCPサーバーは、GitHub APIと連携し、リポジトリ操作、コード検索、イシュー管理などの機能をLLMエージェントに提供します。

特徴

  • リポジトリ操作: リポジトリの作成、ファイルの追加・編集、ブランチ管理
  • コード検索: GitHub上のコードを検索
  • イシュー/PR管理: イシューやプルリクエストの作成、更新、コメント
  • 認証管理: GitHub APIとの安全な認証

必要条件

  • Node.js (v16.0.0以上)
  • npm または yarn
  • GitHub アカウントと個人アクセストークン (PAT)

インストール方法

# リポジトリをクローン
git clone https://github.com/tomo-cps/mcp-test.git
cd mcp-test

# 依存パッケージのインストール
npm install
# または
yarn install

設定

  1. .env ファイルを作成し、以下の環境変数を設定:
GITHUB_TOKEN=your_github_personal_access_token
PORT=3000
  1. GitHub 個人アクセストークンを取得する方法:
    • GitHub にログイン
    • 右上のプロフィールアイコン > Settings > Developer settings > Personal access tokens
    • "Generate new token" をクリック
    • 必要な権限を選択 (repo, user, read:org 推奨)
    • トークンを生成し、.env ファイルに保存

サーバーの起動

# 開発モード
npm run dev
# または
yarn dev

# 本番モード
npm start
# または
yarn start

デフォルトでは、サーバーは http://localhost:3000 で実行されます。

API エンドポイント

このMCPサーバーは以下の主要なエンドポイントを提供します:

  • /mcp/describe: 利用可能な機能とパラメータを記述
  • /mcp/execute: 指定されたコマンドを実行
  • /mcp/state: 現在の状態を取得または更新

使用例

1. リポジトリ情報の取得

// クライアント側のコード例
const response = await fetch('http://localhost:3000/mcp/execute', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    command: 'get_repository',
    params: {
      owner: 'octocat',
      repo: 'hello-world'
    }
  })
});

const data = await response.json();
console.log(data);

2. イシューの作成

// クライアント側のコード例
const response = await fetch('http://localhost:3000/mcp/execute', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    command: 'create_issue',
    params: {
      owner: 'your-username',
      repo: 'your-repo',
      title: 'バグ: ログイン画面で問題が発生',
      body: '詳細な説明をここに記述します...',
      labels: ['bug', 'priority:high']
    }
  })
});

const data = await response.json();
console.log(data);

トラブルシューティング

一般的な問題と解決方法:

  1. 認証エラー: GitHub トークンが正しく設定されていることを確認してください。
  2. レート制限: GitHub API にはレート制限があります。制限に達した場合、しばらく待ってから再試行してください。
  3. CORS エラー: クロスオリジン呼び出し時には、サーバーが適切な CORS ヘッダーを設定していることを確認してください。

コントリビューション

  1. このリポジトリをフォーク
  2. フィーチャーブランチを作成 (git checkout -b feature/amazing-feature)
  3. 変更をコミット (git commit -m 'Add some amazing feature')
  4. ブランチにプッシュ (git push origin feature/amazing-feature)
  5. プルリクエストを作成

ライセンス

MIT License - 詳細は LICENSE ファイルを参照してください。

参考資料

Recommend Servers
TraeBuild with Free GPT-4.1 & Claude 3.7. Fully MCP-Ready.
WindsurfThe new purpose-built IDE to harness magic
EdgeOne Pages MCPAn MCP service designed for deploying HTML content to EdgeOne Pages and obtaining an accessible public URL.
MiniMax MCPOfficial MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.
TimeA Model Context Protocol server that provides time and timezone conversion capabilities. This server enables LLMs to get current time information and perform timezone conversions using IANA timezone names, with automatic system timezone detection.
AiimagemultistyleA Model Context Protocol (MCP) server for image generation and manipulation using fal.ai's Stable Diffusion model.
Serper MCP ServerA Serper MCP Server
Playwright McpPlaywright MCP server
Visual Studio Code - Open Source ("Code - OSS")Visual Studio Code
Tavily Mcp
Zhipu Web SearchZhipu Web Search MCP Server is a search engine specifically designed for large models. It integrates four search engines, allowing users to flexibly compare and switch between them. Building upon the web crawling and ranking capabilities of traditional search engines, it enhances intent recognition capabilities, returning results more suitable for large model processing (such as webpage titles, URLs, summaries, site names, site icons, etc.). This helps AI applications achieve "dynamic knowledge acquisition" and "precise scenario adaptation" capabilities.
Howtocook Mcp基于Anduin2017 / HowToCook (程序员在家做饭指南)的mcp server,帮你推荐菜谱、规划膳食,解决“今天吃什么“的世纪难题; Based on Anduin2017/HowToCook (Programmer's Guide to Cooking at Home), MCP Server helps you recommend recipes, plan meals, and solve the century old problem of "what to eat today"
MCP AdvisorMCP Advisor & Installation - Use the right MCP server for your needs
ChatWiseThe second fastest AI chatbot™
BlenderBlenderMCP connects Blender to Claude AI through the Model Context Protocol (MCP), allowing Claude to directly interact with and control Blender. This integration enables prompt assisted 3D modeling, scene creation, and manipulation.
Baidu Map百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Amap Maps高德地图官方 MCP Server
Context7Context7 MCP Server -- Up-to-date code documentation for LLMs and AI code editors
CursorThe AI Code Editor
Jina AI MCP ToolsA Model Context Protocol (MCP) server that integrates with Jina AI Search Foundation APIs.
DeepChatYour AI Partner on Desktop