88 lines
1.4 KiB
Markdown
88 lines
1.4 KiB
Markdown
# 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秒 |