1
0
shell/docs/mcp-protocol.md
2025-06-01 23:35:22 +09:00

88 lines
1.4 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# MCP Protocol Specification for ai.shell
## 通信プロトコル
### 基本仕様
- プロトコル: HTTP REST API
- エンコーディング: JSON
- 認証: なし(ローカル使用のため)
### エンドポイント
#### 1. ツール実行
```
POST /execute
Content-Type: application/json
{
"id": "uuid-v4",
"method": "tool_name",
"params": {
// tool specific parameters
},
"context": {
"current_dir": "/path/to/project",
"project_type": "rust",
"files": ["src/main.rs", "Cargo.toml"],
"git_branch": "main"
}
}
Response:
{
"id": "uuid-v4",
"result": {
// tool specific result
},
"error": null
}
```
#### 2. 利用可能ツール一覧
```
GET /tools
Response:
{
"tools": [
{
"name": "code_with_local_llm",
"description": "Generate code using local LLM",
"parameters": {
"prompt": "string",
"language": "string"
}
},
// ...
]
}
```
#### 3. ヘルスチェック
```
GET /health
Response:
{
"status": "ok",
"llm_status": "connected",
"version": "0.1.0"
}
```
## エラーコード
| Code | Description |
|------|-------------|
| 1001 | Invalid method |
| 1002 | Missing parameters |
| 1003 | LLM connection failed |
| 1004 | File operation failed |
| 1005 | Command execution failed |
| 2001 | Internal server error |
## タイムアウト設定
- デフォルト: 300秒LLM処理
- ファイル操作: 10秒
- コマンド実行: 60秒