# Apollo MCP Server — Local development
# Points at a router running on localhost and loads tools from local .graphql
# files, so you can iterate without GraphOS credentials.

# Local router (e.g. `make dev` in graphql-router, or router-binary/router).
endpoint: ${env.GRAPHQL_ROUTER_URL:-https://qa-graphql-router-mcp.theorchard.io/graphql}

transport:
  type: streamable_http
  address: 0.0.0.0
  port: ${env.MCP_PORT:-8080}
  # OAuth 2.1 (Auth0) — Claude Code / MCP clients authenticate via Auth0
  # (Auth Code + PKCE) on first /mcp. This server is only a resource server:
  # it advertises Auth0, validates the JWT (signature/audience/issuer), then
  # forwards the bearer to the local router. Mirrors config/mcp.qa.yaml.
  auth:
    servers:
      - "https://qa-orchard.auth0.com/"
    audiences:
      - "https://workstation.qaorch.com/api"   # reuse the existing Orchard audience (no dedicated MCP API)
    # Bare origin (no /mcp path) so PRM is served at the ROOT
    # /.well-known/oauth-protected-resource, mirroring mcp.qa.yaml so local discovery
    # behaves the same. Tracks MCP_PORT.
    resource: "http://localhost:${env.MCP_PORT:-8080}"
    scopes: []
    scope_mode: disabled                        # router + PDP enforce downstream

# Local operation files become MCP tools (hot-reloaded). One operation per file.
operations:
  source: local
  paths:
    - /data/operations/   # in the container; repo path is ./operations/

# Forward the caller's bearer token + profile/identity headers (e.g. set in the
# MCP Inspector's Custom Headers) through to the local router, which propagates
# them to subgraphs.
forward_headers:
  - authorization
  - apollographql-client-name
  - user-agent


# Tag the client; the router's require_apollo_client_name plugin needs it.
headers:
  apollographql-client-name: "apollo-mcp-local"

# Handy locally: let the agent explore the schema. Keep OFF in QA/prod.
introspection:
  introspect:
    enabled: true
  search:
    enabled: true
  validate:
    enabled: true
  execute:
    enabled: true

server_info:
  name: "PDEGO MCP (local)"
  description: "Local MCP surface over a localhost router"
  version: ${env.VERSION}

telemetry:
  service_name: apollo-mcp
  version: ${env.VERSION:-apollo-mcp-1.15.0}
  exporters:
    metrics:
      otlp:
        endpoint: http://datadog:4317
        protocol: grpc
        metadata:
          env: dev
          service.name: apollo-mcp
    tracing:
      otlp:
        endpoint: http://datadog:4317
        protocol: grpc
        metadata:
          env: dev
          service.name: apollo-mcp

logging:
  level: debug
