Add Swagger API documentation and handlers for v0
This commit is contained in:
parent
4c401c0b25
commit
39bcae1c81
1 changed files with 275 additions and 0 deletions
168
internal/docs/swagger.yaml
Normal file
168
internal/docs/swagger.yaml
Normal file
|
|
@ -0,0 +1,168 @@
|
|||
openapi: 3.0.0
|
||||
info:
|
||||
title: Model Context Protocol Registry API
|
||||
description: API for the Model Context Protocol Registry
|
||||
version: "0.1.0"
|
||||
|
||||
servers:
|
||||
- url: /
|
||||
description: Default server
|
||||
|
||||
tags:
|
||||
- name: health
|
||||
description: Health checking operations
|
||||
- name: servers
|
||||
description: Server registry operations
|
||||
|
||||
paths:
|
||||
/v0/health:
|
||||
get:
|
||||
tags:
|
||||
- health
|
||||
summary: Health check endpoint
|
||||
description: Returns the health status of the API
|
||||
operationId: healthCheck
|
||||
responses:
|
||||
'200':
|
||||
description: Successful operation
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
status:
|
||||
type: string
|
||||
example: ok
|
||||
|
||||
/v0/ping:
|
||||
get:
|
||||
tags:
|
||||
- health
|
||||
summary: API version check
|
||||
description: Returns the API version and status
|
||||
operationId: pingCheck
|
||||
responses:
|
||||
'200':
|
||||
description: Successful operation
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
status:
|
||||
type: string
|
||||
example: ok
|
||||
version:
|
||||
type: string
|
||||
example: "0.1.0"
|
||||
'405':
|
||||
description: Method not allowed
|
||||
|
||||
/v0/servers:
|
||||
get:
|
||||
tags:
|
||||
- servers
|
||||
summary: List registered servers
|
||||
description: Returns a paginated list of registered servers
|
||||
operationId: listServers
|
||||
parameters:
|
||||
- name: cursor
|
||||
in: query
|
||||
description: Pagination cursor (UUID)
|
||||
required: false
|
||||
schema:
|
||||
type: string
|
||||
format: uuid
|
||||
- name: limit
|
||||
in: query
|
||||
description: Maximum number of items to return (1-100, default 30)
|
||||
required: false
|
||||
schema:
|
||||
type: integer
|
||||
minimum: 1
|
||||
maximum: 100
|
||||
default: 30
|
||||
responses:
|
||||
'200':
|
||||
description: Successful operation
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
servers:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/Server'
|
||||
metadata:
|
||||
$ref: '#/components/schemas/PaginationMetadata'
|
||||
'400':
|
||||
description: Invalid cursor or limit parameter
|
||||
'405':
|
||||
description: Method not allowed
|
||||
|
||||
/v0/servers/{id}:
|
||||
get:
|
||||
tags:
|
||||
- servers
|
||||
summary: Get server details
|
||||
description: Returns details of a specific server by ID
|
||||
operationId: getServerDetails
|
||||
parameters:
|
||||
- name: id
|
||||
in: path
|
||||
description: Server ID (UUID)
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
format: uuid
|
||||
responses:
|
||||
'200':
|
||||
description: Successful operation
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Server'
|
||||
'400':
|
||||
description: Invalid ID format
|
||||
'404':
|
||||
description: Server not found
|
||||
'405':
|
||||
description: Method not allowed
|
||||
|
||||
components:
|
||||
schemas:
|
||||
Server:
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: string
|
||||
format: uuid
|
||||
example: "123e4567-e89b-12d3-a456-426614174000"
|
||||
name:
|
||||
type: string
|
||||
example: "Example MCP Server"
|
||||
url:
|
||||
type: string
|
||||
format: uri
|
||||
example: "https://example.com/mcp"
|
||||
description:
|
||||
type: string
|
||||
example: "An example MCP server"
|
||||
created_at:
|
||||
type: string
|
||||
format: date-time
|
||||
updated_at:
|
||||
type: string
|
||||
format: date-time
|
||||
|
||||
PaginationMetadata:
|
||||
type: object
|
||||
properties:
|
||||
next_cursor:
|
||||
type: string
|
||||
format: uuid
|
||||
example: "123e4567-e89b-12d3-a456-426614174000"
|
||||
count:
|
||||
type: integer
|
||||
example: 30
|
||||
Loading…
Reference in a new issue