🚀 モード MCP サーバー
Rooのカスタム操作モードを管理するためのMCPサーバーです。モードの設定と管理に対するプログラミング制御を提供します。
✨ 主な機能
- カスタムモードに対する完全なCRUD操作のサポート
- Zodを使用したモード検証
- ファイルシステムの変更監視
- 標準MCPエラーコードの処理
- 原子的なファイル操作
📦 インストール
git clone https://github.com/mkc909/modes-mcp-server.git
cd modes-mcp-server
npm install
npm run build
📚 ドキュメント
設定手順
1. 環境変数の設定
.env.example
を .env
にコピーし、必要に応じて調整します。
cp .env.example .env
利用可能な環境変数:
MODES_CONFIG_PATH
: カスタムモードの設定ファイルのパス(デフォルト: %APPDATA%/Code/User/globalStorage/rooveterinaryinc.roo-cline/settings/cline_custom_modes.json
)
2. カスタムモードの設定
カスタムモードのJSON設定ファイルを作成します。examples/modes.example.json
の形式を参考にしてください。
{
"customModes": [
{
"slug": "example-mode",
"name": "Example Mode",
"roleDefinition": "Example role definition describing the mode's capabilities and responsibilities.",
"groups": [
"read",
["edit", {
"fileRegex": "\\.md$",
"description": "Can edit markdown files only"
}],
"write"
],
"customInstructions": "These are additional instructions for using this mode."
}
]
}
3. MCPツールの設定
config/mcp-tools.json
に以下の内容を追加します。
{
"modeManager": {
"class": "FileModeManager",
"args": {
"configPath": "%MODES_CONFIG_PATH%",
"schema": {
"type": "object",
"required": ["slug", "name", "roleDefinition"],
"properties": {
"slug": {"type": "string"},
"name": {"type": "string"},
"roleDefinition": {"type": "string"},
"groups": {
"type": "array",
"items": [
{"type": "string"},
{
"type": "array",
"minLength": 2,
"items": [
{"type": "string"},
{
"type": "object",
"required": ["fileRegex", "description"],
"properties": {
"fileRegex": {"type": "string"},
"description": {"type": "string"}
}
}
]
}
]
},
"customInstructions": {"type": "string", "nullable": true}
}
}
}
}
}
操作モードフレームワーク
標準モード
- デフォルトモード:
default-mode
- 表示名: Default Mode
- 役割定義: 汎用的なファイル操作機能を提供し、さまざまなタスクに適しています。
- ツールグループ: 基本的なファイル操作 (
read
, edit
, write
)
カスタムモード
開発者は特定の要件を満たすためにカスタムモードを作成することができます。例えば:
{
"slug": "my-custom-mode",
"name": "My Custom Mode",
"roleDefinition": "A custom mode for specialized tasks.",
"groups": [
["custom-task", {
"fileRegex": "\\.custom$",
"description": "Handles files with .custom extension"
}]
],
"customInstructions": "Use this mode only for specific operations."
}
利用可能なツール
モードの作成
POST /modes
Content-Type: application/json
{
"mode": {
"slug": "new-mode",
"name": "New Mode",
"roleDefinition": "Description of new mode.",
"groups": ["read", "write"]
}
}
すべてのモードの取得
GET /modes
モードの更新
PUT /modes/<slug>
Content-Type: application/json
{
"mode": {
"name": "Updated Mode",
"roleDefinition": "Updated description.",
"groups": ["read", "write"]
}
}
モードの削除
DELETE /modes/<slug>
開発ガイド
- ソースコードの変更は
src/
ディレクトリ内で行います。
- プロジェクトをビルドします。
npm run build
- サーバーを起動します。
npm start
ベストプラクティス
モード選択
- タスクに適したモードを選択します。
- 特定のモードのワークフローに従います。
- 指定されたツールグループを使用します。
モード変換
- 自然な変換フローに従って操作します。
- 現在のモードのタスクを完了します。
- モード間でコンテキストを保持します。
設定管理
- 変更を保存する前に検証します。
- 明確な役割定義を維持します。
- モードの機能を文書化します。
エラー処理
サーバーは標準MCPエラーコードを使用します。
InvalidParams
: 入力パラメータが無効またはモードが見つからない場合
MethodNotFound
: 要求されたツールが不明な場合
InternalError
: ファイルシステムエラーまたはその他の内部問題が発生した場合
テストガイド
包括的なテストケースと検証手順については TESTING.md を参照してください。
コントリビューションガイド
- リポジトリをフォークします。
- 機能ブランチを作成します。
- プルリクエストを送信します。
- コーディング標準に従います。
📄 ライセンス
MITライセンス - 詳細は LICENSE を参照してください。