Skip to main content
Glama

BotDuaChot Host MCP

HOST_WORKSPACE_DIR のスコープ内で、ChatGPT がマシン上で直接操作できるようにする最小限の MCP サーバーです。

このリポジトリには主に2つの機能があります:

  1. ホスト上のファイルの読み取り・書き込み・検索、およびコマンドの実行。

  2. duachuot_knowledge を通じて、マシンにインストールされているツールの実在インベントリに加え、実用的なガイダンスを提供。

レイアウト

app/
├── host/                 # File, command, policy and tool-inventory logic
├── geo/                  # Geo Engine (convert, geodesic, exif, reverse, timezone)
├── ops/                  # OPSEC gate
├── platform/             # OS/distro/arch/shell + tool resolution
├── tools/                # MCP adapters: health, host, knowledge, geo, probes, ops
├── config.py
├── mcp_server.py
└── main.py

knowledge/
├── WORKING_GUIDE.md
├── HOST_ENVIRONMENT.md
├── TOOL_CATALOG.json
├── GEO_PLAYBOOK.md
├── FORENSICS_PLAYBOOK.md
└── OSINT_PLAYBOOK.md

skills/
├── ctf-geo/
├── ctf-forensics-plus/
├── ctf-osint-plus/
└── ctf-stego-plus/

datasets/
└── landmarks.json

resources/
└── RESOURCE_MAP.json (generated from the host ctf-tools repo)
└── landmarks.json

install.sh
scripts/
├── install_basic.sh
├── install_cli.sh
├── uninstall_cli.sh
├── restart_server_only.sh
├── start_tunnel_server.sh
├── dev.sh
├── install_datasets.py
└── test.sh

Related MCP server: local-drive-mcp

インストール

1. ワンライナーインストール(推奨)

curl -fsSL https://raw.githubusercontent.com/cornhub69-x/botduachuot_mcp/main/install.sh | bash

デフォルトでは、スクリプトは main ブランチを ~/.botduachuot_mcp にクローンし、.venv を作成し、依存関係をインストールし、600 のパーミッションで .env を作成し、~/.local/bin/duachuot に CLI をリンクします。同じコマンドを再実行すると、fast-forward でインストールが更新されます。作業ツリーに未コミットのファイルがある場合、インストーラーはユーザーデータの上書きを避けるために停止します。

環境変数でカスタマイズできます:

curl -fsSL https://raw.githubusercontent.com/cornhub69-x/botduachuot_mcp/main/install.sh | \
  DUACHUOT_INSTALL_DIR="$HOME/apps/botduachuot_mcp" \
  DUACHUOT_BIN_DIR="$HOME/.local/bin" \
  DUACHUOT_BRANCH=main \
  bash

サポートされている変数:DUACHUOT_REPO_URL、DUACHUOT_INSTALL_DIR、DUACHUOT_BIN_DIR、DUACHUOT_BRANCH。DUACHUOT_SKIP_PIP_UPGRADE=true は、テスト環境や、準備済みのパッケージキャッシュがあるオフライン環境でのみ使用してください。

2. ローカルリポジトリからの手動インストール

cd botduachuot_mcp
./install.sh

scripts/install_basic.sh は互換性のために保持されており、メインのインストーラーに直接転送されます。

3. 設定とインストール後の確認

PATH に ~/.local/bin が含まれていることを確認してください:

export PATH="$HOME/.local/bin:$PATH"

セッションをまたいで有効にするには、この行を ~/.bashrc または ~/.zshrc に追加してください。

サービスを公開する前に .env を設定してください。デフォルトのテンプレートでは認証が必要です:

REQUIRE_AUTH=true
GATEWAY_TOKEN=<secret-random-token>
HOST_WORKSPACE_DIR=/home/user

次に確認します:

duachuot version
duachuot config validate
duachuot doctor

Cloudflare Tunnel 経由での実行

./run_mcp_tunnel.sh
./run_mcp_tunnel.sh --status
./run_mcp_tunnel.sh --url
./run_mcp_tunnel.sh --stop

コネクタ URL は次のようになります:

https://<random>.trycloudflare.com/mcp

Streamable HTTP はステートレスに設定され、JSON を返します。通常のツール呼び出しでは、mcp-session-id は不要で、SSE ストリームも保持されません。

MCP_JSON_RESPONSE=true
MCP_STATELESS_HTTP=true

REST API

REST API は MCP サーバーとホストサービスを共有し、同じサーバー/トンネル上で実行されます。ベースパス:

/api/v1

OpenAPI ドキュメント:

/api/v1/openapi.json

主なエンドポイント:

メソッド

エンドポイント

目的

GET

/api/v1/health

サーバーステータス

GET

/api/v1/capabilities

ツール、ワークスペース、制限

GET

/api/v1/files

ディレクトリ一覧

GET

/api/v1/files/content

テキストファイルの読み取り

PUT

/api/v1/files/content

ファイルの作成または上書き

PATCH

/api/v1/files/content

ファイル内のテキストを置換

POST

/api/v1/files/append

ファイルにコンテンツを追加

POST

/api/v1/directories

ディレクトリの作成

GET

/api/v1/search

ワークスペース内のテキスト検索

POST

/api/v1/commands/check

コマンドの確認

POST

/api/v1/commands/run

ホスト上でコマンドを実行

GET

/api/v1/knowledge

ガイドとツールインベントリの読み取り

REQUIRE_AUTH=true の場合、次のヘッダーのいずれかを使用します:

Authorization: Bearer <GATEWAY_TOKEN>
X-Gateway-Token: <GATEWAY_TOKEN>

例:

BASE_URL="https://<tunnel>.trycloudflare.com"
TOKEN="<GATEWAY_TOKEN>"

curl -H "Authorization: Bearer $TOKEN" \
  "$BASE_URL/api/v1/files?path=GitHub"

curl -X PUT \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"path":"Workspace/demo.txt","content":"hello REST\n"}' \
  "$BASE_URL/api/v1/files/content"

curl -X POST \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"command":"git status --short","cwd":"GitHub/botduachuot_mcp"}' \
  "$BASE_URL/api/v1/commands/run"

MCP ツール

health_check
get_capabilities
duachuot_list_directory
duachuot_read_file
duachuot_write_file
duachuot_replace_in_file
duachuot_append_file
duachuot_make_directory
duachuot_search_text
duachuot_check_command
duachuot_run_command
duachuot_knowledge

duachuot_run_command には approval="approved" パラメータはありません。ポリシーはサーバー側で完全に決定されます。

調査ツール(フォレンジック + OSINT + 地理情報)

BotDuaChot は、完全にオフラインで決定的な 21 の専用調査ツールを追加します:

# Geo Engine (offline, no network required)
duachuot_geo_extract         # EXIF GPS, exiftool/exiv2 cross-check, DOP/HPE, timezone, landmarks
duachuot_geo_scan            # scan arbitrary text/logs/SRT/NMEA/MGRS/UTM for coordinates
duachuot_coord_convert       # DMS/decimal/UTM/MGRS + datum transform (WGS84/ED50/NAD27)
duachuot_geo_calc            # geodesic distance/bearing + uncertainty from DOP/HPE
duachuot_geo_reverse         # offline reverse geocoding (landmarks + country resolution)
duachuot_geo_verify          # conclude only with >= 2 independent facts; fewer -> BLOCKER
duachuot_geo_landmark_check  # radius check around a landmark
duachuot_timezone_at         # offline timezone/UTC offset from coordinates

# Probes
duachuot_media_probe         # file + exiftool JSON + ffprobe
duachuot_pcap_probe          # conversations/endpoints/DNS + GPS hints (NMEA, Wi-Fi probes)
duachuot_disk_probe          # fsstat + fls
duachuot_mem_probe           # Volatility 3 (info/pslist)
duachuot_stego_probe         # binwalk + steghide, WAV LSB detection, LSB/MP3 extraction
duachuot_ocr_probe           # tesseract + QR (zxing-cpp)
duachuot_win_probe           # SAM/SYSTEM hives, LNK, prefetch (pure-Python, Linux/Windows)

# OPSEC + platform
duachuot_ops_check           # blocks telemetry / attack tools / discovery while ctf-live / flags in commands
duachuot_ops_jitter          # human-like delay between network queries
duachuot_ops_redact          # redact secret/flag before writing logs
duachuot_platform            # probe OS/arch/distro/shell + tool availability (native/WSL/missing)
duachuot_plan                # generate an investigation plan by artifact type
duachuot_resource_lookup     # resolve a managed ctf-tools resource from RESOURCE_MAP.json

リソースレジストリ:resources/RESOURCE_MAP.json は、ホストの ctf-tools リポジトリから scripts/generate_resource_map.py によって生成されます(スキル、スクリプト、ツール、bin エントリ、メモ)。ルックアップはパス + 呼び出しテンプレート + 可用性を返します。リソースが欠落している場合は BLOCKER となり、黙ってフォールバックすることはありません。

完全なプレイブック:knowledge/GEO_PLAYBOOK.md、knowledge/FORENSICS_PLAYBOOK.md、knowledge/OSINT_PLAYBOOK.md。同梱スキル:skills/ctf-geo、skills/ctf-forensics-plus、skills/ctf-osint-plus、skills/ctf-stego-plus。

OPSEC(CTF 中は必須)

  • デフォルトの ctf-live:公開ソースのルックアップなし(sherlock/maigret/whois/dnsrecon/検索エンジン)、スコープに対する自動化された攻撃ツールなし、自動フラグ送信なし — 常に人間を介します。

  • investigation モード(OSINT_MODE=true)は、オペレーターが指定するスコープに限定して OSINT ルックアップを有効にします。

  • ネットワーククエリの間は、duachuot_ops_jitter()(800〜3000 ミリ秒)を待機します。

  • すべての座標の結論には、2 つ以上の独立した事実が必要です(duachuot_geo_verify で検証)。

duachuot_knowledge

duachuot_knowledge(section="overview")
duachuot_knowledge(section="guide")
duachuot_knowledge(section="tools", query="python", include_versions=true)
duachuot_knowledge(section="search", query="docker")

このツールは knowledge/ 内のドキュメントを読み取り、TOOL_CATALOG.json をマシンの実際の PATH と照合します。

テスト

./scripts/test.sh
./scripts/quality_gate.sh
./scripts/manual_test_installer.sh

manual_test_installer.sh は、/tmp 内の一時リポジトリと HOME を使用します。実際の Cloudflare トンネルを開始、停止、再起動することはありません。

主要な設定

HOST_WORKSPACE_DIR=/home/light
HOST_RESTRICT_TO_WORKSPACE=true
HOST_COMMAND_POLICY=guarded
MAX_TIMEOUT_SECONDS=60
MAX_OUTPUT_BYTES=500000
REQUIRE_AUTH=true
GATEWAY_TOKEN=<secret>

guarded は、明らかに破壊的な操作に対する保護レイヤーにすぎません。MCP サーバーは、プロセスを開始したユーザーの権限で実行されます。

関連項目:docs/ARCHITECTURE.md および SECURITY.md。

duachuot CLI

このリポジトリには、curl を手書きせずにブリッジ/トンネルを操作し、REST API を呼び出すための統合 CLI が同梱されています。

編集可能なエントリポイントをインストール:

.venv/bin/python -m pip install -e . --no-deps

どちらかの方法で実行:

./bin/duachuot --help
.venv/bin/duachuot --help

ローカル操作グループ:

duachuot start
duachuot status
duachuot url
duachuot server restart   # restart the bridge only, keep the tunnel URL
duachuot restart --yes    # restart the tunnel too, URL may change
duachuot stop

REST API グループ:

duachuot health
duachuot --public health
duachuot capabilities --tools
duachuot fs ls GitHub
duachuot fs cat GitHub/project/README.md --lines 1:40
duachuot fs write GitHub/demo.txt --text "hello"
printf 'next\n' | duachuot fs append GitHub/demo.txt --stdin
duachuot fs search FastMCP --path GitHub/botduachuot_mcp
duachuot cmd check 'git status --short'
duachuot cmd run 'git status --short' --cwd GitHub/botduachuot_mcp
duachuot knowledge tools --query python --versions

操作サポートグループ:

duachuot logs server -n 100
duachuot logs follow server
duachuot config show
duachuot config validate
duachuot doctor
duachuot completion bash

すべてのコマンドは --json をサポートしています。グローバルオプションは、サブコマンドの前後に配置できます:

duachuot --public health --json
duachuot health --public --json

デフォルトでは、CLI はローカルの REST エンドポイント http://127.0.0.1:<MCP_PORT> を呼び出します。--public を使用して logs/tunnel_url.txt から現在の URL を取得するか、--base-url を使用して別のエンドポイントを指定します。

主な終了コード:

0  success
1  operation failed
2  invalid arguments
3  cannot reach the server
4  authentication failed
5  blocked by policy
6  resource not found
7  timeout
8  conflict

duachuot cmd run の場合、サーバーがリクエストレベルでコマンドを正常に実行したとき、CLI の終了コードはコマンドの実際の終了コードを反映します。

完全な設計:docs/CLI_DESIGN_PLAN.md。

追加の CLI ドキュメント:docs/CLI_MANUAL_TEST_PLAN.md および docs/CLI_IMPLEMENTATION_REPORT.md。

運用とリカバリ

統合品質ゲート:

./scripts/quality_gate.sh
./scripts/quality_gate.sh --runtime
./scripts/quality_gate.sh --full

厳格なドクターと設定:

duachuot doctor --local-only
duachuot doctor --strict
duachuot config validate --strict

機密設定を編集した状態で診断情報を収集:

./scripts/collect_diagnostics.sh

インストール、ブリッジのみの再起動(トンネル維持)、リカバリ、ロールバック、および本番チェックリストは、docs/OPERATIONS_RUNBOOK.md に記載されています。

アーキテクチャ、セキュリティ、リリース

  • ランタイムアーキテクチャと境界:docs/ARCHITECTURE.md

  • セキュリティモデルと強化:SECURITY.md

  • 運用、リカバリ、ロールバック:docs/OPERATIONS_RUNBOOK.md

  • リリースチェックリスト:docs/RELEASE_CHECKLIST.md

GitHub Actions は、プッシュとプルリクエストの際に品質ゲートを実行します。Dependabot は Python および GitHub Actions の依存関係を追跡します。

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    C
    maintenance
    MCP server enabling ChatGPT to interact with local filesystem via controlled file operations like read, write, edit, and search, with configurable guardrails for safety.
    MIT
  • A
    license
    Not graded
    quality
    C
    maintenance
    Local MCP server enabling Codex and ChatGPT to read/write files, execute commands, manage processes, use Git, and inspect images on the user's machine with full privileges.
    Apache 2.0