{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://raw.githubusercontent.com/tadasant/zimmer-catalog/main/agents/agent-orchestrator/docs/mcp.schema.json",
  "title": "MCP Configuration",
  "description": "Schema for mcp.json - a configuration file defining MCP (Model Context Protocol) servers for use in MCP client applications.",
  "type": "object",
  "additionalProperties": {
    "$ref": "#/$defs/ServerConfiguration"
  },
  "propertyNames": {
    "pattern": "^[a-zA-Z0-9_\\[\\]-]+$",
    "description": "Server name (identifier key). Must be alphanumeric with hyphens, underscores, or brackets allowed."
  },
  "$defs": {
    "ServerConfiguration": {
      "type": "object",
      "description": "Configuration for a single MCP server.",
      "properties": {
        "title": {
          "type": "string",
          "minLength": 1,
          "maxLength": 100,
          "description": "Human-readable display name for the server."
        },
        "description": {
          "type": "string",
          "maxLength": 500,
          "description": "Human-readable description of what the server provides."
        },
        "type": {
          "type": "string",
          "enum": ["stdio", "sse", "streamable-http"],
          "description": "Transport type for communicating with the server. 'stdio' for local process servers, 'sse' for Server-Sent Events, 'streamable-http' for HTTP streaming."
        },
        "command": {
          "type": "string",
          "description": "Executable command to run for stdio servers. Supports environment variable interpolation."
        },
        "args": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Command-line arguments for stdio servers. Supports environment variable interpolation."
        },
        "env": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          },
          "description": "Environment variables to set for the server process. Values support environment variable interpolation."
        },
        "url": {
          "type": "string",
          "format": "uri",
          "description": "Endpoint URL for sse or streamable-http servers. Supports environment variable interpolation."
        },
        "headers": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          },
          "description": "HTTP headers to include in requests to remote servers. Values support environment variable interpolation."
        }
      },
      "required": ["type"],
      "allOf": [
        {
          "if": {
            "properties": {
              "type": { "const": "stdio" }
            },
            "required": ["type"]
          },
          "then": {
            "required": ["command"],
            "properties": {
              "url": false,
              "headers": false
            }
          }
        },
        {
          "if": {
            "properties": {
              "type": { "enum": ["sse", "streamable-http"] }
            },
            "required": ["type"]
          },
          "then": {
            "required": ["url"],
            "properties": {
              "command": false,
              "args": false
            }
          }
        }
      ]
    }
  }
}
