Add registry validators (#350)
Fixes #96 ## Motivation and Context See #96 ## How Has This Been Tested? Has some unit and integration tests, still needs proper testing of the different registry types ## Breaking Changes Yes, new package uploads will need extra verification ## Types of changes <!-- What types of changes does your code introduce? Put an `x` in all the boxes that apply: --> - [ ] Bug fix (non-breaking change which fixes an issue) - [x] New feature (non-breaking change which adds functionality) - [x] Breaking change (fix or feature that would cause existing functionality to change) - [ ] Documentation update
This commit is contained in:
parent
6ea3828e3c
commit
694a4d8879
31 changed files with 1859 additions and 728 deletions
|
|
@ -1,218 +1,40 @@
|
||||||
# MCP Registry Publisher Tool
|
# MCP Publisher Tool - Development
|
||||||
|
|
||||||
The MCP Registry Publisher Tool helps you publish Model Context Protocol (MCP) servers to the official registry. It follows a simple, npm-like workflow that's familiar to most developers.
|
CLI tool for publishing MCP servers to the registry.
|
||||||
|
|
||||||
## Installation
|
> These docs are for contributors. See the [Publisher User Guide](../../docs/publisher/guide.md) for end-user documentation.
|
||||||
|
|
||||||
|
## Quick Development Setup
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Build for current platform
|
# Build the tool
|
||||||
./build.sh
|
make publisher
|
||||||
|
|
||||||
# Build for all supported platforms (optional)
|
# Test locally
|
||||||
./build.sh --all
|
make dev-compose # Start local registry
|
||||||
|
./bin/mcp-publisher init
|
||||||
|
./bin/mcp-publisher login none --registry=http://localhost:8080
|
||||||
|
./bin/mcp-publisher publish --registry=http://localhost:8080
|
||||||
```
|
```
|
||||||
|
|
||||||
The compiled binary will be placed in the `bin` directory.
|
## Architecture
|
||||||
|
|
||||||
## Quick Start
|
### Commands
|
||||||
|
- **`init`** - Generate server.json templates with auto-detection
|
||||||
|
- **`login`** - Handle authentication (github, dns, http, none)
|
||||||
|
- **`publish`** - Validate and upload servers to registry
|
||||||
|
- **`logout`** - Clear stored credentials
|
||||||
|
|
||||||
```bash
|
### Authentication Providers
|
||||||
# 1. Create a template server.json file
|
- **`github`** - Interactive OAuth flow
|
||||||
mcp-publisher init
|
- **`github-oidc`** - CI/CD with GitHub Actions
|
||||||
|
- **`dns`** - Domain verification via DNS TXT records
|
||||||
|
- **`http`** - Domain verification via HTTPS endpoints
|
||||||
|
- **`none`** - No auth (testing only)
|
||||||
|
|
||||||
# 2. Edit server.json with your server details
|
## Key Files
|
||||||
|
|
||||||
# 3. Authenticate with the registry (one-time setup)
|
- **`main.go`** - CLI setup and command routing
|
||||||
mcp-publisher login <method>
|
- **`commands/`** - Command implementations with auto-detection logic
|
||||||
|
- **`auth/`** - Authentication provider implementations
|
||||||
# 4. Publish your server
|
- **`build.sh`** - Cross-platform build script
|
||||||
mcp-publisher publish
|
|
||||||
```
|
|
||||||
|
|
||||||
## Commands
|
|
||||||
|
|
||||||
### `mcp-publisher init`
|
|
||||||
|
|
||||||
Creates a template `server.json` file with smart defaults. This command automatically detects values from your environment when possible.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
mcp-publisher init
|
|
||||||
```
|
|
||||||
|
|
||||||
Auto-detection sources:
|
|
||||||
- **Git remote origin** for repository URL and server name
|
|
||||||
- **package.json** for npm packages (name, description)
|
|
||||||
- **pyproject.toml** for Python packages
|
|
||||||
- **Current directory** for fallback naming
|
|
||||||
|
|
||||||
The generated file includes placeholder values that you should update before publishing.
|
|
||||||
|
|
||||||
### `mcp-publisher login <method>`
|
|
||||||
|
|
||||||
Authenticates with the MCP registry. You'll only need to do this once - the tool saves your credentials locally.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# GitHub interactive authentication
|
|
||||||
mcp-publisher login github
|
|
||||||
|
|
||||||
# GitHub Actions OIDC (for CI/CD)
|
|
||||||
mcp-publisher login github-oidc
|
|
||||||
|
|
||||||
# DNS-based authentication
|
|
||||||
mcp-publisher login dns --domain example.com --private-key abc123...
|
|
||||||
|
|
||||||
# HTTP-based authentication
|
|
||||||
mcp-publisher login http --domain example.com --private-key abc123...
|
|
||||||
```
|
|
||||||
|
|
||||||
**Authentication Methods:**
|
|
||||||
|
|
||||||
- **`github`**: Interactive GitHub OAuth flow. Opens browser for authentication.
|
|
||||||
- **`github-oidc`**: For GitHub Actions. Uses OIDC tokens automatically.
|
|
||||||
- **`dns`**: Domain-based auth using DNS TXT records. Requires `--domain` and `--private-key`.
|
|
||||||
- **`http`**: Domain-based auth using HTTPS endpoint. Requires `--domain` and `--private-key`.
|
|
||||||
|
|
||||||
### `mcp-publisher publish`
|
|
||||||
|
|
||||||
Publishes your `server.json` file to the registry. You must be logged in first.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
mcp-publisher publish
|
|
||||||
```
|
|
||||||
|
|
||||||
This command:
|
|
||||||
- Validates your `server.json` file
|
|
||||||
- Checks your authentication
|
|
||||||
- Uploads the server configuration to the registry
|
|
||||||
|
|
||||||
### `mcp-publisher logout`
|
|
||||||
|
|
||||||
Clears your saved authentication credentials.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
mcp-publisher logout
|
|
||||||
```
|
|
||||||
|
|
||||||
## GitHub Actions
|
|
||||||
|
|
||||||
For automated publishing from GitHub Actions:
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
name: Publish to MCP Registry
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
tags: ['v*']
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
publish:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
permissions:
|
|
||||||
id-token: write # Required for OIDC
|
|
||||||
contents: read
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Setup MCP Publisher
|
|
||||||
run: |
|
|
||||||
curl -LO https://github.com/modelcontextprotocol/registry/releases/latest/download/mcp-publisher-linux-amd64
|
|
||||||
chmod +x mcp-publisher-linux-amd64
|
|
||||||
|
|
||||||
- name: Login to Registry
|
|
||||||
run: ./mcp-publisher-linux-amd64 login github-oidc
|
|
||||||
|
|
||||||
- name: Publish to Registry
|
|
||||||
run: ./mcp-publisher-linux-amd64 publish
|
|
||||||
```
|
|
||||||
|
|
||||||
The `login github-oidc` command uses GitHub's OIDC tokens for authentication in CI environments.
|
|
||||||
|
|
||||||
## Examples
|
|
||||||
|
|
||||||
### Publishing an NPM-based server
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Create template server.json (auto-detects from package.json)
|
|
||||||
# Then edit server.json to add your specific details
|
|
||||||
mcp-publisher init
|
|
||||||
|
|
||||||
# Login (first time only)
|
|
||||||
mcp-publisher login github
|
|
||||||
|
|
||||||
# Publish
|
|
||||||
mcp-publisher publish
|
|
||||||
```
|
|
||||||
|
|
||||||
### Publishing a Python server
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Create template server.json (auto-detects from pyproject.toml)
|
|
||||||
# Then edit server.json to add your specific details
|
|
||||||
mcp-publisher init
|
|
||||||
|
|
||||||
# Publish (assuming already logged in)
|
|
||||||
mcp-publisher publish
|
|
||||||
```
|
|
||||||
|
|
||||||
### Publishing with DNS authentication
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Setup DNS TXT record first (see DNS Authentication section below)
|
|
||||||
|
|
||||||
# Login with DNS
|
|
||||||
mcp-publisher login dns --domain example.com --private-key YOUR_PRIVATE_KEY
|
|
||||||
|
|
||||||
# Publish
|
|
||||||
mcp-publisher publish
|
|
||||||
```
|
|
||||||
|
|
||||||
## Authentication Details
|
|
||||||
|
|
||||||
### DNS Authentication
|
|
||||||
|
|
||||||
For domain-based authentication using DNS:
|
|
||||||
|
|
||||||
1. Generate an Ed25519 keypair:
|
|
||||||
```bash
|
|
||||||
openssl genpkey -algorithm Ed25519 -out /tmp/key.pem && \
|
|
||||||
echo "DNS TXT Record:" && \
|
|
||||||
echo " v=MCPv1; k=ed25519; p=$(openssl pkey -in /tmp/key.pem -pubout -outform DER | tail -c 32 | base64)" && \
|
|
||||||
echo "" && \
|
|
||||||
echo "Private key for login:" && \
|
|
||||||
echo " $(openssl pkey -in /tmp/key.pem -noout -text | grep -A3 "priv:" | tail -n +2 | tr -d ' :\n')" && \
|
|
||||||
rm /tmp/key.pem
|
|
||||||
```
|
|
||||||
|
|
||||||
2. Add the TXT record to your domain's DNS
|
|
||||||
|
|
||||||
3. Login with:
|
|
||||||
```bash
|
|
||||||
mcp-publisher login dns --domain example.com --private-key YOUR_PRIVATE_KEY
|
|
||||||
```
|
|
||||||
|
|
||||||
This grants publishing rights for `example.com/*` and `*.example.com/*` namespaces.
|
|
||||||
|
|
||||||
### HTTP Authentication
|
|
||||||
|
|
||||||
For HTTP-based authentication:
|
|
||||||
|
|
||||||
1. Generate an Ed25519 keypair (same as DNS)
|
|
||||||
|
|
||||||
2. Host the public key at `https://yoursite.com/.well-known/mcp-registry-auth`:
|
|
||||||
```
|
|
||||||
v=MCPv1; k=ed25519; p=YOUR_PUBLIC_KEY_BASE64
|
|
||||||
```
|
|
||||||
|
|
||||||
3. Login with:
|
|
||||||
```bash
|
|
||||||
mcp-publisher login http --domain example.com --private-key YOUR_PRIVATE_KEY
|
|
||||||
```
|
|
||||||
|
|
||||||
This grants publishing rights for the `example.com/*` namespace.
|
|
||||||
|
|
||||||
## Troubleshooting
|
|
||||||
|
|
||||||
**"Not authenticated" error**: Run `mcp-publisher login <method>` to authenticate (e.g., `mcp-publisher login github`).
|
|
||||||
|
|
||||||
**"Invalid server.json" error**: Ensure your `server.json` file is valid. You can recreate it with `mcp-publisher init`.
|
|
||||||
|
|
||||||
**GitHub Actions failing**: Ensure your workflow has `id-token: write` permission and you're using `mcp-publisher login github-oidc`.
|
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,6 @@ func main() {
|
||||||
switch cfg.DatabaseType {
|
switch cfg.DatabaseType {
|
||||||
case config.DatabaseTypeMemory:
|
case config.DatabaseTypeMemory:
|
||||||
db = database.NewMemoryDB()
|
db = database.NewMemoryDB()
|
||||||
registryService = service.NewRegistryServiceWithDB(db)
|
|
||||||
case config.DatabaseTypePostgreSQL:
|
case config.DatabaseTypePostgreSQL:
|
||||||
// Use PostgreSQL for real registry service
|
// Use PostgreSQL for real registry service
|
||||||
// Create a context with timeout for PostgreSQL connection
|
// Create a context with timeout for PostgreSQL connection
|
||||||
|
|
@ -61,10 +60,6 @@ func main() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create registry service with PostgreSQL
|
|
||||||
registryService = service.NewRegistryServiceWithDB(db)
|
|
||||||
log.Printf("PostgreSQL database URL: %s", cfg.DatabaseURL)
|
|
||||||
|
|
||||||
// Store the PostgreSQL instance for later cleanup
|
// Store the PostgreSQL instance for later cleanup
|
||||||
defer func() {
|
defer func() {
|
||||||
if err := db.Close(); err != nil {
|
if err := db.Close(); err != nil {
|
||||||
|
|
@ -78,6 +73,8 @@ func main() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
registryService = service.NewRegistryService(db, cfg)
|
||||||
|
|
||||||
// Import seed data if seed source is provided
|
// Import seed data if seed source is provided
|
||||||
if cfg.SeedFrom != "" {
|
if cfg.SeedFrom != "" {
|
||||||
log.Printf("Importing data from %s...", cfg.SeedFrom)
|
log.Printf("Importing data from %s...", cfg.SeedFrom)
|
||||||
|
|
|
||||||
301
docs/publisher/guide.md
Normal file
301
docs/publisher/guide.md
Normal file
|
|
@ -0,0 +1,301 @@
|
||||||
|
# MCP Server Publisher Guide
|
||||||
|
|
||||||
|
This guide will explain how you can publish your MCP server to the official registry.
|
||||||
|
|
||||||
|
## Quick Start
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 1. Create a template server.json file
|
||||||
|
mcp-publisher init
|
||||||
|
|
||||||
|
# 2. Edit server.json with your server details
|
||||||
|
# 3. Add registry validation metadata to your package
|
||||||
|
|
||||||
|
# 4. Authenticate with the registry (one-time setup)
|
||||||
|
mcp-publisher login <method>
|
||||||
|
|
||||||
|
# 5. Publish your server
|
||||||
|
mcp-publisher publish
|
||||||
|
```
|
||||||
|
|
||||||
|
## Step 1: Initialize Template
|
||||||
|
|
||||||
|
Create a template `server.json` file with smart auto-detection:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
mcp-publisher init
|
||||||
|
```
|
||||||
|
|
||||||
|
We'll try to autodetect your configuration, but you'll probably need to fill in some placeholder in the next step.
|
||||||
|
|
||||||
|
## Step 2: Configure Server Details
|
||||||
|
|
||||||
|
Edit the generated `server.json` file with your specific details:
|
||||||
|
|
||||||
|
- **Server name** - Must follow reverse-DNS format (e.g., `io.github.username/server-name`)
|
||||||
|
- In step 4, you'll have to authenticate to this namespace. If you use your github username, you'll need to login with GitHub. If you use a custom domain, you'll need to set up a DNS or HTTP verification.
|
||||||
|
- **Description** - Clear explanation of what your server does
|
||||||
|
- **Package references** - Point to your published packages
|
||||||
|
- **Runtime configuration** - Arguments, environment variables, etc.
|
||||||
|
- We recommend trying to reduce the configuration your server needs to start up, and using environment variables where configuration is needed.
|
||||||
|
|
||||||
|
**📖 Resources:**
|
||||||
|
- **[server.json Examples](../server-json/examples.md)** - Real-world server configurations
|
||||||
|
- **[server.json Specification](../server-json/)** - Complete field reference
|
||||||
|
|
||||||
|
## Step 3: Add Package Validation Metadata
|
||||||
|
|
||||||
|
All packages must include ownership verification metadata to prevent misattribution. When you publish, the registry validates that you actually control the packages you're referencing by checking for specific metadata in each package.
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary><strong>📦 NPM Packages</strong></summary>
|
||||||
|
|
||||||
|
### Requirements
|
||||||
|
Add an `mcpName` field to your `package.json`:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"name": "your-npm-package",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"mcpName": "io.github.username/server-name"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### How It Works
|
||||||
|
- Registry fetches `https://registry.npmjs.org/your-npm-package`
|
||||||
|
- Checks that `mcpName` field matches your server name
|
||||||
|
- Fails if field is missing or doesn't match
|
||||||
|
|
||||||
|
### Example server.json
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"name": "io.github.username/server-name",
|
||||||
|
"packages": [
|
||||||
|
{
|
||||||
|
"registry_type": "npm",
|
||||||
|
"identifier": "your-npm-package",
|
||||||
|
"version": "1.0.0"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
The official MCP registry currently only supports the NPM public registry (`https://registry.npmjs.org`).
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary><strong>🐍 PyPI Packages</strong></summary>
|
||||||
|
|
||||||
|
### Requirements
|
||||||
|
Include your server name in your package README file using this format:
|
||||||
|
|
||||||
|
**MCP name format**: `mcp-name: io.github.username/server-name`
|
||||||
|
|
||||||
|
Add it to your README.md file (which becomes the package description on PyPI).
|
||||||
|
|
||||||
|
### How It Works
|
||||||
|
- Registry fetches `https://pypi.org/pypi/your-package/json`
|
||||||
|
- Passes if `mcp-name: server-name` is in the README content
|
||||||
|
|
||||||
|
### Example server.json
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"name": "io.github.username/server-name",
|
||||||
|
"packages": [
|
||||||
|
{
|
||||||
|
"registry_type": "pypi",
|
||||||
|
"identifier": "your-pypi-package",
|
||||||
|
"version": "1.0.0"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
The official MCP registry currently only supports the official PyPI registry (`https://pypi.org`).
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary><strong>📋 NuGet Packages</strong></summary>
|
||||||
|
|
||||||
|
### Requirements
|
||||||
|
Include your server name in your package's README using this format:
|
||||||
|
|
||||||
|
**MCP name format**: `mcp-name: io.github.username/server-name`
|
||||||
|
|
||||||
|
Add a README file to your NuGet package that includes the server name.
|
||||||
|
|
||||||
|
### How It Works
|
||||||
|
- Registry fetches README from `https://api.nuget.org/v3-flatcontainer/{id}/{version}/readme`
|
||||||
|
- Passes if `mcp-name: server-name` is found in the README content
|
||||||
|
|
||||||
|
### Example server.json
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"name": "io.github.username/server-name",
|
||||||
|
"packages": [
|
||||||
|
{
|
||||||
|
"registry_type": "nuget",
|
||||||
|
"identifier": "Your.NuGet.Package",
|
||||||
|
"version": "1.0.0"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
The official MCP registry currently only supports the official NuGet registry (`https://api.nuget.org`).
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary><strong>🐳 Docker/OCI Images</strong></summary>
|
||||||
|
|
||||||
|
### Requirements
|
||||||
|
Add an annotation to your Docker image:
|
||||||
|
|
||||||
|
```dockerfile
|
||||||
|
LABEL io.modelcontextprotocol.server.name="io.github.username/server-name"
|
||||||
|
```
|
||||||
|
|
||||||
|
### How It Works
|
||||||
|
- Registry authenticates with Docker Hub using public token
|
||||||
|
- Fetches image manifest using Docker Registry v2 API
|
||||||
|
- Checks that `io.modelcontextprotocol.server.name` annotation matches your server name
|
||||||
|
- Fails if annotation is missing or doesn't match
|
||||||
|
|
||||||
|
### Example server.json
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"name": "io.github.username/server-name",
|
||||||
|
"packages": [
|
||||||
|
{
|
||||||
|
"registry_type": "oci",
|
||||||
|
"identifier": "yourusername/your-mcp-server",
|
||||||
|
"version": "1.0.0"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
The identifier is `namespace/repository`, and version is the tag and optionally digest.
|
||||||
|
|
||||||
|
The official MCP registry currently only supports the official Docker registry (`https://docker.io`).
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary><strong>📁 MCPB Packages</strong></summary>
|
||||||
|
|
||||||
|
### Requirements
|
||||||
|
**MCP reference** - MCPB package URLs must contain "mcp" somewhere within them, to ensure the correct artifact has been uploaded. This may be with the `.mcpb` extension or in the name of your repository.
|
||||||
|
|
||||||
|
### Example server.json
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"name": "io.github.username/server-name",
|
||||||
|
"packages": [
|
||||||
|
{
|
||||||
|
"registry_type": "mcpb",
|
||||||
|
"identifier": "https://github.com/you/your-repo/releases/download/v1.0.0/server.mcpb"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
The official MCP registry currently only supports artifacts hosted on GitHub or GitLab releases.
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
## Step 4: Authenticate with Registry
|
||||||
|
|
||||||
|
Choose your authentication method based on your use case:
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary><strong>🐙 GitHub</strong></summary>
|
||||||
|
|
||||||
|
GitHub auth grants publishing rights for `io.github.{username}/*` and `io.github.{org}/*` namespaces
|
||||||
|
|
||||||
|
### Interactive
|
||||||
|
|
||||||
|
```bash
|
||||||
|
mcp-publisher login github
|
||||||
|
```
|
||||||
|
|
||||||
|
- Opens browser for GitHub OAuth
|
||||||
|
|
||||||
|
### CI/CD in GitHub Actions
|
||||||
|
|
||||||
|
```bash
|
||||||
|
mcp-publisher login github-oidc
|
||||||
|
```
|
||||||
|
|
||||||
|
- Uses GitHub Actions OIDC tokens automatically
|
||||||
|
- Requires `id-token: write` permission in workflow
|
||||||
|
|
||||||
|
#### GitHub Actions Example
|
||||||
|
```yaml
|
||||||
|
name: Publish to MCP Registry
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags: ['v*']
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
publish:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
id-token: write # Required for OIDC
|
||||||
|
contents: read
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: Login to Registry
|
||||||
|
run: mcp-publisher login github-oidc
|
||||||
|
- name: Publish to Registry
|
||||||
|
run: mcp-publisher publish
|
||||||
|
```
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary><strong>🌐 DNS</strong></summary>
|
||||||
|
|
||||||
|
DNS auth grants publishing rights for `com.yourdomain/*` and `com.yourdomain.*/*` namespaces.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 1. Generate keypair and get DNS record
|
||||||
|
openssl genpkey -algorithm Ed25519 -out key.pem
|
||||||
|
echo "Add this TXT record to your domain:"
|
||||||
|
echo "_mcp-registry.yourdomain.com. IN TXT \"v=MCPv1; k=ed25519; p=$(openssl pkey -in key.pem -pubout -outform DER | tail -c 32 | base64)\""
|
||||||
|
|
||||||
|
# 2. Login with private key
|
||||||
|
mcp-publisher login dns --domain yourdomain.com --private-key $(openssl pkey -in key.pem -noout -text | grep -A3 "priv:" | tail -n +2 | tr -d ' :\n')
|
||||||
|
```
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary><strong>🔗 HTTP</strong></summary>
|
||||||
|
|
||||||
|
HTTP auth grants publishing rights for the `com.yourdomain/*` namespace.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 1. Generate keypair and host public key
|
||||||
|
openssl genpkey -algorithm Ed25519 -out key.pem
|
||||||
|
echo "Host at: https://yourdomain.com/.well-known/mcp-registry-auth"
|
||||||
|
echo "Content: v=MCPv1; k=ed25519; p=$(openssl pkey -in key.pem -pubout -outform DER | tail -c 32 | base64)"
|
||||||
|
|
||||||
|
# 2. Login with private key
|
||||||
|
mcp-publisher login http --domain yourdomain.com --private-key $(openssl pkey -in key.pem -noout -text | grep -A3 "priv:" | tail -n +2 | tr -d ' :\n')
|
||||||
|
```
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
## Step 5: Publish Your Server
|
||||||
|
|
||||||
|
Once you've completed steps 1-4, publish your server:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
mcp-publisher publish
|
||||||
|
```
|
||||||
|
|
||||||
|
If successful, your server will be available at `https://registry.modelcontextprotocol.io`!
|
||||||
|
|
@ -11,7 +11,6 @@ import (
|
||||||
"github.com/modelcontextprotocol/registry/internal/config"
|
"github.com/modelcontextprotocol/registry/internal/config"
|
||||||
"github.com/modelcontextprotocol/registry/internal/database"
|
"github.com/modelcontextprotocol/registry/internal/database"
|
||||||
"github.com/modelcontextprotocol/registry/internal/service"
|
"github.com/modelcontextprotocol/registry/internal/service"
|
||||||
"github.com/modelcontextprotocol/registry/internal/validators"
|
|
||||||
apiv0 "github.com/modelcontextprotocol/registry/pkg/api/v0"
|
apiv0 "github.com/modelcontextprotocol/registry/pkg/api/v0"
|
||||||
"github.com/modelcontextprotocol/registry/pkg/model"
|
"github.com/modelcontextprotocol/registry/pkg/model"
|
||||||
)
|
)
|
||||||
|
|
@ -67,11 +66,6 @@ func RegisterEditEndpoints(api huma.API, registry service.RegistryService, cfg *
|
||||||
return nil, huma.Error403Forbidden("You do not have edit permissions for this server")
|
return nil, huma.Error403Forbidden("You do not have edit permissions for this server")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Perform all schema validation
|
|
||||||
if err := validators.ValidatePublishRequest(input.Body); err != nil {
|
|
||||||
return nil, huma.Error400BadRequest(err.Error())
|
|
||||||
}
|
|
||||||
|
|
||||||
// Prevent renaming servers
|
// Prevent renaming servers
|
||||||
if currentServer.Name != input.Body.Name {
|
if currentServer.Name != input.Body.Name {
|
||||||
return nil, huma.Error400BadRequest("Cannot rename server")
|
return nil, huma.Error400BadRequest("Cannot rename server")
|
||||||
|
|
|
||||||
|
|
@ -22,8 +22,8 @@ import (
|
||||||
|
|
||||||
func TestEditServerEndpoint(t *testing.T) {
|
func TestEditServerEndpoint(t *testing.T) {
|
||||||
// Create registry service and insert a common test server
|
// Create registry service and insert a common test server
|
||||||
registryService := service.NewRegistryServiceWithDB(database.NewMemoryDB())
|
registryService := service.NewRegistryService(database.NewMemoryDB(), config.NewConfig())
|
||||||
|
|
||||||
// Publish a test server that will be used across test cases
|
// Publish a test server that will be used across test cases
|
||||||
testServer := apiv0.ServerJSON{
|
testServer := apiv0.ServerJSON{
|
||||||
Name: "io.github.domdomegg/test-server",
|
Name: "io.github.domdomegg/test-server",
|
||||||
|
|
@ -43,9 +43,9 @@ func TestEditServerEndpoint(t *testing.T) {
|
||||||
assert.NotNil(t, published)
|
assert.NotNil(t, published)
|
||||||
assert.NotNil(t, published.Meta)
|
assert.NotNil(t, published.Meta)
|
||||||
assert.NotNil(t, published.Meta.IOModelContextProtocolRegistry)
|
assert.NotNil(t, published.Meta.IOModelContextProtocolRegistry)
|
||||||
|
|
||||||
testServerID := published.Meta.IOModelContextProtocolRegistry.ID
|
testServerID := published.Meta.IOModelContextProtocolRegistry.ID
|
||||||
|
|
||||||
// Publish a second server for permission testing
|
// Publish a second server for permission testing
|
||||||
otherServer := apiv0.ServerJSON{
|
otherServer := apiv0.ServerJSON{
|
||||||
Name: "io.github.other/test-server",
|
Name: "io.github.other/test-server",
|
||||||
|
|
@ -65,9 +65,9 @@ func TestEditServerEndpoint(t *testing.T) {
|
||||||
assert.NotNil(t, otherPublished)
|
assert.NotNil(t, otherPublished)
|
||||||
assert.NotNil(t, otherPublished.Meta)
|
assert.NotNil(t, otherPublished.Meta)
|
||||||
assert.NotNil(t, otherPublished.Meta.IOModelContextProtocolRegistry)
|
assert.NotNil(t, otherPublished.Meta.IOModelContextProtocolRegistry)
|
||||||
|
|
||||||
otherServerID := otherPublished.Meta.IOModelContextProtocolRegistry.ID
|
otherServerID := otherPublished.Meta.IOModelContextProtocolRegistry.ID
|
||||||
|
|
||||||
// Publish a deleted server for undelete testing
|
// Publish a deleted server for undelete testing
|
||||||
deletedServer := apiv0.ServerJSON{
|
deletedServer := apiv0.ServerJSON{
|
||||||
Name: "io.github.domdomegg/deleted-server",
|
Name: "io.github.domdomegg/deleted-server",
|
||||||
|
|
@ -87,7 +87,7 @@ func TestEditServerEndpoint(t *testing.T) {
|
||||||
assert.NotNil(t, deletedPublished)
|
assert.NotNil(t, deletedPublished)
|
||||||
assert.NotNil(t, deletedPublished.Meta)
|
assert.NotNil(t, deletedPublished.Meta)
|
||||||
assert.NotNil(t, deletedPublished.Meta.IOModelContextProtocolRegistry)
|
assert.NotNil(t, deletedPublished.Meta.IOModelContextProtocolRegistry)
|
||||||
|
|
||||||
deletedServerID := deletedPublished.Meta.IOModelContextProtocolRegistry.ID
|
deletedServerID := deletedPublished.Meta.IOModelContextProtocolRegistry.ID
|
||||||
|
|
||||||
testCases := []struct {
|
testCases := []struct {
|
||||||
|
|
@ -143,9 +143,9 @@ func TestEditServerEndpoint(t *testing.T) {
|
||||||
Description: "Test server",
|
Description: "Test server",
|
||||||
VersionDetail: model.VersionDetail{Version: "1.0.0"},
|
VersionDetail: model.VersionDetail{Version: "1.0.0"},
|
||||||
},
|
},
|
||||||
serverID: testServerID,
|
serverID: testServerID,
|
||||||
expectedStatus: http.StatusUnauthorized,
|
expectedStatus: http.StatusUnauthorized,
|
||||||
expectedError: "Unauthorized",
|
expectedError: "Unauthorized",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "invalid token",
|
name: "invalid token",
|
||||||
|
|
@ -155,12 +155,12 @@ func TestEditServerEndpoint(t *testing.T) {
|
||||||
Description: "Test server",
|
Description: "Test server",
|
||||||
VersionDetail: model.VersionDetail{Version: "1.0.0"},
|
VersionDetail: model.VersionDetail{Version: "1.0.0"},
|
||||||
},
|
},
|
||||||
serverID: testServerID,
|
serverID: testServerID,
|
||||||
expectedStatus: http.StatusUnauthorized,
|
expectedStatus: http.StatusUnauthorized,
|
||||||
expectedError: "Unauthorized",
|
expectedError: "Unauthorized",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "permission denied - no edit permissions",
|
name: "permission denied - no edit permissions",
|
||||||
authHeader: func() string {
|
authHeader: func() string {
|
||||||
cfg := &config.Config{JWTPrivateKey: "bb2c6b424005acd5df47a9e2c87f446def86dd740c888ea3efb825b23f7ef47c"}
|
cfg := &config.Config{JWTPrivateKey: "bb2c6b424005acd5df47a9e2c87f446def86dd740c888ea3efb825b23f7ef47c"}
|
||||||
token, _ := generateTestJWTToken(cfg, auth.JWTClaims{
|
token, _ := generateTestJWTToken(cfg, auth.JWTClaims{
|
||||||
|
|
@ -182,7 +182,7 @@ func TestEditServerEndpoint(t *testing.T) {
|
||||||
expectedError: "Forbidden",
|
expectedError: "Forbidden",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "permission denied - wrong resource",
|
name: "permission denied - wrong resource",
|
||||||
authHeader: func() string {
|
authHeader: func() string {
|
||||||
cfg := &config.Config{JWTPrivateKey: "bb2c6b424005acd5df47a9e2c87f446def86dd740c888ea3efb825b23f7ef47c"}
|
cfg := &config.Config{JWTPrivateKey: "bb2c6b424005acd5df47a9e2c87f446def86dd740c888ea3efb825b23f7ef47c"}
|
||||||
token, _ := generateTestJWTToken(cfg, auth.JWTClaims{
|
token, _ := generateTestJWTToken(cfg, auth.JWTClaims{
|
||||||
|
|
@ -204,7 +204,7 @@ func TestEditServerEndpoint(t *testing.T) {
|
||||||
expectedError: "Forbidden",
|
expectedError: "Forbidden",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "server not found",
|
name: "server not found",
|
||||||
authHeader: func() string {
|
authHeader: func() string {
|
||||||
cfg := &config.Config{JWTPrivateKey: "bb2c6b424005acd5df47a9e2c87f446def86dd740c888ea3efb825b23f7ef47c"}
|
cfg := &config.Config{JWTPrivateKey: "bb2c6b424005acd5df47a9e2c87f446def86dd740c888ea3efb825b23f7ef47c"}
|
||||||
token, _ := generateTestJWTToken(cfg, auth.JWTClaims{
|
token, _ := generateTestJWTToken(cfg, auth.JWTClaims{
|
||||||
|
|
@ -226,7 +226,7 @@ func TestEditServerEndpoint(t *testing.T) {
|
||||||
expectedError: "Not Found",
|
expectedError: "Not Found",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "validation error - invalid server name",
|
name: "validation error - invalid server name",
|
||||||
authHeader: func() string {
|
authHeader: func() string {
|
||||||
cfg := &config.Config{JWTPrivateKey: "bb2c6b424005acd5df47a9e2c87f446def86dd740c888ea3efb825b23f7ef47c"}
|
cfg := &config.Config{JWTPrivateKey: "bb2c6b424005acd5df47a9e2c87f446def86dd740c888ea3efb825b23f7ef47c"}
|
||||||
token, _ := generateTestJWTToken(cfg, auth.JWTClaims{
|
token, _ := generateTestJWTToken(cfg, auth.JWTClaims{
|
||||||
|
|
@ -248,7 +248,7 @@ func TestEditServerEndpoint(t *testing.T) {
|
||||||
expectedError: "Bad Request",
|
expectedError: "Bad Request",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "cannot undelete server",
|
name: "cannot undelete server",
|
||||||
authHeader: func() string {
|
authHeader: func() string {
|
||||||
cfg := &config.Config{JWTPrivateKey: "bb2c6b424005acd5df47a9e2c87f446def86dd740c888ea3efb825b23f7ef47c"}
|
cfg := &config.Config{JWTPrivateKey: "bb2c6b424005acd5df47a9e2c87f446def86dd740c888ea3efb825b23f7ef47c"}
|
||||||
token, _ := generateTestJWTToken(cfg, auth.JWTClaims{
|
token, _ := generateTestJWTToken(cfg, auth.JWTClaims{
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@ import (
|
||||||
"github.com/modelcontextprotocol/registry/internal/auth"
|
"github.com/modelcontextprotocol/registry/internal/auth"
|
||||||
"github.com/modelcontextprotocol/registry/internal/config"
|
"github.com/modelcontextprotocol/registry/internal/config"
|
||||||
"github.com/modelcontextprotocol/registry/internal/service"
|
"github.com/modelcontextprotocol/registry/internal/service"
|
||||||
"github.com/modelcontextprotocol/registry/internal/validators"
|
|
||||||
apiv0 "github.com/modelcontextprotocol/registry/pkg/api/v0"
|
apiv0 "github.com/modelcontextprotocol/registry/pkg/api/v0"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -49,11 +48,6 @@ func RegisterPublishEndpoint(api huma.API, registry service.RegistryService, cfg
|
||||||
return nil, huma.Error401Unauthorized("Invalid or expired Registry JWT token", err)
|
return nil, huma.Error401Unauthorized("Invalid or expired Registry JWT token", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Perform all schema validation
|
|
||||||
if err := validators.ValidatePublishRequest(input.Body); err != nil {
|
|
||||||
return nil, huma.Error400BadRequest(err.Error())
|
|
||||||
}
|
|
||||||
|
|
||||||
// Verify that the token has permission to publish the server
|
// Verify that the token has permission to publish the server
|
||||||
if !jwtManager.HasPermission(input.Body.Name, auth.PermissionActionPublish, claims.Permissions) {
|
if !jwtManager.HasPermission(input.Body.Name, auth.PermissionActionPublish, claims.Permissions) {
|
||||||
return nil, huma.Error403Forbidden("You do not have permission to publish this server")
|
return nil, huma.Error403Forbidden("You do not have permission to publish this server")
|
||||||
|
|
|
||||||
|
|
@ -36,17 +36,18 @@ func generateIntegrationTestJWTToken(cfg *config.Config, claims auth.JWTClaims)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestPublishIntegration(t *testing.T) {
|
func TestPublishIntegration(t *testing.T) {
|
||||||
// Setup fake service
|
// Create test config with a valid Ed25519 seed and validation disabled for testing
|
||||||
registryService := service.NewRegistryServiceWithDB(database.NewMemoryDB())
|
|
||||||
|
|
||||||
// Create test config with a valid Ed25519 seed
|
|
||||||
testSeed := make([]byte, ed25519.SeedSize)
|
testSeed := make([]byte, ed25519.SeedSize)
|
||||||
_, err := rand.Read(testSeed)
|
_, err := rand.Read(testSeed)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
testConfig := &config.Config{
|
testConfig := &config.Config{
|
||||||
JWTPrivateKey: hex.EncodeToString(testSeed),
|
JWTPrivateKey: hex.EncodeToString(testSeed),
|
||||||
|
EnableRegistryValidation: false, // Disable for integration tests
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Setup fake service
|
||||||
|
registryService := service.NewRegistryService(database.NewMemoryDB(), testConfig)
|
||||||
|
|
||||||
// Create a new ServeMux and Huma API
|
// Create a new ServeMux and Huma API
|
||||||
mux := http.NewServeMux()
|
mux := http.NewServeMux()
|
||||||
api := humago.New(mux, huma.DefaultConfig("Test API", "1.0.0"))
|
api := humago.New(mux, huma.DefaultConfig("Test API", "1.0.0"))
|
||||||
|
|
@ -219,4 +220,53 @@ func TestPublishIntegration(t *testing.T) {
|
||||||
assert.Equal(t, http.StatusForbidden, rr.Code)
|
assert.Equal(t, http.StatusForbidden, rr.Code)
|
||||||
assert.Contains(t, rr.Body.String(), "You do not have permission to publish this server")
|
assert.Contains(t, rr.Body.String(), "You do not have permission to publish this server")
|
||||||
})
|
})
|
||||||
|
|
||||||
|
t.Run("publish succeeds with MCPB package", func(t *testing.T) {
|
||||||
|
publishReq := apiv0.ServerJSON{
|
||||||
|
Name: "io.github.domdomegg/airtable-mcp-server",
|
||||||
|
Description: "A test server with MCPB package",
|
||||||
|
VersionDetail: model.VersionDetail{
|
||||||
|
Version: "1.7.2",
|
||||||
|
},
|
||||||
|
Status: model.StatusActive,
|
||||||
|
Packages: []model.Package{
|
||||||
|
{
|
||||||
|
RegistryType: model.RegistryTypeMCPB,
|
||||||
|
Identifier: "github.com/domdomegg/airtable-mcp-server/releases/download/v1.7.2/airtable-mcp-server.mcpb",
|
||||||
|
Version: "1.7.2",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// Generate valid JWT token with wildcard permission
|
||||||
|
claims := auth.JWTClaims{
|
||||||
|
AuthMethod: auth.MethodNone,
|
||||||
|
Permissions: []auth.Permission{
|
||||||
|
{Action: auth.PermissionActionPublish, ResourcePattern: "*"},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
token, err := generateIntegrationTestJWTToken(testConfig, claims)
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
body, err := json.Marshal(publishReq)
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
req := httptest.NewRequest(http.MethodPost, "/v0/publish", bytes.NewReader(body))
|
||||||
|
req.Header.Set("Content-Type", "application/json")
|
||||||
|
req.Header.Set("Authorization", "Bearer "+token)
|
||||||
|
|
||||||
|
rr := httptest.NewRecorder()
|
||||||
|
mux.ServeHTTP(rr, req)
|
||||||
|
|
||||||
|
assert.Equal(t, http.StatusOK, rr.Code)
|
||||||
|
|
||||||
|
var response apiv0.ServerJSON
|
||||||
|
err = json.Unmarshal(rr.Body.Bytes(), &response)
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
assert.Equal(t, publishReq.Name, response.Name)
|
||||||
|
assert.Equal(t, publishReq.VersionDetail.Version, response.VersionDetail.Version)
|
||||||
|
assert.Len(t, response.Packages, 1)
|
||||||
|
assert.Equal(t, model.RegistryTypeMCPB, response.Packages[0].RegistryType)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
|
||||||
225
internal/api/handlers/v0/publish_registry_validation_test.go
Normal file
225
internal/api/handlers/v0/publish_registry_validation_test.go
Normal file
|
|
@ -0,0 +1,225 @@
|
||||||
|
package v0_test
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bytes"
|
||||||
|
"crypto/ed25519"
|
||||||
|
"crypto/rand"
|
||||||
|
"encoding/hex"
|
||||||
|
"encoding/json"
|
||||||
|
"net/http"
|
||||||
|
"net/http/httptest"
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
"github.com/danielgtaylor/huma/v2"
|
||||||
|
"github.com/danielgtaylor/huma/v2/adapters/humago"
|
||||||
|
v0 "github.com/modelcontextprotocol/registry/internal/api/handlers/v0"
|
||||||
|
"github.com/modelcontextprotocol/registry/internal/auth"
|
||||||
|
"github.com/modelcontextprotocol/registry/internal/config"
|
||||||
|
"github.com/modelcontextprotocol/registry/internal/database"
|
||||||
|
"github.com/modelcontextprotocol/registry/internal/service"
|
||||||
|
apiv0 "github.com/modelcontextprotocol/registry/pkg/api/v0"
|
||||||
|
"github.com/modelcontextprotocol/registry/pkg/model"
|
||||||
|
"github.com/stretchr/testify/assert"
|
||||||
|
"github.com/stretchr/testify/require"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestPublishRegistryValidation(t *testing.T) {
|
||||||
|
// Create test config with validation ENABLED
|
||||||
|
testSeed := make([]byte, ed25519.SeedSize)
|
||||||
|
_, err := rand.Read(testSeed)
|
||||||
|
require.NoError(t, err)
|
||||||
|
testConfig := &config.Config{
|
||||||
|
JWTPrivateKey: hex.EncodeToString(testSeed),
|
||||||
|
EnableRegistryValidation: true, // Enable validation for this test
|
||||||
|
}
|
||||||
|
|
||||||
|
// Setup fake service
|
||||||
|
registryService := service.NewRegistryService(database.NewMemoryDB(), testConfig)
|
||||||
|
|
||||||
|
// Create a new ServeMux and Huma API
|
||||||
|
mux := http.NewServeMux()
|
||||||
|
api := humago.New(mux, huma.DefaultConfig("Test API", "1.0.0"))
|
||||||
|
|
||||||
|
// Register the endpoint
|
||||||
|
v0.RegisterPublishEndpoint(api, registryService, testConfig)
|
||||||
|
|
||||||
|
t.Run("publish fails with npm registry validation error", func(t *testing.T) {
|
||||||
|
publishReq := apiv0.ServerJSON{
|
||||||
|
Name: "com.example/test-server-with-npm",
|
||||||
|
Description: "A test server with invalid npm package reference",
|
||||||
|
VersionDetail: model.VersionDetail{
|
||||||
|
Version: "1.0.0",
|
||||||
|
},
|
||||||
|
Packages: []model.Package{
|
||||||
|
{
|
||||||
|
RegistryType: model.RegistryTypeNPM,
|
||||||
|
Identifier: "nonexistent-npm-package-xyz123",
|
||||||
|
Version: "1.0.0",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// Generate valid JWT token with wildcard permission
|
||||||
|
claims := auth.JWTClaims{
|
||||||
|
AuthMethod: auth.MethodNone,
|
||||||
|
Permissions: []auth.Permission{
|
||||||
|
{Action: auth.PermissionActionPublish, ResourcePattern: "*"},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
token, err := generateTestJWTToken(testConfig, claims)
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
body, err := json.Marshal(publishReq)
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
req := httptest.NewRequest(http.MethodPost, "/v0/publish", bytes.NewReader(body))
|
||||||
|
req.Header.Set("Content-Type", "application/json")
|
||||||
|
req.Header.Set("Authorization", "Bearer "+token)
|
||||||
|
|
||||||
|
rr := httptest.NewRecorder()
|
||||||
|
mux.ServeHTTP(rr, req)
|
||||||
|
|
||||||
|
assert.Equal(t, http.StatusBadRequest, rr.Code)
|
||||||
|
assert.Contains(t, rr.Body.String(), "registry validation failed")
|
||||||
|
})
|
||||||
|
|
||||||
|
t.Run("publish succeeds with MCPB package (registry validation enabled)", func(t *testing.T) {
|
||||||
|
publishReq := apiv0.ServerJSON{
|
||||||
|
Name: "com.example/test-server-mcpb-validation",
|
||||||
|
Description: "A test server with MCPB package and registry validation enabled",
|
||||||
|
VersionDetail: model.VersionDetail{
|
||||||
|
Version: "0.0.36",
|
||||||
|
},
|
||||||
|
Packages: []model.Package{
|
||||||
|
{
|
||||||
|
RegistryType: model.RegistryTypeMCPB,
|
||||||
|
Identifier: "https://github.com/microsoft/playwright-mcp/releases/download/v0.0.36/playwright-mcp-extension-v0.0.36.zip",
|
||||||
|
Version: "0.0.36",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// Generate valid JWT token with wildcard permission
|
||||||
|
claims := auth.JWTClaims{
|
||||||
|
AuthMethod: auth.MethodNone,
|
||||||
|
Permissions: []auth.Permission{
|
||||||
|
{Action: auth.PermissionActionPublish, ResourcePattern: "*"},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
token, err := generateTestJWTToken(testConfig, claims)
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
body, err := json.Marshal(publishReq)
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
req := httptest.NewRequest(http.MethodPost, "/v0/publish", bytes.NewReader(body))
|
||||||
|
req.Header.Set("Content-Type", "application/json")
|
||||||
|
req.Header.Set("Authorization", "Bearer "+token)
|
||||||
|
|
||||||
|
rr := httptest.NewRecorder()
|
||||||
|
mux.ServeHTTP(rr, req)
|
||||||
|
|
||||||
|
assert.Equal(t, http.StatusOK, rr.Code)
|
||||||
|
|
||||||
|
var response apiv0.ServerJSON
|
||||||
|
err = json.Unmarshal(rr.Body.Bytes(), &response)
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
assert.Equal(t, publishReq.Name, response.Name)
|
||||||
|
assert.Equal(t, publishReq.VersionDetail.Version, response.VersionDetail.Version)
|
||||||
|
assert.Len(t, response.Packages, 1)
|
||||||
|
assert.Equal(t, model.RegistryTypeMCPB, response.Packages[0].RegistryType)
|
||||||
|
})
|
||||||
|
|
||||||
|
t.Run("publish fails when second package fails npm validation", func(t *testing.T) {
|
||||||
|
publishReq := apiv0.ServerJSON{
|
||||||
|
Name: "com.example/test-server-multiple-packages",
|
||||||
|
Description: "A test server with multiple packages where second fails",
|
||||||
|
VersionDetail: model.VersionDetail{
|
||||||
|
Version: "1.0.0",
|
||||||
|
},
|
||||||
|
Packages: []model.Package{
|
||||||
|
{
|
||||||
|
RegistryType: model.RegistryTypeMCPB,
|
||||||
|
Identifier: "https://github.com/microsoft/playwright-mcp/releases/download/v0.0.36/playwright-mcp-extension-v0.0.36.zip",
|
||||||
|
Version: "1.0.0",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
RegistryType: model.RegistryTypeNPM,
|
||||||
|
Identifier: "nonexistent-second-package-abc123",
|
||||||
|
Version: "1.0.0",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// Generate valid JWT token with wildcard permission
|
||||||
|
claims := auth.JWTClaims{
|
||||||
|
AuthMethod: auth.MethodNone,
|
||||||
|
Permissions: []auth.Permission{
|
||||||
|
{Action: auth.PermissionActionPublish, ResourcePattern: "*"},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
token, err := generateTestJWTToken(testConfig, claims)
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
body, err := json.Marshal(publishReq)
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
req := httptest.NewRequest(http.MethodPost, "/v0/publish", bytes.NewReader(body))
|
||||||
|
req.Header.Set("Content-Type", "application/json")
|
||||||
|
req.Header.Set("Authorization", "Bearer "+token)
|
||||||
|
|
||||||
|
rr := httptest.NewRecorder()
|
||||||
|
mux.ServeHTTP(rr, req)
|
||||||
|
|
||||||
|
assert.Equal(t, http.StatusBadRequest, rr.Code)
|
||||||
|
assert.Contains(t, rr.Body.String(), "registry validation failed for package 1")
|
||||||
|
assert.Contains(t, rr.Body.String(), "nonexistent-second-package-abc123")
|
||||||
|
})
|
||||||
|
|
||||||
|
t.Run("publish fails when first package fails validation", func(t *testing.T) {
|
||||||
|
publishReq := apiv0.ServerJSON{
|
||||||
|
Name: "com.example/test-server-first-package-fails",
|
||||||
|
Description: "A test server where first package fails",
|
||||||
|
VersionDetail: model.VersionDetail{
|
||||||
|
Version: "1.0.0",
|
||||||
|
},
|
||||||
|
Packages: []model.Package{
|
||||||
|
{
|
||||||
|
RegistryType: model.RegistryTypeNPM,
|
||||||
|
Identifier: "nonexistent-first-package-xyz789",
|
||||||
|
Version: "1.0.0",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
RegistryType: model.RegistryTypeMCPB,
|
||||||
|
Identifier: "https://github.com/microsoft/playwright-mcp/releases/download/v0.0.36/playwright-mcp-extension-v0.0.36.zip",
|
||||||
|
Version: "1.0.0",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// Generate valid JWT token with wildcard permission
|
||||||
|
claims := auth.JWTClaims{
|
||||||
|
AuthMethod: auth.MethodNone,
|
||||||
|
Permissions: []auth.Permission{
|
||||||
|
{Action: auth.PermissionActionPublish, ResourcePattern: "*"},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
token, err := generateTestJWTToken(testConfig, claims)
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
body, err := json.Marshal(publishReq)
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
req := httptest.NewRequest(http.MethodPost, "/v0/publish", bytes.NewReader(body))
|
||||||
|
req.Header.Set("Content-Type", "application/json")
|
||||||
|
req.Header.Set("Authorization", "Bearer "+token)
|
||||||
|
|
||||||
|
rr := httptest.NewRecorder()
|
||||||
|
mux.ServeHTTP(rr, req)
|
||||||
|
|
||||||
|
assert.Equal(t, http.StatusBadRequest, rr.Code)
|
||||||
|
assert.Contains(t, rr.Body.String(), "registry validation failed for package 0")
|
||||||
|
assert.Contains(t, rr.Body.String(), "nonexistent-first-package-xyz789")
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
@ -24,7 +24,6 @@ import (
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
// Helper function to generate a valid JWT token for testing
|
// Helper function to generate a valid JWT token for testing
|
||||||
func generateTestJWTToken(cfg *config.Config, claims auth.JWTClaims) (string, error) {
|
func generateTestJWTToken(cfg *config.Config, claims auth.JWTClaims) (string, error) {
|
||||||
jwtManager := auth.NewJWTManager(cfg)
|
jwtManager := auth.NewJWTManager(cfg)
|
||||||
|
|
@ -41,17 +40,18 @@ func TestPublishEndpoint(t *testing.T) {
|
||||||
_, err := rand.Read(testSeed)
|
_, err := rand.Read(testSeed)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
testConfig := &config.Config{
|
testConfig := &config.Config{
|
||||||
JWTPrivateKey: hex.EncodeToString(testSeed),
|
JWTPrivateKey: hex.EncodeToString(testSeed),
|
||||||
|
EnableRegistryValidation: false, // Disable for unit tests
|
||||||
}
|
}
|
||||||
|
|
||||||
testCases := []struct {
|
testCases := []struct {
|
||||||
name string
|
name string
|
||||||
requestBody interface{}
|
requestBody interface{}
|
||||||
tokenClaims *auth.JWTClaims
|
tokenClaims *auth.JWTClaims
|
||||||
authHeader string
|
authHeader string
|
||||||
setupRegistryService func(service.RegistryService)
|
setupRegistryService func(service.RegistryService)
|
||||||
expectedStatus int
|
expectedStatus int
|
||||||
expectedError string
|
expectedError string
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
name: "successful publish with GitHub auth",
|
name: "successful publish with GitHub auth",
|
||||||
|
|
@ -105,9 +105,9 @@ func TestPublishEndpoint(t *testing.T) {
|
||||||
expectedStatus: http.StatusOK,
|
expectedStatus: http.StatusOK,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "missing authorization header",
|
name: "missing authorization header",
|
||||||
requestBody: apiv0.ServerJSON{},
|
requestBody: apiv0.ServerJSON{},
|
||||||
authHeader: "", // Empty auth header
|
authHeader: "", // Empty auth header
|
||||||
setupRegistryService: func(_ service.RegistryService) {
|
setupRegistryService: func(_ service.RegistryService) {
|
||||||
// Empty registry - no setup needed
|
// Empty registry - no setup needed
|
||||||
},
|
},
|
||||||
|
|
@ -121,7 +121,7 @@ func TestPublishEndpoint(t *testing.T) {
|
||||||
Description: "Test server",
|
Description: "Test server",
|
||||||
VersionDetail: model.VersionDetail{Version: "1.0.0"},
|
VersionDetail: model.VersionDetail{Version: "1.0.0"},
|
||||||
},
|
},
|
||||||
authHeader: "InvalidFormat",
|
authHeader: "InvalidFormat",
|
||||||
setupRegistryService: func(_ service.RegistryService) {
|
setupRegistryService: func(_ service.RegistryService) {
|
||||||
// Empty registry - no setup needed
|
// Empty registry - no setup needed
|
||||||
},
|
},
|
||||||
|
|
@ -137,7 +137,7 @@ func TestPublishEndpoint(t *testing.T) {
|
||||||
Version: "1.0.0",
|
Version: "1.0.0",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
authHeader: "Bearer invalidToken",
|
authHeader: "Bearer invalidToken",
|
||||||
setupRegistryService: func(_ service.RegistryService) {
|
setupRegistryService: func(_ service.RegistryService) {
|
||||||
// Empty registry - no setup needed
|
// Empty registry - no setup needed
|
||||||
},
|
},
|
||||||
|
|
@ -209,13 +209,38 @@ func TestPublishEndpoint(t *testing.T) {
|
||||||
expectedStatus: http.StatusBadRequest,
|
expectedStatus: http.StatusBadRequest,
|
||||||
expectedError: "invalid version: cannot publish duplicate version",
|
expectedError: "invalid version: cannot publish duplicate version",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "package validation success - MCPB package",
|
||||||
|
requestBody: apiv0.ServerJSON{
|
||||||
|
Name: "com.example/test-server-mcpb",
|
||||||
|
Description: "A test server with MCPB package",
|
||||||
|
VersionDetail: model.VersionDetail{
|
||||||
|
Version: "1.0.0",
|
||||||
|
},
|
||||||
|
Packages: []model.Package{
|
||||||
|
{
|
||||||
|
RegistryType: model.RegistryTypeMCPB,
|
||||||
|
Identifier: "https://github.com/example/server/releases/download/v1.0.0/server.tar.gz",
|
||||||
|
Version: "1.0.0",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
tokenClaims: &auth.JWTClaims{
|
||||||
|
AuthMethod: auth.MethodNone,
|
||||||
|
Permissions: []auth.Permission{
|
||||||
|
{Action: auth.PermissionActionPublish, ResourcePattern: "*"},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
setupRegistryService: func(_ service.RegistryService) {},
|
||||||
|
expectedStatus: http.StatusOK,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, tc := range testCases {
|
for _, tc := range testCases {
|
||||||
t.Run(tc.name, func(t *testing.T) {
|
t.Run(tc.name, func(t *testing.T) {
|
||||||
// Create registry service
|
// Create registry service
|
||||||
registryService := service.NewRegistryServiceWithDB(database.NewMemoryDB())
|
registryService := service.NewRegistryService(database.NewMemoryDB(), testConfig)
|
||||||
|
|
||||||
// Setup registry service
|
// Setup registry service
|
||||||
tc.setupRegistryService(registryService)
|
tc.setupRegistryService(registryService)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ import (
|
||||||
"github.com/danielgtaylor/huma/v2/adapters/humago"
|
"github.com/danielgtaylor/huma/v2/adapters/humago"
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
v0 "github.com/modelcontextprotocol/registry/internal/api/handlers/v0"
|
v0 "github.com/modelcontextprotocol/registry/internal/api/handlers/v0"
|
||||||
|
"github.com/modelcontextprotocol/registry/internal/config"
|
||||||
"github.com/modelcontextprotocol/registry/internal/database"
|
"github.com/modelcontextprotocol/registry/internal/database"
|
||||||
"github.com/modelcontextprotocol/registry/internal/service"
|
"github.com/modelcontextprotocol/registry/internal/service"
|
||||||
apiv0 "github.com/modelcontextprotocol/registry/pkg/api/v0"
|
apiv0 "github.com/modelcontextprotocol/registry/pkg/api/v0"
|
||||||
|
|
@ -131,7 +132,7 @@ func TestServersListEndpoint(t *testing.T) {
|
||||||
for _, tc := range testCases {
|
for _, tc := range testCases {
|
||||||
t.Run(tc.name, func(t *testing.T) {
|
t.Run(tc.name, func(t *testing.T) {
|
||||||
// Create mock registry service
|
// Create mock registry service
|
||||||
registryService := service.NewRegistryServiceWithDB(database.NewMemoryDB())
|
registryService := service.NewRegistryService(database.NewMemoryDB(), config.NewConfig())
|
||||||
tc.setupRegistryService(registryService)
|
tc.setupRegistryService(registryService)
|
||||||
|
|
||||||
// Create a new test API
|
// Create a new test API
|
||||||
|
|
@ -202,7 +203,7 @@ func TestServersListEndpoint(t *testing.T) {
|
||||||
|
|
||||||
func TestServersDetailEndpoint(t *testing.T) {
|
func TestServersDetailEndpoint(t *testing.T) {
|
||||||
// Create mock registry service
|
// Create mock registry service
|
||||||
registryService := service.NewRegistryServiceWithDB(database.NewMemoryDB())
|
registryService := service.NewRegistryService(database.NewMemoryDB(), config.NewConfig())
|
||||||
|
|
||||||
testServer, err := registryService.Publish(apiv0.ServerJSON{
|
testServer, err := registryService.Publish(apiv0.ServerJSON{
|
||||||
Name: "com.example/test-server",
|
Name: "com.example/test-server",
|
||||||
|
|
@ -284,7 +285,7 @@ func TestServersDetailEndpoint(t *testing.T) {
|
||||||
// TestServersEndpointsIntegration tests the servers endpoints with actual HTTP requests
|
// TestServersEndpointsIntegration tests the servers endpoints with actual HTTP requests
|
||||||
func TestServersEndpointsIntegration(t *testing.T) {
|
func TestServersEndpointsIntegration(t *testing.T) {
|
||||||
// Create mock registry service
|
// Create mock registry service
|
||||||
registryService := service.NewRegistryServiceWithDB(database.NewMemoryDB())
|
registryService := service.NewRegistryService(database.NewMemoryDB(), config.NewConfig())
|
||||||
|
|
||||||
// Test data - publish a server and get its actual ID
|
// Test data - publish a server and get its actual ID
|
||||||
testServer := apiv0.ServerJSON{
|
testServer := apiv0.ServerJSON{
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestPrometheusHandler(t *testing.T) {
|
func TestPrometheusHandler(t *testing.T) {
|
||||||
registryService := service.NewRegistryServiceWithDB(database.NewMemoryDB())
|
registryService := service.NewRegistryService(database.NewMemoryDB(), config.NewConfig())
|
||||||
server, err := registryService.Publish(apiv0.ServerJSON{
|
server, err := registryService.Publish(apiv0.ServerJSON{
|
||||||
Name: "io.github.example/test-server",
|
Name: "io.github.example/test-server",
|
||||||
Description: "Test server detail",
|
Description: "Test server detail",
|
||||||
|
|
|
||||||
|
|
@ -14,15 +14,16 @@ const (
|
||||||
// Config holds the application configuration
|
// Config holds the application configuration
|
||||||
// See .env.example for more documentation
|
// See .env.example for more documentation
|
||||||
type Config struct {
|
type Config struct {
|
||||||
ServerAddress string `env:"SERVER_ADDRESS" envDefault:":8080"`
|
ServerAddress string `env:"SERVER_ADDRESS" envDefault:":8080"`
|
||||||
DatabaseType DatabaseType `env:"DATABASE_TYPE" envDefault:"postgresql"`
|
DatabaseType DatabaseType `env:"DATABASE_TYPE" envDefault:"postgresql"`
|
||||||
DatabaseURL string `env:"DATABASE_URL" envDefault:"postgres://localhost:5432/mcp-registry?sslmode=disable"`
|
DatabaseURL string `env:"DATABASE_URL" envDefault:"postgres://localhost:5432/mcp-registry?sslmode=disable"`
|
||||||
SeedFrom string `env:"SEED_FROM" envDefault:""`
|
SeedFrom string `env:"SEED_FROM" envDefault:""`
|
||||||
Version string `env:"VERSION" envDefault:"dev"`
|
Version string `env:"VERSION" envDefault:"dev"`
|
||||||
GithubClientID string `env:"GITHUB_CLIENT_ID" envDefault:""`
|
GithubClientID string `env:"GITHUB_CLIENT_ID" envDefault:""`
|
||||||
GithubClientSecret string `env:"GITHUB_CLIENT_SECRET" envDefault:""`
|
GithubClientSecret string `env:"GITHUB_CLIENT_SECRET" envDefault:""`
|
||||||
JWTPrivateKey string `env:"JWT_PRIVATE_KEY" envDefault:""`
|
JWTPrivateKey string `env:"JWT_PRIVATE_KEY" envDefault:""`
|
||||||
EnableAnonymousAuth bool `env:"ENABLE_ANONYMOUS_AUTH" envDefault:"false"`
|
EnableAnonymousAuth bool `env:"ENABLE_ANONYMOUS_AUTH" envDefault:"false"`
|
||||||
|
EnableRegistryValidation bool `env:"ENABLE_REGISTRY_VALIDATION" envDefault:"true"`
|
||||||
|
|
||||||
// OIDC Configuration
|
// OIDC Configuration
|
||||||
OIDCEnabled bool `env:"OIDC_ENABLED" envDefault:"false"`
|
OIDCEnabled bool `env:"OIDC_ENABLED" envDefault:"false"`
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
|
"github.com/modelcontextprotocol/registry/internal/config"
|
||||||
"github.com/modelcontextprotocol/registry/internal/database"
|
"github.com/modelcontextprotocol/registry/internal/database"
|
||||||
"github.com/modelcontextprotocol/registry/internal/validators"
|
"github.com/modelcontextprotocol/registry/internal/validators"
|
||||||
apiv0 "github.com/modelcontextprotocol/registry/pkg/api/v0"
|
apiv0 "github.com/modelcontextprotocol/registry/pkg/api/v0"
|
||||||
|
|
@ -16,13 +17,15 @@ const maxServerVersionsPerServer = 10000
|
||||||
|
|
||||||
// registryServiceImpl implements the RegistryService interface using our Database
|
// registryServiceImpl implements the RegistryService interface using our Database
|
||||||
type registryServiceImpl struct {
|
type registryServiceImpl struct {
|
||||||
db database.Database
|
db database.Database
|
||||||
|
cfg *config.Config
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewRegistryServiceWithDB creates a new registry service with the provided database
|
// NewRegistryService creates a new registry service with the provided database
|
||||||
func NewRegistryServiceWithDB(db database.Database) RegistryService {
|
func NewRegistryService(db database.Database, cfg *config.Config) RegistryService {
|
||||||
return ®istryServiceImpl{
|
return ®istryServiceImpl{
|
||||||
db: db,
|
db: db,
|
||||||
|
cfg: cfg,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -74,7 +77,7 @@ func (s *registryServiceImpl) Publish(req apiv0.ServerJSON) (*apiv0.ServerJSON,
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
// Validate the request
|
// Validate the request
|
||||||
if err := validators.ValidatePublishRequest(req); err != nil {
|
if err := validators.ValidatePublishRequest(req, s.cfg); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -204,7 +207,7 @@ func (s *registryServiceImpl) EditServer(id string, req apiv0.ServerJSON) (*apiv
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
// Validate the request
|
// Validate the request
|
||||||
if err := validators.ValidatePublishRequest(req); err != nil {
|
if err := validators.ValidatePublishRequest(req, s.cfg); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"github.com/modelcontextprotocol/registry/internal/config"
|
||||||
"github.com/modelcontextprotocol/registry/internal/database"
|
"github.com/modelcontextprotocol/registry/internal/database"
|
||||||
apiv0 "github.com/modelcontextprotocol/registry/pkg/api/v0"
|
apiv0 "github.com/modelcontextprotocol/registry/pkg/api/v0"
|
||||||
"github.com/modelcontextprotocol/registry/pkg/model"
|
"github.com/modelcontextprotocol/registry/pkg/model"
|
||||||
|
|
@ -38,7 +39,7 @@ func TestValidateNoDuplicateRemoteURLs(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
memDB := database.NewMemoryDB()
|
memDB := database.NewMemoryDB()
|
||||||
service := NewRegistryServiceWithDB(memDB)
|
service := NewRegistryService(memDB, &config.Config{EnableRegistryValidation: false})
|
||||||
|
|
||||||
for _, server := range existingServers {
|
for _, server := range existingServers {
|
||||||
_, err := service.Publish(*server)
|
_, err := service.Publish(*server)
|
||||||
|
|
|
||||||
|
|
@ -14,14 +14,13 @@ var (
|
||||||
ErrInvalidRemoteURL = errors.New("invalid remote URL")
|
ErrInvalidRemoteURL = errors.New("invalid remote URL")
|
||||||
|
|
||||||
// Registry validation errors
|
// Registry validation errors
|
||||||
ErrUnsupportedRegistryType = errors.New("unsupported registry type")
|
|
||||||
ErrUnsupportedRegistryBaseURL = errors.New("unsupported registry base URL")
|
ErrUnsupportedRegistryBaseURL = errors.New("unsupported registry base URL")
|
||||||
ErrMismatchedRegistryTypeAndURL = errors.New("registry type and base URL do not match")
|
ErrMismatchedRegistryTypeAndURL = errors.New("registry type and base URL do not match")
|
||||||
|
|
||||||
// Argument validation errors
|
// Argument validation errors
|
||||||
ErrNamedArgumentNameRequired = errors.New("named argument name is required")
|
ErrNamedArgumentNameRequired = errors.New("named argument name is required")
|
||||||
ErrInvalidNamedArgumentName = errors.New("invalid named argument name format")
|
ErrInvalidNamedArgumentName = errors.New("invalid named argument name format")
|
||||||
ErrArgumentValueStartsWithName = errors.New("argument value cannot start with the argument name")
|
ErrArgumentValueStartsWithName = errors.New("argument value cannot start with the argument name")
|
||||||
ErrArgumentDefaultStartsWithName = errors.New("argument default cannot start with the argument name")
|
ErrArgumentDefaultStartsWithName = errors.New("argument default cannot start with the argument name")
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
29
internal/validators/package.go
Normal file
29
internal/validators/package.go
Normal file
|
|
@ -0,0 +1,29 @@
|
||||||
|
package validators
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/modelcontextprotocol/registry/internal/validators/registries"
|
||||||
|
"github.com/modelcontextprotocol/registry/pkg/model"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ValidatePackage validates that the package referenced in the server configuration is:
|
||||||
|
// 1. allowed on the official registry (based on registry base url); and
|
||||||
|
// 2. owned by the publisher, by checking for a matching server name in the package metadata
|
||||||
|
func ValidatePackage(ctx context.Context, pkg model.Package, serverName string) error {
|
||||||
|
switch pkg.RegistryType {
|
||||||
|
case model.RegistryTypeNPM:
|
||||||
|
return registries.ValidateNPM(ctx, pkg, serverName)
|
||||||
|
case model.RegistryTypePyPI:
|
||||||
|
return registries.ValidatePyPI(ctx, pkg, serverName)
|
||||||
|
case model.RegistryTypeNuGet:
|
||||||
|
return registries.ValidateNuGet(ctx, pkg, serverName)
|
||||||
|
case model.RegistryTypeOCI:
|
||||||
|
return registries.ValidateOCI(ctx, pkg, serverName)
|
||||||
|
case model.RegistryTypeMCPB:
|
||||||
|
return registries.ValidateMCPB(ctx, pkg, serverName)
|
||||||
|
default:
|
||||||
|
return fmt.Errorf("unsupported registry type: %s", pkg.RegistryType)
|
||||||
|
}
|
||||||
|
}
|
||||||
167
internal/validators/registries/mcpb.go
Normal file
167
internal/validators/registries/mcpb.go
Normal file
|
|
@ -0,0 +1,167 @@
|
||||||
|
package registries
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"fmt"
|
||||||
|
"net/http"
|
||||||
|
"net/url"
|
||||||
|
"regexp"
|
||||||
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/modelcontextprotocol/registry/pkg/model"
|
||||||
|
)
|
||||||
|
|
||||||
|
func ValidateMCPB(ctx context.Context, pkg model.Package, _ string) error {
|
||||||
|
err := validateMCPBUrl(pkg.Identifier)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
inferredBaseURL, err := inferMCPBRegistryBaseURL(pkg.Identifier)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
if pkg.RegistryBaseURL == "" {
|
||||||
|
pkg.RegistryBaseURL = inferredBaseURL
|
||||||
|
} else if pkg.RegistryBaseURL != inferredBaseURL {
|
||||||
|
return fmt.Errorf("MCPB package '%s' has inconsistent registry base URL: %s (expected: %s)",
|
||||||
|
pkg.Identifier, pkg.RegistryBaseURL, inferredBaseURL)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parse the URL to validate format
|
||||||
|
url, err := url.Parse(pkg.Identifier)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("invalid MCPB package URL: %w", err)
|
||||||
|
}
|
||||||
|
if url.Scheme != "https" {
|
||||||
|
return fmt.Errorf("invalid MCPB package URL, must use HTTPS: %s", pkg.Identifier)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check that the URL contains 'mcp' somewhere (case-insensitive)
|
||||||
|
if !strings.Contains(strings.ToLower(pkg.Identifier), "mcp") {
|
||||||
|
return fmt.Errorf("MCPB package URL must contain 'mcp': %s", pkg.Identifier)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Verify the file exists and is publicly accessible
|
||||||
|
client := &http.Client{Timeout: 10 * time.Second}
|
||||||
|
req, err := http.NewRequestWithContext(ctx, http.MethodHead, pkg.Identifier, nil)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("failed to create request: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
req.Header.Set("User-Agent", "MCP-Registry-Validator/1.0")
|
||||||
|
|
||||||
|
resp, err := client.Do(req)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("failed to verify MCPB package accessibility: %w", err)
|
||||||
|
}
|
||||||
|
defer resp.Body.Close()
|
||||||
|
|
||||||
|
if resp.StatusCode != http.StatusOK {
|
||||||
|
return fmt.Errorf("MCPB package '%s' is not publicly accessible (status: %d)", pkg.Identifier, resp.StatusCode)
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func validateMCPBUrl(fullURL string) error {
|
||||||
|
parsedURL, err := url.Parse(fullURL)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("invalid MCPB package URL: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
host := strings.ToLower(parsedURL.Host)
|
||||||
|
allowedHosts := []string{
|
||||||
|
"github.com",
|
||||||
|
"www.github.com",
|
||||||
|
"gitlab.com",
|
||||||
|
"www.gitlab.com",
|
||||||
|
}
|
||||||
|
|
||||||
|
isAllowed := false
|
||||||
|
for _, allowed := range allowedHosts {
|
||||||
|
if host == allowed {
|
||||||
|
isAllowed = true
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if !isAllowed {
|
||||||
|
return fmt.Errorf("MCPB packages must be hosted on allowlisted providers (GitHub or GitLab). Host '%s' is not allowed", host)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Validate URL path is a proper release URL with strict structure validation
|
||||||
|
path := parsedURL.Path
|
||||||
|
switch host {
|
||||||
|
case "github.com", "www.github.com":
|
||||||
|
// GitHub release URLs must match: /owner/repo/releases/download/tag/filename
|
||||||
|
if !isValidGitHubReleaseURL(path) {
|
||||||
|
return fmt.Errorf("GitHub MCPB packages must be release assets following the pattern '/owner/repo/releases/download/tag/filename'")
|
||||||
|
}
|
||||||
|
case "gitlab.com", "www.gitlab.com":
|
||||||
|
// GitLab release URLs must match specific patterns
|
||||||
|
if !isValidGitLabReleaseURL(path) {
|
||||||
|
return fmt.Errorf("GitLab MCPB packages must be release assets following patterns '/owner/repo/-/releases/tag/downloads/filename' or '/owner/repo/-/package_files/id/download'")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// isValidGitHubReleaseURL validates that a path follows the GitHub release asset pattern
|
||||||
|
// Pattern: /owner/repo/releases/download/tag/filename
|
||||||
|
func isValidGitHubReleaseURL(path string) bool {
|
||||||
|
// GitHub release URL pattern: /owner/repo/releases/download/tag/filename
|
||||||
|
// - owner: username or organization (1-39 chars, alphanumeric + hyphens, no consecutive hyphens)
|
||||||
|
// - repo: repository name (similar rules to owner)
|
||||||
|
// - tag: release tag (can contain various characters but not empty)
|
||||||
|
// - filename: asset filename (not empty)
|
||||||
|
pattern := `^/([a-zA-Z0-9]([a-zA-Z0-9\-]{0,37}[a-zA-Z0-9])?)/([a-zA-Z0-9._\-]+)/releases/download/([^/]+)/([^/]+)$`
|
||||||
|
matched, _ := regexp.MatchString(pattern, path)
|
||||||
|
return matched
|
||||||
|
}
|
||||||
|
|
||||||
|
// isValidGitLabReleaseURL validates that a path follows GitLab release asset patterns
|
||||||
|
func isValidGitLabReleaseURL(path string) bool {
|
||||||
|
// GitLab release URL patterns:
|
||||||
|
// 1. /owner/repo/-/releases/tag/downloads/filename
|
||||||
|
// 2. /owner/repo/-/package_files/id/download
|
||||||
|
// 3. /group/subgroup/repo/-/releases/tag/downloads/filename (nested groups)
|
||||||
|
|
||||||
|
// The key insight is that GitLab URLs have "/-/" as a delimiter that separates the
|
||||||
|
// project path from the GitLab-specific routes. Everything before "/-/" is the project path.
|
||||||
|
|
||||||
|
// Pattern 1: Release downloads with /-/releases/tag/downloads/filename
|
||||||
|
releasePattern := `^/([a-zA-Z0-9._\-]+(?:/[a-zA-Z0-9._\-]+)*)/-/releases/([^/]+)/downloads/([^/]+)$`
|
||||||
|
if matched, _ := regexp.MatchString(releasePattern, path); matched {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// Pattern 2: Package files with /-/package_files/id/download
|
||||||
|
packagePattern := `^/([a-zA-Z0-9._\-]+(?:/[a-zA-Z0-9._\-]+)*)/-/package_files/([0-9]+)/download$`
|
||||||
|
if matched, _ := regexp.MatchString(packagePattern, path); matched {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// inferMCPBRegistryBaseURL infers the registry base URL from an MCPB identifier
|
||||||
|
func inferMCPBRegistryBaseURL(identifier string) (string, error) {
|
||||||
|
parsedURL, err := url.Parse(identifier)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
|
||||||
|
host := strings.ToLower(parsedURL.Host)
|
||||||
|
switch host {
|
||||||
|
case "github.com", "www.github.com":
|
||||||
|
return model.RegistryURLGitHub, nil
|
||||||
|
case "gitlab.com", "www.gitlab.com":
|
||||||
|
return model.RegistryURLGitLab, nil
|
||||||
|
default:
|
||||||
|
return "", fmt.Errorf("invalid host for MCPB package: %s, expected github or gitlab", host)
|
||||||
|
}
|
||||||
|
}
|
||||||
81
internal/validators/registries/mcpb_test.go
Normal file
81
internal/validators/registries/mcpb_test.go
Normal file
|
|
@ -0,0 +1,81 @@
|
||||||
|
package registries_test
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
"github.com/modelcontextprotocol/registry/internal/validators/registries"
|
||||||
|
"github.com/modelcontextprotocol/registry/pkg/model"
|
||||||
|
"github.com/stretchr/testify/assert"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestValidateMCPB(t *testing.T) {
|
||||||
|
ctx := context.Background()
|
||||||
|
|
||||||
|
tests := []struct {
|
||||||
|
name string
|
||||||
|
packageName string
|
||||||
|
serverName string
|
||||||
|
expectError bool
|
||||||
|
errorMessage string
|
||||||
|
}{
|
||||||
|
{
|
||||||
|
name: "valid MCPB package should pass",
|
||||||
|
packageName: "https://github.com/domdomegg/airtable-mcp-server/releases/download/v1.7.2/airtable-mcp-server.mcpb",
|
||||||
|
serverName: "io.github.domdomegg/airtable-mcp-server",
|
||||||
|
expectError: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "valid MCPB package should pass",
|
||||||
|
packageName: "https://github.com/microsoft/playwright-mcp/releases/download/v0.0.36/playwright-mcp-extension-v0.0.36.zip",
|
||||||
|
serverName: "com.microsoft/playwright-mcp",
|
||||||
|
expectError: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "valid MCPB package with .mcpb extension should fail accessibility check",
|
||||||
|
packageName: "https://github.com/example/server/releases/download/v1.0.0/server.mcpb",
|
||||||
|
serverName: "com.example/test",
|
||||||
|
expectError: true,
|
||||||
|
errorMessage: "not publicly accessible",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "invalid URL without mcp anywhere should fail",
|
||||||
|
packageName: "https://github.com/example/server/releases/download/v1.0.0/server.tar.gz",
|
||||||
|
serverName: "com.example/test",
|
||||||
|
expectError: true,
|
||||||
|
errorMessage: "URL must contain 'mcp'",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "invalid URL format should fail",
|
||||||
|
packageName: "not://a valid url for mcpb!",
|
||||||
|
serverName: "com.example/test",
|
||||||
|
expectError: true,
|
||||||
|
errorMessage: "invalid MCPB package URL",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "non-existent file should fail accessibility check",
|
||||||
|
packageName: "https://github.com/nonexistent/repo/releases/download/v1.0.0/mcp-server.tar.gz",
|
||||||
|
serverName: "com.example/test",
|
||||||
|
expectError: true,
|
||||||
|
errorMessage: "not publicly accessible",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, tt := range tests {
|
||||||
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
|
pkg := model.Package{
|
||||||
|
RegistryType: model.RegistryTypeMCPB,
|
||||||
|
Identifier: tt.packageName,
|
||||||
|
}
|
||||||
|
|
||||||
|
err := registries.ValidateMCPB(ctx, pkg, tt.serverName)
|
||||||
|
|
||||||
|
if tt.expectError {
|
||||||
|
assert.Error(t, err)
|
||||||
|
assert.Contains(t, err.Error(), tt.errorMessage)
|
||||||
|
} else {
|
||||||
|
assert.NoError(t, err)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
66
internal/validators/registries/npm.go
Normal file
66
internal/validators/registries/npm.go
Normal file
|
|
@ -0,0 +1,66 @@
|
||||||
|
package registries
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
|
"net/http"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/modelcontextprotocol/registry/pkg/model"
|
||||||
|
)
|
||||||
|
|
||||||
|
// NPMPackageResponse represents the structure returned by the NPM registry API
|
||||||
|
type NPMPackageResponse struct {
|
||||||
|
MCPName string `json:"mcpName"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// ValidateNPM validates that an NPM package contains the correct MCP server name
|
||||||
|
func ValidateNPM(ctx context.Context, pkg model.Package, serverName string) error {
|
||||||
|
// Set default registry base URL if empty
|
||||||
|
if pkg.RegistryBaseURL == "" {
|
||||||
|
pkg.RegistryBaseURL = model.RegistryURLNPM
|
||||||
|
}
|
||||||
|
|
||||||
|
// Validate that the registry base URL matches NPM exactly
|
||||||
|
if pkg.RegistryBaseURL != model.RegistryURLNPM {
|
||||||
|
return fmt.Errorf("registry type and base URL do not match: '%s' is not valid for registry type '%s'. Expected: %s",
|
||||||
|
pkg.RegistryBaseURL, model.RegistryTypeNPM, model.RegistryURLNPM)
|
||||||
|
}
|
||||||
|
|
||||||
|
client := &http.Client{Timeout: 10 * time.Second}
|
||||||
|
|
||||||
|
url := pkg.RegistryBaseURL + "/" + pkg.Identifier + "/" + pkg.Version
|
||||||
|
req, err := http.NewRequestWithContext(ctx, http.MethodGet, url, nil)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("failed to create request: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
req.Header.Set("User-Agent", "MCP-Registry-Validator/1.0")
|
||||||
|
req.Header.Set("Accept", "application/json")
|
||||||
|
|
||||||
|
resp, err := client.Do(req)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("failed to fetch package metadata from NPM: %w", err)
|
||||||
|
}
|
||||||
|
defer resp.Body.Close()
|
||||||
|
|
||||||
|
if resp.StatusCode != http.StatusOK {
|
||||||
|
return fmt.Errorf("NPM package '%s' not found (status: %d)", pkg.Identifier, resp.StatusCode)
|
||||||
|
}
|
||||||
|
|
||||||
|
var npmResp NPMPackageResponse
|
||||||
|
if err := json.NewDecoder(resp.Body).Decode(&npmResp); err != nil {
|
||||||
|
return fmt.Errorf("failed to parse NPM package metadata: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if npmResp.MCPName == "" {
|
||||||
|
return fmt.Errorf("NPM package '%s' is missing required 'mcpName' field. Add this to your package.json: \"mcpName\": \"%s\"", pkg.Identifier, serverName)
|
||||||
|
}
|
||||||
|
|
||||||
|
if npmResp.MCPName != serverName {
|
||||||
|
return fmt.Errorf("NPM package ownership validation failed. Expected mcpName '%s', got '%s'", serverName, npmResp.MCPName)
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
90
internal/validators/registries/npm_test.go
Normal file
90
internal/validators/registries/npm_test.go
Normal file
|
|
@ -0,0 +1,90 @@
|
||||||
|
package registries_test
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
"github.com/modelcontextprotocol/registry/internal/validators/registries"
|
||||||
|
"github.com/modelcontextprotocol/registry/pkg/model"
|
||||||
|
"github.com/stretchr/testify/assert"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestValidateNPM_RealPackages(t *testing.T) {
|
||||||
|
ctx := context.Background()
|
||||||
|
|
||||||
|
tests := []struct {
|
||||||
|
name string
|
||||||
|
packageName string
|
||||||
|
version string
|
||||||
|
serverName string
|
||||||
|
expectError bool
|
||||||
|
errorMessage string
|
||||||
|
}{
|
||||||
|
{
|
||||||
|
name: "non-existent package should fail",
|
||||||
|
packageName: generateRandomPackageName(),
|
||||||
|
version: "1.0.0",
|
||||||
|
serverName: "com.example/test",
|
||||||
|
expectError: true,
|
||||||
|
errorMessage: "not found",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "real package without mcpName should fail",
|
||||||
|
packageName: "express", // Popular package without mcpName field
|
||||||
|
version: "4.18.2",
|
||||||
|
serverName: "com.example/test",
|
||||||
|
expectError: true,
|
||||||
|
errorMessage: "missing required 'mcpName' field",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "real package without mcpName should fail",
|
||||||
|
packageName: "lodash", // Another popular package
|
||||||
|
version: "4.17.21",
|
||||||
|
serverName: "com.example/completely-different-name",
|
||||||
|
expectError: true,
|
||||||
|
errorMessage: "missing required 'mcpName' field",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "real package without mcpName should fail",
|
||||||
|
packageName: "airtable-mcp-server",
|
||||||
|
version: "1.5.0",
|
||||||
|
serverName: "io.github.domdomegg/airtable-mcp-server",
|
||||||
|
expectError: true,
|
||||||
|
errorMessage: "missing required 'mcpName' field",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "real package with incorrect mcpName should fail",
|
||||||
|
packageName: "airtable-mcp-server",
|
||||||
|
version: "1.7.2",
|
||||||
|
serverName: "io.github.not-domdomegg/airtable-mcp-server",
|
||||||
|
expectError: true,
|
||||||
|
errorMessage: "Expected mcpName 'io.github.not-domdomegg/airtable-mcp-server', got 'io.github.domdomegg/airtable-mcp-server'",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "real package with correct mcpName should pass",
|
||||||
|
packageName: "airtable-mcp-server",
|
||||||
|
version: "1.7.2",
|
||||||
|
serverName: "io.github.domdomegg/airtable-mcp-server",
|
||||||
|
expectError: false,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, tt := range tests {
|
||||||
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
|
pkg := model.Package{
|
||||||
|
RegistryType: model.RegistryTypeNPM,
|
||||||
|
Identifier: tt.packageName,
|
||||||
|
Version: tt.version,
|
||||||
|
}
|
||||||
|
|
||||||
|
err := registries.ValidateNPM(ctx, pkg, tt.serverName)
|
||||||
|
|
||||||
|
if tt.expectError {
|
||||||
|
assert.Error(t, err)
|
||||||
|
assert.Contains(t, err.Error(), tt.errorMessage)
|
||||||
|
} else {
|
||||||
|
assert.NoError(t, err)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue