Skip to main content
Glama
gateway_lab.mcp_server

gateway_lab.mcp_server

by adi0ri

FDE Assessment

Python implementations of four tasks covering MCP servers, security gateways, streaming guardrails, and model routing.

Tasks

Task

Implementation

1. MCP server

Official SDK stdio server with strict input validation and JSON-RPC errors

2. MCP gateway

JWT authentication and tool authorization for admin_* calls

3. Streaming guardrail

Bounded PII redaction for emails, SSNs, and card numbers across chunks

4. Model router

SQLite token limiter and fallback routing: 50,000 tokens/minute/key, 3-second primary timeout

Related MCP server: Easy MCP Server

Setup

Requires Python 3.11+.

python -m venv .venv

Activate with source .venv/bin/activate (macOS/Linux) or .\.venv\Scripts\Activate.ps1 (Windows PowerShell), then run:

python -m pip install -r requirements.lock
python -m pip install -e . --no-deps
python -m gateway_lab.demo

The gateway runs at http://127.0.0.1:9000, with mock upstreams on port 9001. Demo credentials are printed in the terminal. No paid API keys are needed; refunds are simulated.

From another activated terminal, run python scripts/exercise_gateway.py to check authorization, streaming redaction, and fallback. Use python -m gateway_lab.mcp_server for the standalone stdio server.

Tests

python -m pytest -q
python -m ruff check .
python -m ruff format --check .
python -m pip check

65 tests cover protocol handling, authorization, stream boundaries, SQLite concurrency, and fallback. CI runs on Windows and Linux with Python 3.11 and 3.13.

See design notes, verification results, and configuration for details.

Available Tools

2 tools
get_customer_recordC

Fetch a mock customer record

Inputs: customer_id (required).

trigger_refundB

Simulate a refund; no real money moves

Inputs: amount (required), reason (required), customer_id (required).

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    B3.2/5.0

    Scored across 2 tools

    Disambiguation5/5

    The two tools perform clearly separate operations: retrieving a customer record versus triggering a refund. There is no functional overlap or ambiguity between them.

    Naming Consistency5/5

    Both tool names follow the same snake_case verb_noun pattern (get_customer_record, trigger_refund). The naming is concise, predictable, and consistent.

    Tool Count3/5

    Two tools is at the low end of what feels useful; for a mock lab it may be intentional, but the surface is thin. Each tool earns its place, but there is little room for broader workflows.

    Completeness2/5

    The server covers a single lookup and a single action, with no way to list customers, check refund status, or cancel/reverse a refund. Agents would hit dead ends for any multi-step workflow beyond a simple demo.

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      A simple toolkit for creating MCP servers with stdio and SSE transport, auto-validating tools via Pydantic.
      MIT
    • -
      license
      Not graded
      quality
      Not graded
      maintenance
      An MCP server that validates tool calls against JSON Schema, performs deterministic repair, redacts secrets, and maintains a hash-chained audit ledger.
      -
    • F
      license
      C
      quality
      D
      maintenance
      Schema-driven MCP server that exposes all Paperclip API operations as typed MCP tools over stdio or Streamable HTTP, supporting both authenticated and local_mode deployments.
      100
      -