{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://dynamicmcp.tools/config.json",
  "title": "dynmcp config",
  "description": "Configuration file for dynmcp. Declares the set of upstream MCPs to proxy through dynamic-discovery-mcp.",
  "type": "object",
  "properties": {
    "env": {
      "type": "string",
      "enum": [
        "enable",
        "dotenv",
        "process",
        "disable"
      ],
      "description": "Controls environment variable interpolation in config values. \"enable\" (default) merges .env and process.env (.env wins). \"dotenv\" loads .env only. \"process\" uses process.env only. \"disable\" turns interpolation off."
    },
    "mcp": {
      "type": "object",
      "propertyNames": {
        "type": "string",
        "pattern": "^[a-z0-9][a-z0-9-]*$"
      },
      "additionalProperties": {
        "oneOf": [
          {
            "type": "object",
            "properties": {
              "transport": {
                "type": "string",
                "const": "stdio"
              },
              "description": {
                "type": "string",
                "minLength": 1
              },
              "command": {
                "type": "string"
              },
              "args": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "env": {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {
                  "type": "string"
                }
              }
            },
            "required": [
              "transport",
              "command"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "transport": {
                "type": "string",
                "const": "streamable-http"
              },
              "description": {
                "type": "string",
                "minLength": 1
              },
              "url": {
                "type": "string",
                "format": "uri"
              },
              "headers": {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {
                  "type": "string"
                }
              },
              "auth": {
                "type": "object",
                "properties": {
                  "client_id": {
                    "type": "string",
                    "minLength": 1
                  },
                  "client_secret": {
                    "type": "string",
                    "minLength": 1
                  },
                  "scope": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": [
                  "client_id"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "transport",
              "url"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "transport": {
                "type": "string",
                "const": "sse"
              },
              "description": {
                "type": "string",
                "minLength": 1
              },
              "url": {
                "type": "string",
                "format": "uri"
              },
              "headers": {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {
                  "type": "string"
                }
              },
              "auth": {
                "type": "object",
                "properties": {
                  "client_id": {
                    "type": "string",
                    "minLength": 1
                  },
                  "client_secret": {
                    "type": "string",
                    "minLength": 1
                  },
                  "scope": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": [
                  "client_id"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "transport",
              "url"
            ],
            "additionalProperties": false
          }
        ]
      },
      "minProperties": 1,
      "description": "Map of upstream MCPs to proxy, keyed by MCP name. Each name becomes the namespace prefix for that MCP's tools."
    },
    "$schema": {
      "type": "string",
      "description": "URL of the JSON Schema for editor validation."
    }
  },
  "required": [
    "mcp"
  ],
  "additionalProperties": false
}
