GitHub プロジェクトマネージャー
GitHubプロジェクトと課題を管理するためのモデルコンテキストプロトコル(MCP)実装。このパッケージは、AIアシスタントやアプリケーションがGitHubリポジトリ、課題、プルリクエスト、プロジェクトとやり取りするためのシームレスなインターフェースを提供します。
特徴
GitHub の問題管理
- 問題を作成する
- アップデートの問題
- フィルタリングオプションを使用して問題を一覧表示する
- 問題の詳細を取得する
- 問題にコメントを追加する
- 問題を閉じる
GitHub プルリクエスト管理
- プルリクエストを作成する
- プルリクエストを更新する
- フィルタリングオプションを使用してプルリクエストを一覧表示する
- プルリクエストの詳細を取得する
- プルリクエストをマージする
- プルリクエストがマージされたかどうかを確認する
- プルリクエストのレビューを作成および管理する
- レビューコメントを追加して一覧表示する
- レビュー担当者のリクエストと削除
- プルリクエストブランチを更新する
GitHub プロジェクト管理
- プロジェクトを作成する
- プロジェクトに問題を追加する
- プロジェクト項目を更新する(列間を移動する)
- プロジェクト項目の一覧
インストール
npm install @monsoft/mcp-github-project-manager
使用法
npx のクイックスタート
GitHub プロジェクト マネージャーを使用する最も簡単な方法は、npx を直接使用することです。
npx -y @monsoft/mcp-github-project-manager --GITHUB_PERSONAL_TOKEN=your_github_token_here
これにより、MCP サーバーが起動し、MCP クライアントが接続できるようになります。
交通手段
GitHub プロジェクト マネージャーは、次の 2 つの転送方法をサポートしています。
標準入出力トランスポート(デフォルト)
これはデフォルトのトランスポートであり、直接的な CLI 統合とローカルでの使用に最適です。
# Start with default Stdio transport
npx -y @monsoft/mcp-github-project-manager --GITHUB_PERSONAL_TOKEN=your_github_token_here
サーバー送信イベント(SSE)トランスポート
リモート セットアップと Web 統合の場合、HTTP サーバーを起動する SSE トランスポートを使用できます。
# Start with SSE transport on default port (3010)
npx -y @monsoft/mcp-github-project-manager --GITHUB_PERSONAL_TOKEN=your_github_token_here --RUN_SSE=1
# Start with SSE transport on a custom port
npx -y @monsoft/mcp-github-project-manager --GITHUB_PERSONAL_TOKEN=your_github_token_here --RUN_SSE=1 --PORT=8080
SSE トランスポートを使用する場合、サーバーは次の場所からアクセスできます。
- SSEエンドポイント:
http://localhost:<PORT>/sse
- メッセージエンドポイント:
http://localhost:<PORT>/messages
MCPクライアントの設定
これを Anthropic の Claude や Cursor などの AI アシスタントで使用するには:
# Start the MCP server in your terminal
npx -y @monsoft/mcp-github-project-manager --GITHUB_PERSONAL_TOKEN=your_github_token_here
次に、AIアシスタントがこのMCPサーバーを使用するように設定します。具体的な設定は、使用しているクライアントによって異なります。
プログラムによる使用
独自のコードで GitHub プロジェクト マネージャーを使用するには:
import { GitHubProjectManager } from '@monsoft/mcp-github-project-manager';
// The token will be automatically loaded from command line arguments
const manager = new GitHubProjectManager();
// Now you can use the manager to interact with GitHub projects
アプリケーションを実行するときに、GitHub トークンをコマンドライン引数として指定します。
node your-app.js --GITHUB_PERSONAL_TOKEN=your_github_token_here
トランスポート タイプやその他のオプションを指定することもできます。
# Use SSE transport
node your-app.js --GITHUB_PERSONAL_TOKEN=your_github_token_here --RUN_SSE=1 --PORT=3010
# Use default Stdio transport
node your-app.js --GITHUB_PERSONAL_TOKEN=your_github_token_here
特定のトランスポート オプションを使用してプログラムでサーバーを起動する必要がある場合:
import {
startGitHubProjectManagerServer,
startGitHubProjectManagerServerSSE,
} from '@monsoft/mcp-github-project-manager';
// Start with Stdio transport
await startGitHubProjectManagerServer('your_github_token_here');
// Or start with SSE transport
await startGitHubProjectManagerServerSSE('your_github_token_here', 3010);
APIリファレンス
問題管理
問題を作成する
const newIssue = await manager.createIssue({
owner: 'organization-name',
repo: 'repository-name',
title: 'Issue title',
body: 'Detailed description of the issue',
labels: ['bug', 'priority-high'],
assignees: ['username1', 'username2'],
});
問題の詳細を取得する
const issue = await manager.getIssue({
owner: 'organization-name',
repo: 'repository-name',
issue_number: 123,
});
問題を更新する
await manager.updateIssue({
owner: 'organization-name',
repo: 'repository-name',
issue_number: 123,
title: 'Updated title',
body: 'Updated description',
state: 'closed',
});
問題の一覧
const issues = await manager.listIssues({
owner: 'organization-name',
repo: 'repository-name',
state: 'open',
labels: ['bug'],
sort: 'created',
direction: 'desc',
});
問題コメントを追加
await manager.addIssueComment({
owner: 'organization-name',
repo: 'repository-name',
issue_number: 123,
body: 'This is a comment',
});
プルリクエスト管理
プルリクエストを作成する
const pr = await manager.createPullRequest({
owner: 'organization-name',
repo: 'repository-name',
title: 'Pull request title',
body: 'Description of changes',
head: 'feature-branch',
base: 'main',
});
プルリクエストの詳細を取得する
const pullRequest = await manager.getPullRequest({
owner: 'organization-name',
repo: 'repository-name',
pull_number: 456,
});
プルリクエストをマージする
await manager.mergePullRequest({
owner: 'organization-name',
repo: 'repository-name',
pull_number: 456,
merge_method: 'squash',
});
レビューを作成する
await manager.createPullRequestReview({
owner: 'organization-name',
repo: 'repository-name',
pull_number: 456,
event: 'APPROVE',
body: 'LGTM! Great work.',
});
プロジェクト管理
プロジェクトを作成する
const project = await manager.createProject({
owner: 'organization-name',
name: 'Project Name',
body: 'Project description',
});
プロジェクトにアイテムを追加
await manager.addProjectItem({
project_id: 12345,
content_id: issue.id,
content_type: 'Issue',
});
プロジェクト項目の一覧
const items = await manager.listProjectItems({
project_id: 12345,
});
エラー処理
このパッケージは、一般的なエラー シナリオを処理するためのカスタム エラー クラスを提供します。
try {
// GitHub operations
} catch (error) {
if (error instanceof MissingGitHubTokenError) {
console.error('GitHub token is missing. Please provide one via command line.');
} else if (error instanceof AuthenticationError) {
console.error('Failed to authenticate with GitHub. Check your token.');
} else if (error instanceof RateLimitError) {
console.error('GitHub API rate limit exceeded.');
} else {
console.error('An unexpected error occurred:', error.message);
}
}
利用可能なエラークラス:
MissingGitHubTokenError
: GitHubトークンが提供されていない場合にスローされますAuthenticationError
: 認証が失敗したときにスローされますResourceNotFoundError
: 要求されたリソースが存在しない場合にスローされますValidationError
: 入力検証が失敗したときにスローされますRateLimitError
: GitHub API のレート制限を超えたときにスローされますNetworkError
: ネットワーク通信の問題が発生したときにスローされますGitHubApiError
: GitHub API の問題に関する一般的なエラー
GitHubトークンの権限
GitHub 個人アクセス トークンには次の権限が必要です。
repo
- リポジトリへのフルアクセスproject
- プロジェクトへのアクセスissues
- 問題へのアクセス
発達
建物
検証
テスト
リンティング
ライセンス
マサチューセッツ工科大学