KB-257B rev 18

Agent Connections — Ai kết nối gì, qua đâu

7 min read Revision 18
agentsconnectionsmcpgpt-actionscurrent-state

Agent Connections — DEPRECATED

⚠️ FILE NÀY ĐÃ DEPRECATED từ 2026-03-01 ĐỌC SSOT MỚI: search_knowledge("connection dashboard") Path: knowledge/dev/ssot/connections/connection-dashboard.md Config map: knowledge/dev/ssot/connections/connection-config-map.md

File này giữ lại làm tham khảo lịch sử. KHÔNG cập nhật nữa.

Tổng quan kết nối

                    ┌─────────────────────────┐
                    │      Agent Data API      │
                    │  vps...saigoncorp.vn/api │
                    └──┬──────┬──────┬────────┘
                       │      │      │
         STDIO→HTTP    │      │      │  GPT Action (HTTP)
          bridge       │      │      │
           ┌───────────┘      │      └───────────┐
           │                  │                   │
  ┌────────┴────────┐  ┌─────┴──────┐   ┌───────┴──────────┐
  │ Claude Desktop  │  │Claude Code │   │   GPT (ChatGPT)  │
  │ (STDIO→HTTP     │  │Codex       │   └───────┬──────────┘
  │  bridge)        │  │Antigravity │           │
  └────────┬────────┘  │(HTTP MCP)  │     GPT Action (HTTP)
           │           └─────┬──────┘           │
    STDIO→HTTP bridge  HTTP MCP        ┌───────┴──────────┐
           │                 │          │    OPS Proxy     │
  ┌────────┴────────┐   ┌────┴────┐    │ ops.incomex...vn │
  │    Directus     │   │Directus │    └──────────────────┘
  │  .incomex...vn  │   │(DOT 71+)│
  └─────────────────┘   └─────────┘

⚠️ HTTP MCP = CHUẨN DUY NHẤT (Operating Rules §I-B) stdio chỉ dùng làm bridge khi client không hỗ trợ HTTP (Claude Desktop).

Chi tiết từng Agent

Claude Desktop (Điều hành)

Kết nối Protocol Endpoint Auth Auto-start
Agent Data STDIO→HTTP bridge stdio_server.py → HTTP → VPS Agent Data API Env → X-API-Key
Directus STDIO→HTTP bridge directus_stdio_server.py → Directus API Env

Platform limitation: Claude Desktop KHÔNG hỗ trợ HTTP MCP trực tiếp. mcp-remote không hỗ trợ custom headers (X-API-Key). stdio_server.py đóng vai trò bridge: STDIO → HTTP → VPS. Đây là kiến trúc đúng và duy nhất khả thi. Vai trò: Điều hành, kiểm tra ngắn, giao việc. KHÔNG code, KHÔNG fix CI.

Claude Code CLI (Thực thi chính)

Kết nối Protocol Config file Auth
Agent Data HTTP MCP (Streamable HTTP) .mcp.json (repo) + ~/.claude/mcp.json (global) env var AGENT_DATA_API_KEY
Directus DOT tools (71+) credentials.local.json Admin token
Headless dispatch -p flag Spawn by orchestrator

WEB-87 Phase 3 + MCP-UNIFY Verified: HTTP MCP PASS. PRs #276 + #393 merged. Global config migrated. Trạng thái: ✅ HOÀN THÀNH — CRUD đầy đủ, không hardcode, portable MacBook↔Mac Mini.

Codex CLI

Kết nối Protocol Config file Auth
Agent Data HTTP MCP (Streamable HTTP) ~/.codex/config.toml env var AGENT_DATA_API_KEY via env_http_headers

WEB-87 Phase 4: 10/10 MCP tools PASS. Model gpt-5.3-codex. MCP-UNIFY: Config đã đúng HTTP MCP. Client-side verify: ⏳ PENDING (cần test thực tế). Lệnh: codex-adtest (agent-data-test) hoặc codex-web (web-test). PHẢI chạy trong repo, không chạy từ ~. Latency: 7-14s (cao hơn Claude Code ~2x do rmcp overhead). Functional OK. Trạng thái: ✅ Config correct, ⏳ client verify pending

Antigravity (Schema Apply)

Kết nối Protocol Config file Auth
Agent Data HTTP MCP .mcp.json (shared với Claude Code) X-API-Key từ env

WEB-87 Phase 4: HTTP MCP endpoint responds, tools listed. Trạng thái: ⏳ Search + Read PASS, Write/Delete chưa test.

GPT (Custom GPT: Incomex Agent Data)

Action Hostname Mục đích Auth
Agent Data (KB) vps.incomexsaigoncorp.vn/api Đọc/ghi tài liệu, vector search X-API-Key
OPS Proxy ops.incomexsaigoncorp.vn CRUD tasks, task_comments, ai_tasks X-API-Key

GPT Editor: https://chatgpt.com/gpts/editor/g-698e785e1180819191fa1711bfec75e1 OpenAPI Spec (WEB-85B):

  • Agent Data: https://vps.incomexsaigoncorp.vn/api/openapi.json
  • OPS Proxy: https://ops.incomexsaigoncorp.vn/openapi.json
  • RULE: Import from URL only. NEVER paste raw spec.

MCP-UNIFY Verified: POST /api/chat 200 OK, GET /ops/items/tasks 200 OK, OpenAPI specs OK. Lưu ý: Mỗi lần GPT gọi Action → ChatGPT hiện "Confirm" dialog. Orchestrator (Playwright) phải auto-click.

Gemini (Giám sát)

Kết nối Protocol Endpoint Auth
Agent Data HTTP MCP (via envsubst) vps.incomexsaigoncorp.vn/api/mcp Env → settings.template.json → envsubst
Directus STDIO MCP directus_stdio_server.py Env

GEMINI-SECURE (2026-03-01): envsubst template injection giải quyết API key hardcode. _gemini_inject_config() chạy trước mỗi gemini alias. 8/8 tests PASS. 21 tools (11 Agent Data + 10 Directus). Trạng thái: ✅ HOÀN THÀNH — MCP secured, 21 tools, TD-050 RESOLVED.

OPS Proxy Whitelist

⚠️ CONN-AUDIT 2026-03-01: CONN-FINAL báo 23 collections OK nhưng posts trả 404 qua OPS Proxy (TD-045). Cần debug nginx config.

Collection GET POST PATCH DELETE
tasks
task_comments
ai_tasks ✅ (GET+PATCH only)
posts ❌ 404 (TD-045)
+ 19 khác từ CONN-FINAL chưa verify từng cái

MCP Tools Available (11 tools — WEB-87 + MCP-UNIFY verified)

Tool Mục đích
search_knowledge Vector search toàn bộ Agent Data
list_documents Liệt kê documents theo path
get_document Đọc document (truncated + related)
get_document_for_rewrite Đọc full content (cho rewrite)
upload_document Tạo document mới
update_document Ghi đè toàn bộ document
patch_document Sửa section cụ thể (old_str → new_str)
delete_document Xóa document
batch_read Đọc nhiều docs 1 lần (max 20)
move_document Di chuyển document
ingest_document Ingest từ GCS/URL

Connection Protection (MCP-UNIFY 2026-02-28)

Tool Location Mục đích
test-mcp-connectivity.sh /opt/incomex/scripts/ Test 5 endpoints trước/sau deployment
check-config-integrity.sh /opt/incomex/scripts/ Verify SHA256 nginx + docker-compose
Uptime Kuma localhost:3001 ⏳ MCP POST monitor chưa setup