|
| 1 | +# Registry Extensions Specification |
| 2 | + |
| 3 | +A standardized way for registries to provide experimental or community-driven features without committing them to the core API specification. |
| 4 | + |
| 5 | +## Motivation |
| 6 | + |
| 7 | +[The core generic registry API](./generic-registry-api.md) intentionally stays minimal to ensure stability and broad adoption. Extensions provide a path for: |
| 8 | + |
| 9 | +- **Experimentation**: Try new features without core API changes |
| 10 | +- **Community innovation**: Anyone can implement custom extensions |
| 11 | +- **Gradual adoption**: Popular extensions may inform future core API features |
| 12 | +- **Avoiding breaking changes**: Failed experiments can be deprecated without API versioning churn |
| 13 | + |
| 14 | +## URL Structure |
| 15 | + |
| 16 | +Extensions live under the `/v0/x/` prefix: |
| 17 | + |
| 18 | +``` |
| 19 | +/v0/x/<namespace>/<extension>[/<path>] |
| 20 | +``` |
| 21 | + |
| 22 | +**Components:** |
| 23 | +- `<namespace>`: Reverse domain ownership (e.g., `com.example`, `io.github.username`) |
| 24 | +- `<extension>`: Extension name (lowercase, hyphens for word separation) |
| 25 | +- `<path>`: Extension-specific path structure (optional) |
| 26 | + |
| 27 | +**Examples:** |
| 28 | +``` |
| 29 | +/v0/x/com.example/search?q=database |
| 30 | +/v0/x/com.example/stats |
| 31 | +/v0/x/io.github.username/custom-feature |
| 32 | +``` |
| 33 | + |
| 34 | +## Conventions |
| 35 | + |
| 36 | +Where possible: |
| 37 | +- Follow standard REST conventions, return simple JSON responses, and avoid special headers |
| 38 | +- For list endpoints, use cursor-based pagination matching the core API |
| 39 | +- Extensions requiring authentication **SHOULD** follow the [Registry Authorization Specification](./registry-authorization.md) |
| 40 | +- Build open-source implementations in a composable way on top of the core APIs (e.g. as opposed to via custom database integration) |
| 41 | + |
| 42 | +## Implementation Requirements |
| 43 | + |
| 44 | +Registries implementing extensions **SHOULD** namespace extensions properly to avoid conflicts. |
| 45 | + |
| 46 | +Clients consuming extensions **MUST** gracefully handle missing extensions. |
| 47 | + |
| 48 | +## Example |
| 49 | + |
| 50 | +A simple server stats extension: |
| 51 | + |
| 52 | +```bash |
| 53 | +GET /v0/x/com.example/stats |
| 54 | +``` |
| 55 | + |
| 56 | +```json |
| 57 | +{ |
| 58 | + "totalServers": 1234, |
| 59 | + "totalVersions": 5678, |
| 60 | + "recentPublishes": 42 |
| 61 | +} |
| 62 | +``` |
| 63 | + |
| 64 | +## Future Considerations |
| 65 | + |
| 66 | +- **Extension discovery**: A potential `/v0/x` endpoint to list available extensions |
| 67 | +- **Extension metadata**: Standardized metadata format for extension capabilities |
| 68 | +- **Defining common extensions**: Like semantic conventions from OpenTelemetry, develop common extensions that registries can adopt (possibly under an experimental namespace) |
| 69 | + - Search extension for free-text search across server metadata ([#389](https://github.com/modelcontextprotocol/registry/issues/389)) |
| 70 | + - MCP server extension to expose the registry itself as an MCP server for programmatic access ([#24](https://github.com/modelcontextprotocol/registry/issues/24)) |
0 commit comments