Skip to main content
Glama

MCP Ward — Protocol Autopsy

Catch, explain, and replay broken Model Context Protocol (MCP) connections before they derail Kiro autonomous agents.

Kiroween 2026 License: MIT Zero Paid Services TypeScript Strict Design: UNSLOP


What MCP Ward Does

Autonomous Kiro agents rely heavily on external tool servers communicating via the Model Context Protocol (MCP). When an MCP server connection breaks—due to an expired bearer token, malformed JSON Schema in tools/list, transport timeouts, or protocol version mismatches—agents frequently stall, crash, or enter infinite recovery loops without actionable root-cause diagnostics.

MCP Ward is a pre-execution diagnostic workstation and runtime tool server designed for agent developers:

  1. Pre-flight Configuration Validator: Ingests, validates, and redacts .kiro/settings/mcp.json client configurations against official MCP specifications before agent boot.

  2. Live Protocol Autopsy: Streams real-time handshake and capability telemetry over Server-Sent Events (SSE). It differentiates root causes from downstream symptoms (e.g. isolating an initial HTTP 403 Forbidden from a secondary HTTP 405 Method Not Allowed triggered by client fallback).

  3. Dual-Transport Client Engine: Implements the modern MCP Streamable HTTP transport with chunked transfer parsing and strictly qualified fallback to legacy HTTP+SSE.

  4. Deterministic Replay Lab: Replays recorded failure scenarios to test agent resilience, benchmark recovery logic, and reproduce edge cases offline.

  5. Local Kiro MCP Tool Server: Directly callable by Kiro agents via stdio (ward.validate_config, ward.probe_remote_server, ward.replay_scenario).

  6. Local Forensic Ledger: Persists investigation traces and telemetry in local browser IndexedDB with zero cloud storage dependencies.


Related MCP server: Keel

Design System: The Diagnostic Oscilloscope

Crafted using the official UNSLOP methodology (Damir Sokolovsky), MCP Ward rejects generic AI dashboard tropes—no purple neon gradients, no pulsing decorative blobs, no emoji badges, and no shouting uppercase text.

  • World: A precision hardware packet inspection and oscilloscope rack in a dark laboratory.

  • Palette: Deep carbon slate surfaces (#111114, #18171E), quiet hairline boundaries (#201F29), and a restrained focal violet accent (#8B5CF6).

  • Typography: Space Grotesk (structured headings), IBM Plex Sans (high-legibility body), and IBM Plex Mono (tabular figures and byte-level protocol payloads).

  • Signature Moment: Chronological causal linking connecting root-cause triggers directly to downstream symptoms in the Protocol Timeline.


System Architecture

[ Kiro Agent IDE / Browser Workbench ]
                 │
                 │ REST / Server-Sent Events (SSE) / stdio
                 ▼
[ Next.js 15 App Router (/api/diagnostics/*) ]
                 │
                 ▼
[ Diagnostics Adapter Dispatcher ]
    ├── MockDiagnosticsAdapter (Deterministic Offline Fixtures)
    ├── LiveDiagnosticsAdapter (Sandboxed TLS & Socket Pinning)
    └── ReplayDiagnosticsAdapter (Monotonic Sequence Playback)
                 │
                 ▼
[ Protocol Engine & Security Perimeter ]
    ├── DNS Pre-Resolution & Socket Pinning (dns/promises.lookup)
    ├── SSRF Guard (Rejects loopback, RFC 1918, link-local, AWS/GCP metadata)
    ├── Bounded Streaming Fetch (1 MB response ceiling chunk-by-chunk)
    ├── Dual MCP Transport (Streamable HTTP + qualified legacy SSE)
    ├── Dynamic Version Negotiator (@modelcontextprotocol/sdk dynamic types)
    └── Secret Redactor (Sanitizes Authorization, cookies, and tokens)
                 │
                 ▼
[ Forensic Storage Ledger (Browser IndexedDB + In-Memory Fallback) ]

Zero-Paid Services Guarantee

MCP Ward is 100% self-contained and cost-free:

  • Zero Paid Databases: Persists runs locally in browser IndexedDB with in-memory fallbacks.

  • Zero Paid LLM APIs: Deterministic rules engine and evidence correlator run fully locally without external commercial LLM API dependencies.

  • Zero Paid Hosting: Runs locally via npm run dev or deploys on free-tier platforms.


Quickstart & Installation

1. Prerequisites

  • Node.js >= 20.0.0

  • npm >= 10.0.0

2. Clone and Install

git clone https://github.com/your-username/mcp-ward.git
cd mcp-ward
npm install

3. Environment Setup

cp .env.example .env.local

Key parameters:

  • DATA_MODE=mock: Operates in mock (default), live (live), or replay (replay) mode.

  • MCP_PROBE_TIMEOUT_MS=8000: SLA probe timeout in milliseconds.

  • MCP_MAX_RESPONSE_BYTES=1048576: 1 MB response body buffer ceiling.

  • MCP_ALLOW_PRIVATE_TARGETS=false: Production SSRF perimeter lock.

4. Seed Scenario Catalog

npm run seed

5. Start Development Server

npm run dev

Open http://localhost:3000 to launch the MCP Ward Forensic Workbench.


Kiro IDE Integration

MCP Ward runs as an active Model Context Protocol server inside Kiro IDE.

Configuration (.kiro/settings/mcp.json)

{
  "mcpServers": {
    "mcp-ward": {
      "command": "npx",
      "args": ["tsx", "src/mcp-server/index.ts"],
      "env": {
        "DATA_MODE": "mock",
        "MCP_PROBE_TIMEOUT_MS": "8000",
        "MCP_MAX_RESPONSE_BYTES": "1048576",
        "MCP_ALLOW_PRIVATE_TARGETS": "false"
      }
    }
  }
}

Available Kiro MCP Tools

  1. ward.validate_config: Ingests and validates client configuration schemas, redacting sensitive authorization keys.

  2. ward.probe_remote_server: Initiates a sandboxed, TLS-verified diagnostic handshake against an HTTPS MCP endpoint.

  3. ward.replay_scenario: Executes deterministic autopsy replay on recorded failure traces.

To run the MCP server standalone over stdio:

npm run mcp:serve

Security Architecture

Security Guard

Mechanism

Verification

DNS Pinning

Pre-resolves all IPv4/IPv6 addresses via dns/promises.lookup(hostname, { all: true }). Custom lookup callback on https.Agent pins socket connection to the pre-validated IP, eliminating TOCTOU DNS rebinding.

Tested in test-live-security.ts

SSRF Prevention

Fails closed on loopback (127.0.0.1), private RFC 1918, link-local, carrier-grade NAT, and cloud metadata (169.254.169.254). Production allowPrivate strictly locked to test runtime.

Tested in test-security.ts

Streaming Ceiling

Rejects Content-Length > 1048576 bytes upfront and meters incoming stream chunks dynamically. Destroys sockets exceeding 1 MB.

Tested in test-pinned-fetch.ts

Redirect Rejection

Rejects HTTP 301, 302, 303, 307, 308 redirects to eliminate redirect-based SSRF.

Tested in test-pinned-fetch.ts

Hosted Stdio Block

Rejects stdio transport configs during hosted live probing (isHostedPermitted: false). child_process is never imported in live adapters.

Tested in test-live-diagnostics.ts

Credential Scrubbing

Automatic redaction of Authorization headers, API keys, cookies, and tokens in URLs before emission to logs or storage.

Tested in test-security.ts


Scenario Catalog & Replay Lab

MCP Ward includes 6 pre-recorded canonical failure scenarios:

  • Scenario A (auth-failure-403-405) [Signature Cascade]: Remote gateway rejects an expired Bearer token with HTTP 403 Forbidden. Client fallback logic attempts POST to SSE stream, resulting in downstream HTTP 405 Method Not Allowed. MCP Ward isolates 403 as root cause.

  • Scenario F (auth-failure-401): Target server rejects credentials with HTTP 401 Unauthorized during SSE handshake.

  • Scenario B (transport-timeout-8s): Remote server hangs during SSE announcement, breaching 8000ms SLA.

  • Scenario C (protocol-mismatch-version): Server responds with deprecated MCP protocol version (2023-01-01).

  • Scenario D (healthy-baseline): Fully compliant reference server negotiating MCP 2024-11-05 and exposing 4 validated tool schemas.

  • Scenario E (schema-invalid-tools): Target exposes tool definitions missing JSON Schema object properties.


Automated Smoke Verification Suite

Run the full project quality gate:

npm run smoke

The smoke runner executes 14 synchronous steps (499 automated assertions):

  1. TypeScript Static Typecheck (strict: true)

  2. Deterministic Fixture Seed (scripts/seed.ts)

  3. Config Validator Acceptance Tests (62 assertions)

  4. Diagnosis Engine Tests (86 assertions)

  5. Replay State Synchronization Tests (5 assertions)

  6. Security Perimeter & Redaction Tests (42 assertions)

  7. Adapter & Storage Integration Tests (14 assertions)

  8. Live Security, DNS Pinning & Socket Handshake Tests (97 assertions)

  9. Pinned Fetch & 1 MB Streaming Guard Tests (67 assertions)

  10. MCP Dual Transport & Qualified Fallback Tests (24 assertions)

  11. Live Diagnostics Engine & SSRF Policy Tests (51 assertions)

  12. Local MCP Stdio Server Integration Tests (18 assertions)

  13. SSE Route Handlers Integration Tests (33 assertions)

  14. Next.js Production Build (next build)


License

This project is licensed under the MIT License — see the LICENSE file for details.

The UNSLOP design skill installed in .agents/skills/unslop/ is licensed under CC BY 4.0 by Damir Sokolovsky (@heydamir, heydamir.design/unslop).

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      D
      maintenance
      Enables AI agents to programmatically inspect, test, and validate other MCP servers by exposing MCP Workbench capabilities as structured tools. It supports automated test spec generation, execution, and detailed failure analysis to ensure server reliability.
      4
      9 npm
      Apache 2.0
    • A
      license
      A
      quality
      C
      maintenance
      Network diagnostics — ping, traceroute, DNS lookup, port scanning, and connectivity testing via MCP.
      14
      MIT
    • A
      license
      A
      quality
      C
      maintenance
      An MCP server that unpacks and structures Playwright trace.zip archives so AI agents can perform root-cause analysis on CI failures, with 16 focused tools for inspection, DOM/UI analysis, root-cause analysis, and performance analysis.
      19
      60 npm
      1
      MIT
    • A
      license
      A
      quality
      B
      maintenance
      MCP server for on-demand network diagnostics, providing DNS lookups with DNSSEC checks, ping, traceroute, TCP port checks, HTTP checks, TLS certificate inspection, WHOIS, and ASN lookups.
      12
      155 PyPI
      MIT