Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
branches: [ main ]

env:
GO_VERSION: '1.23.x'
GO_VERSION: '1.24.x'

jobs:
# Build, Lint, and Validate
Expand All @@ -17,38 +17,38 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}

- name: Cache Go modules
uses: actions/cache@v4
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
key: ${{ runner.os }}-go-${{ github.sha }}-${{ hashFiles('**/go.sum', '.golangci.yml') }}
restore-keys: |
${{ runner.os }}-go-

- name: Download dependencies
run: go mod download

- name: Install golangci-lint
run: |
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v2.3.1

- name: Run lint
run: make lint

- name: Validate schemas and examples
run: make validate

- name: Build application
run: make build

- name: Check for vulnerabilities
run: |
go install golang.org/x/vuln/cmd/govulncheck@latest
Expand All @@ -61,12 +61,12 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}

- name: Cache Go modules
uses: actions/cache@v4
with:
Expand All @@ -76,13 +76,13 @@ jobs:
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-

- name: Download dependencies
run: go mod download

- name: Run all tests
run: make test-all

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
Expand Down
60 changes: 5 additions & 55 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# GolangCI-Lint configuration
# See: https://golangci-lint.run/usage/configuration/

version: "2"
run:
modules-download-mode: readonly
Expand All @@ -19,7 +16,6 @@ linters:
- errorlint
- exhaustive
- forbidigo
- funlen
- gocognit
- goconst
- gocritic
Expand All @@ -32,7 +28,6 @@ linters:
- grouper
- importas
- ireturn
- lll
- makezero
- misspell
- nakedret
Expand All @@ -48,7 +43,6 @@ linters:
- revive
- rowserrcheck
- sqlclosecheck
- staticcheck
- testpackage
- thelper
- tparallel
Expand All @@ -59,69 +53,25 @@ linters:
- whitespace
settings:
cyclop:
max-complexity: 50
funlen:
lines: 150
statements: 150
max-complexity: 20
dupl:
threshold: 300
gocognit:
min-complexity: 50
goconst:
min-len: 3
min-occurrences: 3
gocyclo:
min-complexity: 25
lll:
line-length: 150
misspell:
locale: US
mnd:
checks:
- argument
- case
- condition
- operation
- return
min-complexity: 51
nestif:
min-complexity: 8
revive:
rules:
- name: use-any
severity: error
disabled: false
min-complexity: 10
exclusions:
generated: lax
presets:
- comments
- common-false-positives
- legacy
- std-error-handling
rules:
- linters:
- dupl
- errcheck
- funlen
- gocyclo
- gosec
- mnd
path: _test\.go
- linters:
- lll
path: docs/
- linters:
- mnd
path: integrationtests/
- linters:
- gomoddirectives
path: go\.mod
paths:
- third_party$
- builtin$
- examples$
formatters:
enable:
- gci
- gofmt
- goimports
exclusions:
generated: lax
paths:
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.23-alpine AS builder
FROM golang:1.24-alpine AS builder
WORKDIR /app
COPY . .
ARG GO_BUILD_TAGS
Expand Down
36 changes: 33 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,14 @@ The MCP Registry service provides a centralized repository for MCP server entrie
- MongoDB and in-memory database support
- Comprehensive API documentation
- Pagination support for listing registry entries
- Seed data export/import composability with HTTP support
- Registry instance data sharing via HTTP endpoints

## Getting Started

### Prerequisites

- Go 1.23.x (required - check with `go version`)
- Go 1.24.x (required - check with `go version`)
- MongoDB
- Docker (optional, but recommended for development)

Expand Down Expand Up @@ -413,8 +415,7 @@ The service can be configured using environment variables:
| `MCP_REGISTRY_GITHUB_CLIENT_ID` | GitHub App Client ID | |
| `MCP_REGISTRY_GITHUB_CLIENT_SECRET` | GitHub App Client Secret | |
| `MCP_REGISTRY_LOG_LEVEL` | Log level | `info` |
| `MCP_REGISTRY_SEED_FILE_PATH` | Path to import seed file | `data/seed.json` |
| `MCP_REGISTRY_SEED_IMPORT` | Import `seed.json` on first run | `true` |
| `MCP_REGISTRY_SEED_FROM` | Path or URL to import seed data (supports local files and HTTP URLs) | `data/seed.json` |
| `MCP_REGISTRY_SERVER_ADDRESS` | Listen address for the server | `:8080` |

## Pre-built Docker Images
Expand All @@ -435,6 +436,35 @@ docker run -p 8080:8080 ghcr.io/modelcontextprotocol/registry:main-20250806-a1b2

**Configuration:** The Docker images support all environment variables listed in the [Configuration](#configuration) section. For production deployments, you'll need to configure the database connection and other settings via environment variables.

### Import Seed Data

Registry instances can import data from:

**Local files:**
```bash
MCP_REGISTRY_SEED_FROM=data/seed.json ./registry
```

**HTTP endpoints:**
```bash
MCP_REGISTRY_SEED_FROM=http://other-registry:8080 ./registry
```

## Testing
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Delete this block: think it reappeared as a result of merge conflict. This is already documented elsewhere.


Run the test script to validate API endpoints:

```bash
./scripts/test_endpoints.sh
```

You can specify specific endpoints to test:

```bash
./scripts/test_endpoints.sh --endpoint health
./scripts/test_endpoints.sh --endpoint servers
```

## License

See the [LICENSE](LICENSE) file for details.
10 changes: 5 additions & 5 deletions cmd/registry/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,14 @@ func main() {
return
}

// Import seed data if requested (works for both memory and MongoDB)
if cfg.SeedImport {
log.Println("Importing data...")
// Import seed data if seed source is provided (works for both memory and MongoDB)
if cfg.SeedFrom != "" {
log.Printf("Importing data from %s...", cfg.SeedFrom)
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute)
defer cancel()

if err := db.ImportSeed(ctx, cfg.SeedFilePath); err != nil {
log.Printf("Failed to import seed file: %v", err)
if err := db.ImportSeed(ctx, cfg.SeedFrom); err != nil {
log.Printf("Failed to import seed data: %v", err)
} else {
log.Println("Data import completed successfully")
}
Expand Down
5 changes: 1 addition & 4 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/modelcontextprotocol/registry

go 1.23.0
go 1.24.0

require (
github.com/caarlos0/env/v11 v11.3.1
Expand Down Expand Up @@ -38,6 +38,3 @@ require (
golang.org/x/tools v0.32.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)

// temporary replace directive to use local version of the module so we can share in different orgs
replace github.com/modelcontextprotocol/registry => ./
50 changes: 50 additions & 0 deletions internal/api/handlers/v0/mocks_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package v0_test

import (
"context"

"github.com/modelcontextprotocol/registry/internal/model"
"github.com/stretchr/testify/mock"
)

// MockRegistryService is a mock implementation of the RegistryService interface
type MockRegistryService struct {
mock.Mock
}

func (m *MockRegistryService) List(cursor string, limit int) ([]model.Server, string, error) {
args := m.Called(cursor, limit)
return args.Get(0).([]model.Server), args.String(1), args.Error(2)
}

func (m *MockRegistryService) GetByID(id string) (*model.ServerDetail, error) {
args := m.Called(id)
return args.Get(0).(*model.ServerDetail), args.Error(1)
}

func (m *MockRegistryService) Publish(serverDetail *model.ServerDetail) error {
args := m.Called(serverDetail)
return args.Error(0)
}

// MockAuthService is a mock implementation of the auth.Service interface
type MockAuthService struct {
mock.Mock
}

func (m *MockAuthService) StartAuthFlow(
ctx context.Context, method model.AuthMethod, repoRef string,
) (map[string]string, string, error) {
args := m.Called(ctx, method, repoRef)
return args.Get(0).(map[string]string), args.String(1), args.Error(2)
}

func (m *MockAuthService) CheckAuthStatus(ctx context.Context, statusToken string) (string, error) {
args := m.Called(ctx, statusToken)
return args.String(0), args.Error(1)
}

func (m *MockAuthService) ValidateAuth(ctx context.Context, authentication model.Authentication) (bool, error) {
args := m.Called(ctx, authentication)
return args.Bool(0), args.Error(1)
}
Loading
Loading