|
| 1 | +server: |
| 2 | + port: 8080 |
| 3 | + read_timeout: 30s |
| 4 | + write_timeout: 60s |
| 5 | + shutdown_timeout: 10s |
| 6 | + max_request_body: 1MB |
| 7 | + startup_validation_timeout: 30s # per-upstream timeout for jq dry-run at startup |
| 8 | + # on hot-reload: exceeded → abandon reload, keep old config |
| 9 | + transport: # list of enabled transports |
| 10 | + - streamable-http # primary: POST+GET on group endpoint paths |
| 11 | + - sse # legacy: GET on {endpoint}/sse paths |
| 12 | + |
| 13 | +telemetry: |
| 14 | + otlp_endpoint: "otel-collector:4317" |
| 15 | + service_name: "mcp-anything" |
| 16 | + service_version: "v0.1.0" |
| 17 | + insecure: false |
| 18 | + |
| 19 | +# Default inbound auth — applies to all operations unless x-mcp-auth-required: false |
| 20 | +inbound_auth: |
| 21 | + strategy: jwt # jwt | introspection | apikey | lua | none |
| 22 | + jwt: |
| 23 | + issuer: "https://idp.example.com" |
| 24 | + audience: "https://mcp.example.com" |
| 25 | + jwks_url: "" # optional; if empty, uses issuer discovery |
| 26 | + introspection: |
| 27 | + issuer: "https://idp.example.com" |
| 28 | + client_id: "${INTROSPECTION_CLIENT_ID}" |
| 29 | + client_secret: "${INTROSPECTION_CLIENT_SECRET}" |
| 30 | + audience: "https://mcp.example.com" |
| 31 | + apikey: |
| 32 | + header: "X-API-Key" |
| 33 | + keys_env: "MCP_API_KEYS" # comma-separated list in env var |
| 34 | + lua: |
| 35 | + script_path: "/etc/mcp-anything/auth.lua" |
| 36 | + timeout: 500ms |
| 37 | + |
| 38 | +naming: |
| 39 | + separator: "__" |
| 40 | + max_length: 128 |
| 41 | + conflict_resolution: error # error | first_wins | skip |
| 42 | + description_max_length: 1024 # 0 = no truncation |
| 43 | + description_truncation_suffix: "..." |
| 44 | + default_slug_rules: |
| 45 | + replace_slashes: true |
| 46 | + replace_braces: true |
| 47 | + lowercase: true |
| 48 | + collapse_separators: true |
| 49 | + |
| 50 | +upstreams: |
| 51 | + - name: petstore |
| 52 | + enabled: true |
| 53 | + tool_prefix: pets |
| 54 | + base_url: "https://api.petstore.io/v2" |
| 55 | + max_response_body: 10MB |
| 56 | + timeout: 10s |
| 57 | + tls_skip_verify: false |
| 58 | + headers: |
| 59 | + X-Proxy-Source: "mcp-anything" |
| 60 | + |
| 61 | + openapi: |
| 62 | + source: "/etc/mcp-anything/specs/petstore.yaml" # file path or https:// URL |
| 63 | + auth_header: "" # "Bearer ${TOKEN}" for private docs |
| 64 | + refresh_interval: 0 # 0 = no refresh; >0 = background URL refresh |
| 65 | + max_refresh_failures: 5 |
| 66 | + allow_external_refs: false |
| 67 | + version: "3.0" |
| 68 | + |
| 69 | + # Overlay is always applied after spec load and re-applied on every refresh. |
| 70 | + # source may be a file path or https:// URL. |
| 71 | + # auth_header and refresh_interval are independent of the spec's values. |
| 72 | + overlay: |
| 73 | + source: "/etc/mcp-anything/overlays/petstore-overlay.yaml" |
| 74 | + auth_header: "" |
| 75 | + refresh_interval: 0 # 0 = refresh together with openapi.refresh_interval |
| 76 | + |
| 77 | + outbound_auth: |
| 78 | + strategy: oauth2_client_credentials |
| 79 | + oauth2_client_credentials: |
| 80 | + token_url: "https://idp.example.com/oauth/token" |
| 81 | + client_id: "${PETSTORE_CLIENT_ID}" |
| 82 | + client_secret: "${PETSTORE_CLIENT_SECRET}" |
| 83 | + scopes: ["read:pets", "write:pets"] |
| 84 | + bearer: |
| 85 | + token_env: "UPSTREAM_TOKEN" |
| 86 | + api_key: |
| 87 | + header: "X-API-Key" |
| 88 | + value_env: "UPSTREAM_API_KEY" |
| 89 | + prefix: "" # prepended to env value, e.g. "ApiKey " |
| 90 | + lua: |
| 91 | + script_path: "/etc/mcp-anything/upstream-auth.lua" |
| 92 | + timeout: 500ms |
| 93 | + |
| 94 | + validation: |
| 95 | + validate_request: true |
| 96 | + validate_response: true |
| 97 | + response_validation_failure: warn # warn | fail |
| 98 | + success_status: [200, 201, 202, 204] |
| 99 | + error_status: [400, 401, 403, 404, 422, 429, 500, 502, 503] |
| 100 | + |
| 101 | + - name: github |
| 102 | + enabled: true |
| 103 | + tool_prefix: gh |
| 104 | + base_url: "https://api.github.com" |
| 105 | + openapi: |
| 106 | + source: "https://raw.githubusercontent.com/github/rest-api-description/main/descriptions/api.github.com/api.github.qkg1.top.yaml" |
| 107 | + refresh_interval: 1h |
| 108 | + overlay: |
| 109 | + source: "https://raw.githubusercontent.com/github/rest-api-description/main/descriptions/api.github.com/mcp-overlay.yaml" |
| 110 | + refresh_interval: 1h |
| 111 | + outbound_auth: |
| 112 | + strategy: bearer |
| 113 | + bearer: |
| 114 | + token_env: "GITHUB_TOKEN" |
| 115 | + |
| 116 | +groups: |
| 117 | + - name: all |
| 118 | + endpoint: /mcp |
| 119 | + upstreams: [petstore, github] |
| 120 | + # no filter = all tools from all listed upstreams |
| 121 | + |
| 122 | + - name: readonly |
| 123 | + endpoint: /mcp/readonly |
| 124 | + upstreams: [petstore] |
| 125 | + # RFC 9535 JSONPath filter evaluated against each operation node |
| 126 | + filter: "$.paths.*.get[?(@['x-mcp-safe'] == true)]" |
| 127 | + |
| 128 | + - name: premium |
| 129 | + endpoint: /mcp/premium |
| 130 | + upstreams: [petstore, github] |
| 131 | + filter: "$.paths.*.*[?(@['x-mcp-tier'] == 'premium')]" |
0 commit comments