copilot-usage-mcp
# copilot-usage-mcp
GitHub Copilot の利用状況メトリクスを取得する MCP (Model Context Protocol) サーバーです。
Enterprise、Organization、Team レベルでの Copilot 使用状況データを MCP ツールとして提供します。
## 提供ツール
| ツール名 | 説明 |
|---------|------|
| `get_copilot_metrics_for_enterprise` | Enterprise 全体の日次 Copilot 利用メトリクス |
| `get_copilot_metrics_for_org` | Organization の日次 Copilot 利用メトリクス |
| `get_copilot_metrics_for_team` | Team の日次 Copilot 利用メトリクス |
| `get_copilot_seat_assignments` | Organization の Copilot シート割り当て情報 |
| `get_copilot_usage_summary` | Enterprise / Org / Seats の統合サマリー |
各ツールは、コード補完数・Chat 利用状況・アクティブユーザー数・言語 / エディタ別の内訳などを取得できます。
## セットアップ
### 前提条件
- Node.js 18+
- GitHub Personal Access Token(Copilot メトリクス API へのアクセス権限が必要)
### インストール
```bash
npm install
npm run build
```
### 環境変数
コマンドライン引数または環境変数で以下を設定してください(`.env` ファイルは読み込まれません)。
| 変数名 | 必須 | 説明 |
|--------|------|------|
| `GITHUB_PERSONAL_ACCESS_TOKEN` | Yes | GitHub Personal Access Token |
| `GITHUB_ENTERPRISE` | No | Enterprise slug |
| `GITHUB_ORG` | No | Organization 名 |
| `CACHE_DIR` | No | キャッシュディレクトリ(デフォルト: `./cache`) |
### MCP クライアントへの設定
Claude Desktop の場合、`claude_desktop_config.json` に以下を追加します。
```json
{
"mcpServers": {
"copilot-usage": {
"command": "node",
"args": ["path/to/copilot-usage-mcp/dist/index.js"],
"env": {
"GITHUB_PERSONAL_ACCESS_TOKEN": "ghp_xxxxxxxxxxxx",
"GITHUB_ENTERPRISE": "your-enterprise",
"GITHUB_ORG": "your-org"
}
}
}
}
```
## 開発
```bash
# TypeScript のウォッチモードで開発
npm run dev
# テスト実行
npm test
# テストのウォッチモード
npm run test:watch
```
## ライセンス
[MIT](LICENSE)
TDQS
Scored across 5 tools
Each tool has a clearly distinct purpose targeting different aspects of Copilot usage data. The enterprise, organization, team, seat assignments, and summary tools all operate at different scopes with no functional overlap, making tool selection unambiguous.
All tools follow a perfect 'get_copilot_[noun]_[preposition]_[target]' pattern with consistent snake_case throughout. The naming convention is highly predictable and readable across all five tools.
Five tools is an ideal number for this focused domain of Copilot usage analytics. Each tool serves a distinct reporting function without redundancy, providing comprehensive coverage while maintaining a manageable interface.
The toolset provides complete coverage for Copilot usage reporting across all relevant scopes (enterprise, organization, team, seat assignments) with a convenient summary tool. There are no obvious gaps in the analytics surface for this specific domain.