Unified MCP Server for AI CLI Tools (Gemini, Qwen, OpenCode)
npm install ai-cli-hub統合AIアシスタント用のModel Context Protocol (MCP) サーバー。Qwen、Gemini、OpenCode CLIツールへの統一アクセスを提供します。
- 統合AI処理: 複数のAIエンジンへの統一インターフェース
- 外部CLI実行: 実証済み外部コマンド統合アプローチ
- OAuth 2.0認証: セキュアな認証システム
- MCP準拠: Claude Codeとの完全互換性
- TypeScript実装: 型安全性と保守性
既存のPython MCP実装の実証済みパターンを採用:
```
MCP Client → AI CLI Hub → External CLI Commands
│ │ │
│ │ ├─ qwen -p "prompt"
│ │ ├─ gemini -p "prompt"
│ │ └─ opencode -p "prompt"
│ │
│ ├─ OAuth Manager (環境変数経由)
│ ├─ Command Builder
│ └─ Error Handling
| エンジン | 機能 | 認証方式 |
|---------|------|---------|
| Qwen | コード生成、チャット、ファイル分析 | OAuth 2.0 + API Key |
| Gemini | 高度推論、文書分析、グラウンディング | OAuth 2.0 + API Key |
| OpenCode | マルチプロバイダー統合、フォールバック | OAuth 2.0 |
`bash初期化 (設定ファイルとディレクトリ作成)
npx ai-cli-hub init
$3
`bash
グローバルインストール
npm install -g ai-cli-hubまたは開発用ローカルインストール
git clone https://github.com/your-username/ai-cli-hub.git
cd ai-cli-hub
npm install
npm run build
`$3
各AIエンジンのCLIツールをインストール:
`bash
Qwen CLI
pip install qwen-cliGemini CLI
pip install google-generativeai-cliOpenCode CLI
npm install -g opencode-cli
`$3
`bash
OAuth認証
npm run auth:setupまたはAPI Keyを設定
export QWEN_API_KEY="your-api-key"
export GEMINI_API_KEY="your-api-key"
`$3
`bash
開発モード
npm run devプロダクション
npm run start
`🔧 使用方法
$3
claude_desktop_config.json に追加:#### NPX使用の場合(推奨)
`json
{
"mcpServers": {
"ai-cli-hub": {
"command": "npx",
"args": ["ai-cli-hub", "start"],
"env": {
"NODE_ENV": "production"
}
}
}
}
`#### ローカルインストールの場合
`json
{
"mcpServers": {
"ai-cli-hub": {
"command": "ai-cli-hub",
"args": ["start"],
"env": {
"NODE_ENV": "production"
}
}
}
}
`#### 開発環境の場合
`json
{
"mcpServers": {
"ai-cli-hub": {
"command": "node",
"args": ["/path/to/ai-cli-hub/dist/index.js"],
"env": {
"NODE_ENV": "development"
}
}
}
}
`$3
#### Qwen ツール
-
qwen_chat: AIチャット機能
- qwen_analyze_file: ファイル分析
- qwen_change_file: ファイル変更
- qwen_generate_code: コード生成#### Gemini ツール
-
gemini_chat: 高度推論チャット
- gemini_analyze_document: 文書分析
- gemini_code_review: コードレビュー
- gemini_grounding_search: グラウンディング検索#### OpenCode ツール
-
opencode_chat: マルチプロバイダーチャット
- opencode_generate_code: コード生成
- opencode_explain_code: コード説明🧪 テスト
$3
`bash
モックAIコマンドの作成
demo/mock-ai-commands.shモック環境のセットアップ
source demo/setup-mock-env.shテスト実行
npm run test
`$3
`bash
単体テスト
node test/external-command.test.js統合テスト
node test/mcp-integration.test.js
`⚙️ 設定
$3
`json
{
"engines": {
"qwen": {
"enabled": true,
"useOAuth": true,
"model": "qwen3-coder-plus",
"timeout": 30000
},
"gemini": {
"enabled": true,
"useOAuth": true,
"model": "gemini-2.5-pro",
"grounding": true
},
"opencode": {
"enabled": true,
"useOAuth": true,
"provider": "anthropic"
}
},
"features": {
"fileOperations": true,
"gitIntegration": true
},
"server": {
"logLevel": "info",
"timeout": 120000
}
}
`🔐 セキュリティ
- OAuth 2.0 フロー完全対応
- 認証トークンの安全な管理
- 環境変数経由の認証情報渡し
- タイムアウト・エラーハンドリング
📊 統合実績
$3
- ✅ 既存Python実装の調査完了
- ✅ 外部コマンド統合パターン採用
- ✅ OAuth認証システム統合
- ✅ 完全動作確認完了$3
Before: TODO実装(未動作)
After: 外部コマンド統合(完全動作)🤝 コントリビューション
1. Fork the repository
2. Create feature branch:
git checkout -b feature/amazing-feature
3. Commit changes: git commit -am 'Add amazing feature'
4. Push to branch: git push origin feature/amazing-feature`MIT License - 詳細は LICENSE ファイルを参照
- Model Context Protocol
- Claude Code Documentation
- 統合分析レポート