Implements icon support based on the Model Context Protocol specification, allowing servers to specify display icons with optional size, MIME type, and theme variants. ## Changes - Add `Icon` type to `pkg/model/types.go` with struct tags for automatic API validation - Add `icons` field to `ServerJSON` in `pkg/api/v0/types.go` - Add icon validation in `internal/validators/validators.go`: - Only HTTPS URLs allowed (no HTTP or data URIs) - Maximum URL length of 255 characters - Validates absolute URLs with proper scheme - Update JSON schema and OpenAPI documentation with Icon definitions - Add comprehensive test cases for icon validation - Add example icon to seed.json (Airtable server) - Change `websiteUrl` validation to HTTPS-only for consistency ## Implementation Details The implementation uses a two-layer validation architecture: 1. **Huma framework** validates struct tags (`required`, `maxLength`, `enum`, `pattern`) and returns 422 for violations 2. **Custom validators** handle business logic (HTTPS scheme requirement, absolute URL requirement) and return 400 for violations This approach leverages Huma's automatic validation while keeping business-specific rules in the validator layer. ## Icon Field Specification - `src` (required): HTTPS URL to icon resource, max 255 characters - `mimeType` (optional): One of `image/png`, `image/jpeg`, `image/jpg`, `image/svg+xml`, `image/webp` - `sizes` (optional): Array of size strings in "WxH" format or "any" for scalable formats - `theme` (optional): Either "light" or "dark" to indicate intended background Multiple icons can be provided (e.g., for different themes or sizes).
593 lines
23 KiB
YAML
593 lines
23 KiB
YAML
openapi: 3.1.0
|
|
jsonSchemaDialect: "https://json-schema.org/draft/2020-12/schema"
|
|
$id: https://modelcontextprotocol.io/schemas/draft/2025-09-29/server-registry-openapi
|
|
info:
|
|
title: MCP Server Registry API
|
|
version: "2025-09-29"
|
|
summary: API for discovering and accessing MCP server metadata
|
|
description: |
|
|
Specification for a theoretical REST API that serves up metadata about MCP servers.
|
|
license:
|
|
name: MIT
|
|
identifier: MIT
|
|
|
|
paths:
|
|
/v0/servers:
|
|
get:
|
|
summary: List MCP servers
|
|
description: Returns a list of all registered MCP servers
|
|
parameters:
|
|
- name: cursor
|
|
in: query
|
|
description: |
|
|
Pagination cursor for retrieving next set of results.
|
|
|
|
Cursors are opaque strings returned in the `metadata.nextCursor` field of paginated responses. Always use the exact cursor value returned by the API.
|
|
required: false
|
|
schema:
|
|
type: string
|
|
- name: limit
|
|
in: query
|
|
description: Maximum number of items to return
|
|
required: false
|
|
schema:
|
|
type: integer
|
|
responses:
|
|
'200':
|
|
description: A list of MCP servers
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/ServerList'
|
|
/v0/servers/{serverName}/versions:
|
|
get:
|
|
summary: List all versions of an MCP server
|
|
description: Returns all available versions for a specific MCP server, ordered by publication date (newest first)
|
|
parameters:
|
|
- name: serverName
|
|
in: path
|
|
required: true
|
|
description: URL-encoded server name (e.g., "com.example%2Fmy-server")
|
|
schema:
|
|
type: string
|
|
example: "com.example%2Fmy-server"
|
|
responses:
|
|
'200':
|
|
description: A list of all versions for the server
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/ServerList'
|
|
'404':
|
|
description: Server not found
|
|
content:
|
|
application/json:
|
|
schema:
|
|
type: object
|
|
properties:
|
|
error:
|
|
type: string
|
|
example: "Server not found"
|
|
/v0/servers/{serverName}/versions/{version}:
|
|
get:
|
|
summary: Get specific MCP server version
|
|
description: Returns detailed information about a specific version of an MCP server. Use the special version `latest` to get the latest version.
|
|
parameters:
|
|
- name: serverName
|
|
in: path
|
|
required: true
|
|
description: URL-encoded server name (e.g., "com.example%2Fmy-server")
|
|
schema:
|
|
type: string
|
|
example: "com.example%2Fmy-server"
|
|
- name: version
|
|
in: path
|
|
required: true
|
|
description: URL-encoded version to retrieve (e.g., "1.0.0" or "1.0.0%2B20130313144700" for versions with build metadata)
|
|
schema:
|
|
type: string
|
|
example: "1.0.0"
|
|
responses:
|
|
'200':
|
|
description: Detailed server information
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/ServerResponse'
|
|
'404':
|
|
description: Server or version not found
|
|
content:
|
|
application/json:
|
|
schema:
|
|
type: object
|
|
properties:
|
|
error:
|
|
type: string
|
|
example: "Server not found"
|
|
/v0/publish:
|
|
post:
|
|
summary: Publish MCP server (Optional)
|
|
description: |
|
|
Publish a new MCP server to the registry or update an existing one.
|
|
|
|
**Note**: This endpoint is optional for registry implementations. Read-only registries may not provide this functionality.
|
|
|
|
Authentication mechanism is registry-specific and may vary between implementations.
|
|
security:
|
|
- bearerAuth: []
|
|
requestBody:
|
|
required: true
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/ServerDetail'
|
|
examples:
|
|
basic_server:
|
|
summary: Basic server with NPM package
|
|
value:
|
|
name: "io.modelcontextprotocol/filesystem"
|
|
description: "Node.js server implementing Model Context Protocol (MCP) for filesystem operations."
|
|
title: "Filesystem"
|
|
repository:
|
|
url: "https://github.com/modelcontextprotocol/servers"
|
|
source: "github"
|
|
version: "1.0.2"
|
|
packages:
|
|
- registryType: "npm"
|
|
registryBaseUrl: "https://registry.npmjs.org"
|
|
identifier: "@modelcontextprotocol/server-filesystem"
|
|
version: "1.0.2"
|
|
_meta:
|
|
io.modelcontextprotocol.registry/publisher-provided:
|
|
tool: "publisher-cli"
|
|
version: "1.2.3"
|
|
buildInfo:
|
|
commit: "abc123def456"
|
|
timestamp: "2023-12-01T10:30:00Z"
|
|
example_org_server:
|
|
summary: Server with example.com organization extensions
|
|
value:
|
|
name: "com.example/demo-server"
|
|
description: "Example MCP server demonstrating publisher extensions."
|
|
title: "Demo Server"
|
|
repository:
|
|
url: "https://github.com/example/mcp-demo"
|
|
source: "github"
|
|
version: "1.0.0"
|
|
packages:
|
|
- registryType: "npm"
|
|
registryBaseUrl: "https://registry.npmjs.org"
|
|
identifier: "@example/mcp-demo-server"
|
|
version: "1.0.0"
|
|
_meta:
|
|
io.modelcontextprotocol.registry/publisher-provided:
|
|
contactEmail: "maintainer@example.com"
|
|
buildMetadata:
|
|
commit: "abc123"
|
|
timestamp: "2024-01-15T10:30:00Z"
|
|
com.example:
|
|
marketplaceIcon: "https://example.com/icon.png"
|
|
category: ["software_development"]
|
|
documentationUrl: "https://docs.example.org"
|
|
verifiedPublisher: true
|
|
responses:
|
|
'200':
|
|
description: Successfully published server
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/ServerResponse'
|
|
'401':
|
|
description: Unauthorized - Invalid or missing authentication token
|
|
content:
|
|
application/json:
|
|
schema:
|
|
type: object
|
|
properties:
|
|
error:
|
|
type: string
|
|
example: "Invalid or expired Registry JWT token"
|
|
'403':
|
|
description: Forbidden - Insufficient permissions
|
|
content:
|
|
application/json:
|
|
schema:
|
|
type: object
|
|
properties:
|
|
error:
|
|
type: string
|
|
example: "You do not have permission to publish this server"
|
|
'500':
|
|
description: Internal server error
|
|
content:
|
|
application/json:
|
|
schema:
|
|
type: object
|
|
properties:
|
|
error:
|
|
type: string
|
|
example: "Failed to publish server"
|
|
components:
|
|
securitySchemes:
|
|
bearerAuth:
|
|
type: http
|
|
scheme: bearer
|
|
bearerFormat: JWT
|
|
description: |
|
|
Registry-specific authentication token. The authentication mechanism and token format may vary between registry implementations.
|
|
|
|
Some registries may use JWT tokens, others may use API keys or OAuth. Consult your specific registry's authentication documentation.
|
|
schemas:
|
|
Repository:
|
|
type: object
|
|
required:
|
|
- url
|
|
- source
|
|
properties:
|
|
url:
|
|
type: string
|
|
format: uri
|
|
example: "https://github.com/modelcontextprotocol/servers"
|
|
source:
|
|
type: string
|
|
example: "github"
|
|
id:
|
|
type: string
|
|
example: "b94b5f7e-c7c6-d760-2c78-a5e9b8a5b8c9"
|
|
subfolder:
|
|
type: string
|
|
description: "Optional relative path from repository root to the server location within a monorepo structure"
|
|
example: "src/everything"
|
|
|
|
ServerList:
|
|
type: object
|
|
required:
|
|
- servers
|
|
properties:
|
|
servers:
|
|
type: array
|
|
items:
|
|
$ref: '#/components/schemas/ServerResponse'
|
|
metadata:
|
|
type: object
|
|
properties:
|
|
nextCursor:
|
|
type: string
|
|
description: |
|
|
Pagination cursor for retrieving the next page of results.
|
|
Use this exact value in the `cursor` query parameter of your next request. If null or empty, there are no more results.
|
|
count:
|
|
type: integer
|
|
description: Number of items in current page
|
|
example: 30
|
|
|
|
Package:
|
|
type: object
|
|
required:
|
|
- registryType
|
|
- identifier
|
|
- version
|
|
properties:
|
|
registryType:
|
|
type: string
|
|
description: Registry type indicating how to download packages (e.g., 'npm', 'pypi', 'oci', 'nuget', 'mcpb')
|
|
examples:
|
|
- "npm"
|
|
- "pypi"
|
|
- "oci"
|
|
- "nuget"
|
|
- "mcpb"
|
|
registryBaseUrl:
|
|
type: string
|
|
format: uri
|
|
description: Base URL of the package registry
|
|
examples:
|
|
- "https://registry.npmjs.org"
|
|
- "https://pypi.org"
|
|
- "https://docker.io"
|
|
- "https://api.nuget.org"
|
|
- "https://github.com"
|
|
- "https://gitlab.com"
|
|
identifier:
|
|
type: string
|
|
description: Package identifier - either a package name (for registries) or URL (for direct downloads)
|
|
examples:
|
|
- "@modelcontextprotocol/server-brave-search"
|
|
- "https://github.com/example/releases/download/v1.0.0/package.mcpb"
|
|
version:
|
|
type: string
|
|
description: Package version
|
|
example: "1.0.2"
|
|
fileSha256:
|
|
type: string
|
|
description: SHA-256 hash of the package file for integrity verification.
|
|
example: "fe333e598595000ae021bd27117db32ec69af6987f507ba7a63c90638ff633ce"
|
|
runtimeHint:
|
|
type: string
|
|
description: A hint to help clients determine the appropriate runtime for the package. This field should be provided when `runtimeArguments` are present.
|
|
examples: [npx, uvx, dnx]
|
|
runtimeArguments:
|
|
type: array
|
|
description: A list of arguments to be passed to the package's runtime command (such as docker or npx). The `runtimeHint` field should be provided when `runtimeArguments` are present.
|
|
items:
|
|
$ref: '#/components/schemas/Argument'
|
|
packageArguments:
|
|
type: array
|
|
description: A list of arguments to be passed to the package's binary.
|
|
items:
|
|
$ref: '#/components/schemas/Argument'
|
|
environmentVariables:
|
|
type: array
|
|
description: A mapping of environment variables to be set when running the package.
|
|
items:
|
|
$ref: '#/components/schemas/KeyValueInput'
|
|
|
|
Input:
|
|
type: object
|
|
properties:
|
|
description:
|
|
description: A description of the input, which clients can use to provide context to the user.
|
|
type: string
|
|
isRequired:
|
|
type: boolean
|
|
default: false
|
|
format:
|
|
type: string
|
|
description: |
|
|
Specifies the input format. Supported values include `filepath`, which should be interpreted as a file on the user's filesystem.
|
|
|
|
When the input is converted to a string, booleans should be represented by the strings "true" and "false", and numbers should be represented as decimal values.
|
|
enum: [string, number, boolean, filepath]
|
|
default: string
|
|
value:
|
|
type: string
|
|
description: |
|
|
The default value for the input. If this is not set, the user may be prompted to provide a value. If a value is set, it should not be configurable by end users.
|
|
|
|
Identifiers wrapped in `{curly_braces}` will be replaced with the corresponding properties from the input `variables` map. If an identifier in braces is not found in `variables`, or if `variables` is not provided, the `{curly_braces}` substring should remain unchanged.
|
|
isSecret:
|
|
type: boolean
|
|
description: Indicates whether the input is a secret value (e.g., password, token). If true, clients should handle the value securely.
|
|
default: false
|
|
default:
|
|
type: string
|
|
description: The default value for the input.
|
|
choices:
|
|
type: array
|
|
description: A list of possible values for the input. If provided, the user must select one of these values.
|
|
items:
|
|
type: string
|
|
example: []
|
|
|
|
InputWithVariables:
|
|
allOf:
|
|
- $ref: '#/components/schemas/Input'
|
|
- type: object
|
|
properties:
|
|
variables:
|
|
type: object
|
|
description: A map of variable names to their values. Keys in the input `value` that are wrapped in `{curly_braces}` will be replaced with the corresponding variable values.
|
|
additionalProperties:
|
|
$ref: '#/components/schemas/Input'
|
|
|
|
PositionalArgument:
|
|
description: A positional input is a value inserted verbatim into the command line.
|
|
allOf:
|
|
- $ref: '#/components/schemas/InputWithVariables'
|
|
- type: object
|
|
required:
|
|
- type
|
|
properties:
|
|
type:
|
|
type: string
|
|
enum: [positional]
|
|
example: "positional"
|
|
valueHint:
|
|
type: string
|
|
description: An identifier-like hint for the value. This is not part of the command line, but can be used by client configuration and to provide hints to users.
|
|
example: file_path
|
|
isRepeated:
|
|
type: boolean
|
|
description: Whether the argument can be repeated multiple times in the command line.
|
|
default: false
|
|
anyOf:
|
|
- required:
|
|
- value
|
|
- required:
|
|
- valueHint
|
|
|
|
NamedArgument:
|
|
description: A command-line `--flag={value}`.
|
|
allOf:
|
|
- $ref: '#/components/schemas/InputWithVariables'
|
|
- type: object
|
|
required:
|
|
- type
|
|
- name
|
|
properties:
|
|
type:
|
|
type: string
|
|
enum: [named]
|
|
example: "named"
|
|
name:
|
|
type: string
|
|
description: The flag name, including any leading dashes.
|
|
example: "--port"
|
|
isRepeated:
|
|
type: boolean
|
|
description: Whether the argument can be repeated multiple times.
|
|
default: false
|
|
|
|
KeyValueInput:
|
|
allOf:
|
|
- $ref: '#/components/schemas/InputWithVariables'
|
|
- type: object
|
|
required:
|
|
- name
|
|
properties:
|
|
name:
|
|
type: string
|
|
description: Name of the header or environment variable.
|
|
example: SOME_VARIABLE
|
|
|
|
Argument:
|
|
anyOf:
|
|
- $ref: '#/components/schemas/PositionalArgument'
|
|
- $ref: '#/components/schemas/NamedArgument'
|
|
|
|
Remote:
|
|
type: object
|
|
required:
|
|
- type
|
|
- url
|
|
properties:
|
|
type:
|
|
type: string
|
|
enum: [streamable-http, sse]
|
|
description: Transport protocol type
|
|
example: "sse"
|
|
url:
|
|
type: string
|
|
format: uri
|
|
description: Remote server URL
|
|
example: "https://mcp-fs.example.com/sse"
|
|
headers:
|
|
type: array
|
|
description: HTTP headers to include
|
|
items:
|
|
$ref: '#/components/schemas/KeyValueInput'
|
|
|
|
Icon:
|
|
type: object
|
|
description: An optionally-sized icon that can be displayed in a user interface
|
|
required:
|
|
- src
|
|
properties:
|
|
src:
|
|
type: string
|
|
format: uri
|
|
description: "A standard URI pointing to an icon resource. Must be an HTTPS URL. Consumers SHOULD take steps to ensure URLs serving icons are from the same domain as the server or a trusted domain. Consumers SHOULD take appropriate precautions when consuming SVGs as they can contain executable JavaScript."
|
|
example: "https://example.com/icon.png"
|
|
maxLength: 255
|
|
mimeType:
|
|
type: string
|
|
description: "Optional MIME type override if the source MIME type is missing or generic. Must be one of: image/png, image/jpeg, image/jpg, image/svg+xml, image/webp."
|
|
enum: [image/png, image/jpeg, image/jpg, image/svg+xml, image/webp]
|
|
example: "image/png"
|
|
sizes:
|
|
type: array
|
|
description: "Optional array of strings that specify sizes at which the icon can be used. Each string should be in WxH format (e.g., '48x48', '96x96') or 'any' for scalable formats like SVG. If not provided, the client should assume that the icon can be used at any size."
|
|
items:
|
|
type: string
|
|
pattern: "^(\\d+x\\d+|any)$"
|
|
examples:
|
|
- ["48x48", "96x96"]
|
|
- ["any"]
|
|
theme:
|
|
type: string
|
|
description: "Optional specifier for the theme this icon is designed for. 'light' indicates the icon is designed to be used with a light background, and 'dark' indicates the icon is designed to be used with a dark background. If not provided, the client should assume the icon can be used with any theme."
|
|
enum: [light, dark]
|
|
|
|
ServerDetail:
|
|
description: Schema for a static representation of an MCP server. Used in various contexts related to discovery, installation, and configuration.
|
|
type: object
|
|
required:
|
|
- name
|
|
- description
|
|
- version
|
|
properties:
|
|
name:
|
|
type: string
|
|
description: "Reverse DNS name of the MCP server"
|
|
example: "io.github.modelcontextprotocol/filesystem"
|
|
description:
|
|
type: string
|
|
description: "Human-readable description of the server's functionality"
|
|
example: "Node.js server implementing Model Context Protocol (MCP) for filesystem operations."
|
|
title:
|
|
type: string
|
|
description: "Optional human-readable title or display name for the MCP server. MCP subregistries or clients MAY choose to use this for display purposes."
|
|
example: "Filesystem"
|
|
repository:
|
|
$ref: '#/components/schemas/Repository'
|
|
version:
|
|
type: string
|
|
example: "1.0.2"
|
|
description: "Version string for this server. SHOULD follow semantic versioning (e.g., '1.0.2', '2.1.0-alpha'). Equivalent of Implementation.version in MCP specification."
|
|
websiteUrl:
|
|
type: string
|
|
format: uri
|
|
description: "Optional URL to the server's homepage, documentation, or project website. This provides a central link for users to learn more about the server. Particularly useful when the server has custom installation instructions or setup requirements."
|
|
example: "https://modelcontextprotocol.io/examples"
|
|
icons:
|
|
type: array
|
|
description: "Optional set of sized icons that the client can display in a user interface. Clients that support rendering icons MUST support at least the following MIME types: image/png and image/jpeg (safe, universal compatibility). Clients SHOULD also support: image/svg+xml (scalable but requires security precautions) and image/webp (modern, efficient format)."
|
|
items:
|
|
$ref: '#/components/schemas/Icon'
|
|
$schema:
|
|
type: string
|
|
format: uri
|
|
description: JSON Schema URI for this server.json format
|
|
example: "https://static.modelcontextprotocol.io/schemas/2025-09-29/server.schema.json"
|
|
packages:
|
|
type: array
|
|
items:
|
|
$ref: '#/components/schemas/Package'
|
|
remotes:
|
|
type: array
|
|
items:
|
|
$ref: '#/components/schemas/Remote'
|
|
_meta:
|
|
type: object
|
|
description: Extension metadata using reverse DNS namespacing
|
|
properties:
|
|
io.modelcontextprotocol.registry/publisher-provided:
|
|
type: object
|
|
description: Publisher-specific metadata and build information
|
|
additionalProperties: true
|
|
example:
|
|
tool: "publisher-cli"
|
|
version: "1.2.3"
|
|
buildInfo:
|
|
commit: "abc123def456"
|
|
timestamp: "2023-12-01T10:30:00Z"
|
|
pipelineId: "build-789"
|
|
|
|
ServerResponse:
|
|
description: API response format with separated server data and registry metadata
|
|
type: object
|
|
required:
|
|
- server
|
|
- _meta
|
|
properties:
|
|
server:
|
|
$ref: '#/components/schemas/ServerDetail'
|
|
_meta:
|
|
type: object
|
|
description: Registry-managed metadata
|
|
properties:
|
|
io.modelcontextprotocol.registry/official:
|
|
type: object
|
|
description: Official MCP registry metadata
|
|
properties:
|
|
status:
|
|
type: string
|
|
enum: ["active", "deprecated", "deleted"]
|
|
description: Server lifecycle status
|
|
example: "active"
|
|
publishedAt:
|
|
type: string
|
|
format: date-time
|
|
description: Timestamp when the server was first published to the registry
|
|
example: "2023-12-01T10:30:00Z"
|
|
updatedAt:
|
|
type: string
|
|
format: date-time
|
|
description: Timestamp when the server entry was last updated
|
|
example: "2023-12-01T11:00:00Z"
|
|
isLatest:
|
|
type: boolean
|
|
description: Whether this is the latest version of the server
|
|
example: true
|
|
additionalProperties: false
|
|
additionalProperties: true
|