☀️ yas-mcp

May 20, 2026 · View on GitHub

Turn any REST API into AI tools — in 30 seconds.

Point yas-mcp at an OpenAPI spec and it becomes an MCP server your AI assistant can call. It also speaks the A2A protocol for agent-to-agent communication. Auth, metrics, and caching are built in.

# 1. Point at an OpenAPI spec
yas-mcp --swagger-file https://petstore3.swagger.io/api/v3/openapi.json --mode http

# 2. That's it. Your AI can now call:
#    • tools/list  → "What can you do?"
#    • tools/call  → "List all pets, create an order, update user..."

✨ What It Does

You haveyas-mcp gives you
An OpenAPI/Swagger fileAn MCP server with typed tools
An OIDC provider URLAuto-discovered OAuth2 protection
Multiple APIsOne proxy serving all of them
AI agents that need to chatA2A protocol for agent-to-agent delegation
Production requirementsMetrics, rate limiting, circuit breakers, caching
   OpenAPI Spec                yas-mcp                   AI Assistant
  ┌──────────────┐         ┌──────────────┐         ┌──────────────┐
  │  GET /pets   │────────▶│  listPets()  │────────▶│  "List all    │
  │  POST /pets  │         │  createPet() │         │   available  │
  │  GET /store  │         │  getOrders() │         │   pets"      │
  │  ...         │         │  ...         │         └──────────────┘
  └──────────────┘         └──────┬───────┘

                        ┌─────────┼─────────┐
                        │         │         │
                  ┌─────▼────┐ ┌─▼──────┐ ┌─▼──────────┐
                  │  Dex     │ │  A2A   │ │ Prometheus │
                  │  (OIDC)  │ │ Agents │ │  /metrics  │
                  └──────────┘ └────────┘ └────────────┘

🚀 Quickstart

git clone https://github.com/allen-munsch/yas-mcp.git
cd yas-mcp

# Start with the built-in Todo API example
docker compose up -d

# Verify it's alive
curl http://localhost:3000/health
# → OK

# List available tools
curl -s -X POST http://localhost:3000/mcp \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}' | jq

# Run the flying probe to verify everything
make probe

Option 2: Build from source

cargo build --release
./target/release/yas-mcp \
  --swagger-file examples/petstore.yaml \
  --mode http \
  --port 3000

Option 3: Use your own API

docker compose up -d
# Edit the mounted config to point at your API
# Or:
export SWAGGER_FILE_PATH=~/my-api/openapi.yaml
docker compose up -d

🧪 Flying Probe

Like a circuit board tester, the flying probe systematically verifies every surface of your yas-mcp deployment:

# Local probe
bash scripts/flying-probe.sh

# Docker probe
docker compose --profile probe run --rm flying-probe

# Kubernetes — runs continuously as a sidecar + CronJob
kubectl apply -k deploy/minikube/base

7 boards tested: Health & Discovery → MCP Protocol → Tool Calls → A2A Lifecycle → Auth Middleware → Rate Limits → Signal Quality. See scripts/flying-probe.sh.

📋 Configuration

Everything goes in config.yaml. Here's the full menu:

server:
  mode: http          # stdio | http
  port: 3000
  host: 0.0.0.0

# Give it an OpenAPI spec — yas-mcp does the rest
swagger_file: "examples/todo-app/openapi.yaml"

# Auto-discover OIDC — just paste the issuer URL
oauth:
  enabled: true
  provider: oidc
  issuer_url: "https://dex.example.com"
  client_id: "${OIDC_CLIENT_ID}"
  client_secret: "env://OIDC_CLIENT_SECRET"  # ← secret refs!

# A2A protocol for agent-to-agent delegation
a2a:
  enabled: true
  agent_card_name: "My API Agent"

# Production safeguards
cache:
  enabled: true
  default_ttl_secs: 60

# Auth middleware — chain multiple providers
auth:
  middleware_chain:
    - type: bearer_token
      route_filter: "/api/**"
      config:
        token: "env://API_TOKEN"

Secret References

Never put raw secrets in config. Use references instead:

ReferenceSource
env://MY_VAREnvironment variable
file:///run/secrets/tokenDocker/K8s secret file
literal://valueExplicit literal (for clarity)

🏗️ Architecture

src/
├── internal/
│   ├── a2a/           A2A protocol (agent card, task store, SSE streaming)
│   ├── auth/          OIDC discovery, JWKS validation, OAuth2 providers
│   ├── catalog/       AI Catalog auto-generation
│   ├── config/        Layered config (YAML + env + CLI)
│   ├── control/       Rate limiting, circuit breakers, response caching
│   ├── mcp/           MCP processor, tool registry, protocol types
│   ├── parser/        OpenAPI 3.x parser (YAML/JSON)
│   ├── requester/     HTTP client, route executors
│   ├── secrets/       Secret resolution (env://, file://, custom backends)
│   ├── server/        HTTP server, tool handler, auth middleware
│   ├── telemetry/     Prometheus metrics
│   └── transport/     STDIO transport, mock transport, runner

🔧 Development

make build          # cargo build --release
make test-unit      # 214 unit tests
make lint           # clippy --all-targets
make fmt            # cargo fmt

make probe          # flying probe against local server
make test-e2e       # docker compose integration tests
make test-a2a       # A2A protocol tests
make test-full      # full stack: Dex OIDC + MCP + A2A
make test-all       # everything

📊 Endpoints

EndpointMethodWhat
/healthGETHealth check
/metricsGETPrometheus metrics (counters, histograms, gauges)
/mcpPOSTMCP JSON-RPC (tools/list, tools/call, initialize, ping)
/.well-known/agent-card.jsonGETA2A Agent Card (discovery)
/a2a/tasks/sendPOSTSubmit A2A task
/a2a/tasks/sendSubscribePOSTSubmit + SSE streaming updates
/a2a/tasks/getGETGet task status
/a2a/tasks/cancelPOSTCancel a task
/.well-known/ai-catalog.jsonGETAI Catalog (cross-protocol discovery)

🛡️ Production Features

  • ✅ Prometheus metrics with per-tool counters, histograms, error rates
  • ✅ Rate limiting — token bucket per client, configurable burst/refill
  • ✅ Circuit breakers — per-upstream failure detection, half-open probing
  • ✅ Response caching — TTL-based, per-route overrides, invalidation
  • ✅ Graceful shutdown — SIGTERM drain with in-flight request completion
  • ✅ Auth middleware chain — bearer token, API key, custom providers
  • ✅ OIDC discovery — issuer_url → auto-configured auth endpoints
  • ✅ JWKS validation — JWT signature verification with key rotation
  • ✅ Secret references — env://, file://, never hardcode secrets
  • ✅ Flying probe — continuous system health verification

📚 More Docs

GNU Affero General Public License v3.0 only

License

AGPL-3.0-only