MCPilot
MCPilot
MCPベースのエージェント型Linux診断アシスタント — GeminiがカスタムMCPサーバーによって公開された型付きでサンドボックス化されたツールを選択して呼び出し、LangGraphステートマシンを反復して診断に十分な証拠が得られるまで進めることで、「なぜ私のラップトップは遅いのか」 のような自然言語の質問に答えます。
ローカルのみ · Ubuntu · CLI · 任意のシェルなし · 変更には人間が介在
アーキテクチャ
USER
│
▼
CLI Interface (rich)
│
▼
┌─────────────────┐
│ LangGraph │
│ Diagnostic Agent│◄──── Gemini (function calling)
└────────┬────────┘
│
MCP Client (stdio)
│
MCP Protocol
│
▼
┌─────────────────┐
│ MCPilot Server │ (MCPServer, subprocess-launched)
└────────┬────────┘
│
┌───────────────┼────────────────┐
│ │ │
▼ ▼ ▼
System Filesystem Git
/proc, psutil POSIX APIs, Git CLI via
systemd, path allow-list controlled
journalctl subprocessレイヤリングルール: MCPデコレータはコアのLinux抽象化レイヤーを呼び出します。それら自体はOSロジックを含みません。
server/tools/system.py → server/core/linux.py → /proc, psutil, uname
server/tools/services.py → server/core/systemd.py → systemctl, journalctl
server/tools/filesystem.py → server/core/fs.py → pathlib / POSIX APIs
server/tools/git.py → server/core/git.py → git CLI (controlled subprocess)Related MCP server: mcp-linux-ops
ツールカタログ(18ツール)
ツール | モジュール | 戻り値 | リスク |
| system |
| READ_ONLY |
| system |
| READ_ONLY |
| system |
| READ_ONLY |
| system |
| READ_ONLY |
| system |
| READ_ONLY |
| system |
| READ_ONLY |
| services |
| READ_ONLY |
| services |
| READ_ONLY |
| services |
| READ_ONLY |
| services |
| APPROVAL_REQUIRED |
| filesystem |
| READ_ONLY |
| filesystem |
| READ_ONLY |
| filesystem |
| READ_ONLY |
| filesystem |
| READ_ONLY |
| git |
| READ_ONLY |
| git |
| READ_ONLY |
| git |
| READ_ONLY |
| git |
| READ_ONLY |
意図的に delete_file、sudo_command、または汎用シェルツールはありません。
セキュリティモデル
MCPilotのセキュリティは、4つのレイヤーにわたる多層防御です。
任意のシェルツールなし — すべての機能は、固定されたsubprocess引数リストを持つ、特定の狭いスコープのPython関数です。
shell=Trueは決して使わず、文字列補間されたコマンドも決して使いません。パス制限 — すべてのファイルシステムおよびGitツールは、明示的な許可リスト(
~/Projects、~/Documents)に対してパスを検証します。シンボリックリンクを解決し、is_relative_to()でチェックします。server/core/fs.py::validate_pathを参照してください。サービス名インジェクション防止 — 厳格な正規表現(
^[a-zA-Z0-9@_.\-]+$)は、;、|、&、$、バッククォート、空白、パス区切り文字を拒否します。server/core/systemd.py::validate_service_nameを参照してください。リスク分類と人間の承認 — すべてのツールにはリスクレベル(
READ_ONLY、APPROVAL_REQUIRED、DENIED)があります。未知のツールはデフォルトでDENIED(フェイルクローズ)になります。唯一の変更ツール(restart_service)は、明示的なyの確認を待ちます。監査ログ — すべてのツール呼び出しは、タイムスタンプ、ツール、引数、リスク、承認ステータス、結果とともに
logs/audit.jsonlに記録されます。安全なサブプロセスランナー — すべてのサブプロセス呼び出しは、単一の
run_safe()関数を経由します。常にshell=False、常に引数リスト、常にタイムアウト付きです。
完全な脅威モデル: docs/security.md
クイックスタート
# Prerequisites: Ubuntu, Python 3.12+, uv
git clone <repo-url> && cd mcpilot
# Install dependencies
uv sync
# Set Gemini API key
cp .env.example .env
# Edit .env and add your GEMINI_API_KEY
# Run tests (44 tests, all layers)
PYTHONPATH="" uv run python -m pytest tests/ -v --override-ini="asyncio_mode=auto"
# Interactive mode
uv run python -m cli.main
# One-shot mode
uv run python -m cli.main "Why is my system slow?"トレース例
システム診断
You: Why is my system slow?
[Agent] Analyzing request...
[MCP] get_cpu_usage()
[MCP] get_memory_usage()
[MCP] list_processes(limit=20)
[MCP] get_disk_usage()
[Agent] Evaluating evidence...
[Agent] Generating diagnosis...
Diagnosis: Memory pressure (92% used, 70% swap) driven by firefox.
Confidence: HIGH.サービス診断
You: Why isn't PostgreSQL working?
[Agent] Analyzing request...
[MCP] get_service_status(service='postgresql')
[MCP] get_service_logs(service='postgresql')
[MCP] get_listening_ports()
[MCP] list_processes(limit=20)
[Agent] Evaluating evidence...
[Agent] Generating diagnosis...
Diagnosis: systemd shows failed; journal shows "address already in use";
port 5432 is held by PID <n> (<process>). Confidence: HIGH.セーフティデモ
You: Restart PostgreSQL
[Agent] Analyzing request...
┌──────────────────────────────┐
│ MCPilot requests action │
├──────────────────────────────┤
│ Tool: restart_service │
│ Service: postgresql │
│ │
│ Reason: service action │
│ requested by diagnostic agent│
│ │
│ Approve? [y/N] │
└──────────────────────────────┘テストスイート
レイヤー | テスト数 | 対象 |
レイヤー1 — コアLinux | 8 |
|
レイヤー2 — MCPプロトコル | 4 | 18ツール登録、スキーマ、説明 |
レイヤー3 — セキュリティ | 24 | パストラバーサル、サービスインジェクション、未知のツール、出力制限 |
レイヤー4 — エージェント | 8 | ポリシー、反復上限、承認拒否、状態整合性 |
合計 | 44 |
信頼度ラベル
信頼度は、離散的で説明可能なラベルです。校正された統計スコアではありません。
高: 3つ以上の独立した観測が同じ原因を示している
中: いくつかの裏付け証拠はあるが、確認となる観測が欠けている
低: 証拠が薄い、反復上限に達した、または観測が矛盾している
プロジェクト構造
mcpilot/
├── server/
│ ├── main.py # MCPServer app, registers all 18 tools
│ ├── tools/ # MCP tool wrappers (thin, no OS logic)
│ │ ├── system.py # 6 system tools
│ │ ├── services.py # 4 service tools (incl. restart_service)
│ │ ├── filesystem.py # 4 filesystem tools
│ │ └── git.py # 4 git tools
│ ├── core/ # Linux abstraction layer
│ │ ├── linux.py # /proc + psutil parsing
│ │ ├── systemd.py # systemctl/journalctl wrappers
│ │ ├── fs.py # path validation + file ops
│ │ ├── git.py # git subprocess wrappers
│ │ └── command.py # shared safe-subprocess runner
│ ├── policies.py # risk classification map
│ ├── schemas.py # all Pydantic models
│ └── audit.py # JSONL audit logger
├── client/
│ └── mcp_client.py # MCP stdio client
├── agent/
│ ├── state.py # DiagnosticState TypedDict
│ ├── graph.py # LangGraph wiring
│ ├── nodes.py # 4 LangGraph nodes
│ ├── prompts.py # LLM prompt templates
│ └── tool_adapter.py # MCP → Gemini function declarations
├── cli/
│ └── main.py # CLI entrypoint, rich output, approval UI
├── tests/ # 44 tests across 4 layers
│ ├── server/ # Layer 1+2 tests
│ ├── agent/ # Layer 4 tests
│ └── security/ # Layer 3 tests (interview demo suite)
├── docs/ # Architecture, security, MCP docs
├── examples/ # Captured diagnostic transcripts
└── logs/ # audit.jsonl (gitignored)ライセンス
MIT
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseAqualityAmaintenanceEnables AI assistants to perform controlled Linux system administration tasks like reading logs, managing services, cron jobs, WordPress, and executing sandboxed Python code, with strict security constraints.292GPL 2.0
- FlicenseBqualityDmaintenanceEnables LLMs to execute shell commands and perform file operations on a Linux system, exposing tools like execute_command, read_file, write_file, and more.10
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to monitor and manage Linux infrastructure including services, logs, processes, disk, memory, ports, cron, nginx, Docker, and system health checks via the Model Context Protocol.MIT
- FlicenseNot gradedqualityDmaintenanceEnables AI agents to diagnose Linux server incidents by collecting and structuring system diagnostics from multiple servers via SSH, with tools for finding incident clusters, gathering context (memory, CPU, swap, etc.), and running arbitrary commands.
Related MCP Connectors
Operate Linux, macOS and Windows from your LLM. Every action runs through an auditable allowlist.
Let AI operate servers without SSH. Choose actions, approve risky changes, and audit every step.
Runtime permission, approval, and audit layer for AI agent tool execution.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/Ronit-k/MCPilot'
If you have feedback or need assistance with the MCP directory API, please join our Discord server