Skip to content

Commit 38538b5

Browse files
committed
refactor: consolidate documentation and remove redundancy
- Remove CLAUDE.md with Import statement in favor of direct README.md reference - Consolidate CONTRIBUTING.md content into README.md Contributing section - Move architecture details and useful developer info from old CLAUDE.md to README.md - Remove redundant information that was duplicated between files This reduces documentation maintenance overhead by having a single source of truth in README.md while keeping Claude Code functional.
1 parent 6ba6129 commit 38538b5

File tree

3 files changed

+85
-141
lines changed

3 files changed

+85
-141
lines changed

CLAUDE.md

Lines changed: 2 additions & 119 deletions
Original file line numberDiff line numberDiff line change
@@ -1,121 +1,4 @@
11
# CLAUDE.md
2+
_Guidance for Claude Code (claude.ai/code) when working in this repository. If it's also useful to humans (probably most things!), put the instructions in README.md instead._
23

3-
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4-
5-
## Overview
6-
MCP Registry is a community-driven registry service for Model Context Protocol (MCP) servers. It provides a centralized repository for discovering and managing MCP implementations.
7-
8-
## Development Setup
9-
10-
### Prerequisites
11-
- **Go 1.23.x** - The project requires this specific version (check with `go version`)
12-
- Consider using a Go version manager like `g` or `gvm` if you work on multiple projects
13-
- **golangci-lint v2.3.1** - Install with:
14-
```bash
15-
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v2.3.1
16-
```
17-
18-
### Git Hooks (Optional)
19-
To run linting automatically before commits:
20-
```bash
21-
git config core.hooksPath .githooks
22-
```
23-
24-
## Common Development Commands
25-
26-
### Build
27-
```bash
28-
# Build the registry application
29-
go build ./cmd/registry
30-
31-
# Build with Docker
32-
docker build -t registry .
33-
34-
# Build the publisher tool
35-
cd tools/publisher && ./build.sh
36-
```
37-
38-
### Run
39-
```bash
40-
# Development with Docker Compose (recommended)
41-
docker compose up
42-
43-
# Direct execution
44-
go run cmd/registry/main.go
45-
```
46-
47-
### Test
48-
```bash
49-
# Unit tests
50-
go test -v -race -coverprofile=coverage.out -covermode=atomic ./internal/...
51-
52-
# Integration tests
53-
./tests/integration/run.sh
54-
55-
# Test API endpoints
56-
./scripts/test_endpoints.sh
57-
58-
# Test publish endpoint (requires GitHub token)
59-
export BEARER_TOKEN=your_github_token_here
60-
./scripts/test_publish.sh
61-
```
62-
63-
### Lint
64-
```bash
65-
# Run linting (same as CI)
66-
golangci-lint run --timeout=5m
67-
68-
# Check formatting
69-
gofmt -s -l .
70-
71-
# Fix formatting issues
72-
gofmt -s -w .
73-
```
74-
75-
**Note**: The project uses golangci-lint v2.3.1 with 62 enabled linters. Always run linting locally before pushing to avoid CI failures.
76-
77-
## Architecture Overview
78-
79-
The codebase follows a clean architecture pattern:
80-
81-
### Core Layers
82-
- **API Layer** (`internal/api/`) - HTTP handlers and routing
83-
- **Service Layer** (`internal/service/`) - Business logic implementation
84-
- **Database Layer** (`internal/database/`) - Data persistence abstraction with MongoDB and in-memory implementations
85-
- **Domain Models** (`internal/model/`) - Core data structures
86-
- **Authentication** (`internal/auth/`) - GitHub OAuth integration
87-
88-
### Request Flow
89-
1. HTTP requests enter through router (`internal/api/router/`)
90-
2. Handlers in `internal/api/handlers/v0/` validate and process requests
91-
3. Service layer executes business logic
92-
4. Database interface handles persistence
93-
5. JSON responses returned to clients
94-
95-
### Key Interfaces
96-
- **Database Interface** (`internal/database/database.go`) - Abstracts data persistence with MongoDB and memory implementations
97-
- **RegistryService** (`internal/service/service.go`) - Business logic abstraction over database
98-
- **Auth Service** (`internal/auth/auth.go`) - GitHub OAuth token validation
99-
100-
### Authentication Flow
101-
Publishing requires GitHub OAuth validation:
102-
1. Extract bearer token from Authorization header
103-
2. Validate token with GitHub API
104-
3. Verify repository ownership matches token owner
105-
4. Check organization membership if applicable
106-
107-
### Design Patterns
108-
- **Factory Pattern** for service creation with dependency injection
109-
- **Repository Pattern** for database abstraction
110-
- **Context Pattern** for timeout management (5-second DB operations)
111-
- **Cursor-based Pagination** using UUIDs for stateless pagination
112-
113-
## Environment Variables
114-
Key configuration for development:
115-
- `MCP_REGISTRY_DATABASE_URL` (default: `mongodb://localhost:27017`)
116-
- `MCP_REGISTRY_GITHUB_CLIENT_ID`
117-
- `MCP_REGISTRY_GITHUB_CLIENT_SECRET`
118-
- `MCP_REGISTRY_LOG_LEVEL` (default: `info`)
119-
- `MCP_REGISTRY_SERVER_ADDRESS` (default: `:8080`)
120-
- `MCP_REGISTRY_SEED_IMPORT` (default: `true`)
121-
- `MCP_REGISTRY_SEED_FILE_PATH` (default: `data/seed.json`)
4+
Import @README.md

CONTRIBUTING.md

Lines changed: 0 additions & 7 deletions
This file was deleted.

README.md

Lines changed: 83 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,15 @@ A community driven registry service for Model Context Protocol (MCP) servers.
44

55
## Development Status
66

7-
This project is being built in the open and is currently in the early stages of development. Please see the [overview discussion](https://github.com/modelcontextprotocol/registry/discussions/11) for the project scope and goals. If you would like to contribute, please check out the [contributing guidelines](CONTRIBUTING.md).
7+
This project is being built in the open and is currently in the early stages of development. Please see the [overview discussion](https://github.com/modelcontextprotocol/registry/discussions/11) for the project scope and goals.
8+
9+
### Contributing
10+
11+
Use [Discussions](https://github.com/modelcontextprotocol/registry/discussions) to propose and discuss product and/or technical **requirements**.
12+
13+
Use [Issues](https://github.com/modelcontextprotocol/registry/issues) to track **well-scoped technical work** that the community agrees should be done at some point.
14+
15+
Open [Pull Requests](https://github.com/modelcontextprotocol/registry/pulls) when you want to **contribute work towards an Issue**, or you feel confident that your contribution is desireable and small enough to forego community discussion at the requirements and planning levels.
816

917
## Overview
1018

@@ -55,8 +63,21 @@ go build ./cmd/registry
5563
```
5664
This will create the `registry` binary in the current directory. You'll need to have MongoDB running locally or with Docker.
5765

66+
You can also run the service directly:
67+
```bash
68+
# Direct execution
69+
go run cmd/registry/main.go
70+
```
71+
5872
By default, the service will run on `http://localhost:8080`.
5973

74+
There is also a CLI tool to publish MCP servers to the registry. You can build it with:
75+
76+
```bash
77+
# Build the publisher tool
78+
cd tools/publisher && ./build.sh
79+
```
80+
6081
## Development
6182

6283
### Linting
@@ -84,34 +105,61 @@ git config core.hooksPath .githooks
84105

85106
This will prevent commits that fail linting or have formatting issues.
86107

87-
## Project Structure
108+
### Project Structure
88109

89110
```
90111
├── api/ # OpenApi specification
91112
├── cmd/ # Application entry points
92113
├── config/ # Configuration files
93114
├── internal/ # Private application code
94-
│ ├── api/ # HTTP server and request handlers
115+
│ ├── api/ # HTTP server and request handlers (routing)
116+
│ ├── auth/ # GitHub OAuth integration
95117
│ ├── config/ # Configuration management
96-
│ ├── model/ # Data models
97-
│ └── service/ # Business logic
118+
│ ├── database/ # Data persistence abstraction (MongoDB and in-memory)
119+
│ ├── model/ # Data models and domain structures
120+
│ └── service/ # Business logic implementation
98121
├── pkg/ # Public libraries
99122
├── scripts/ # Utility scripts
100123
└── tools/ # Command line tools
101124
└── publisher/ # Tool to publish MCP servers to the registry
102125
```
103126

104-
## API Documentation
127+
### Architecture Overview
128+
129+
### Request Flow
130+
1. HTTP requests enter through router (`internal/api/router/`)
131+
2. Handlers in `internal/api/handlers/v0/` validate and process requests
132+
3. Service layer executes business logic
133+
4. Database interface handles persistence
134+
5. JSON responses returned to clients
135+
136+
### Key Interfaces
137+
- **Database Interface** (`internal/database/database.go`) - Abstracts data persistence with MongoDB and memory implementations
138+
- **RegistryService** (`internal/service/service.go`) - Business logic abstraction over database
139+
- **Auth Service** (`internal/auth/auth.go`) - GitHub OAuth token validation
140+
141+
### Authentication Flow
142+
Publishing requires GitHub OAuth validation:
143+
1. Extract bearer token from Authorization header
144+
2. Validate token with GitHub API
145+
3. Verify repository ownership matches token owner
146+
4. Check organization membership if applicable
147+
148+
### Design Patterns
149+
- **Factory Pattern** for service creation with dependency injection
150+
- **Repository Pattern** for database abstraction
151+
- **Context Pattern** for timeout management (5-second DB operations)
152+
- **Cursor-based Pagination** using UUIDs for stateless pagination
105153

106-
The API is documented using Swagger/OpenAPI. You can access the interactive Swagger UI at:
154+
## API Endpoints
155+
156+
### API Documentation
107157

108158
```
109-
/v0/swagger/index.html
159+
GET /v0/swagger/index.html
110160
```
111161

112-
This provides a complete reference of all endpoints with request/response schemas and allows you to test the API directly from your browser.
113-
114-
## API Endpoints
162+
The API is documented using Swagger/OpenAPI. This page provides a complete reference of all endpoints with request/response schemas and allows you to test the API directly from your browser.
115163

116164
### Health Check
117165

@@ -333,6 +381,22 @@ The service can be configured using environment variables:
333381

334382
## Testing
335383

384+
### Unit Tests
385+
386+
```bash
387+
# Run unit tests
388+
go test -v -race -coverprofile=coverage.out -covermode=atomic ./internal/...
389+
```
390+
391+
### Integration Tests
392+
393+
```bash
394+
# Run integration tests
395+
./tests/integration/run.sh
396+
```
397+
398+
### API Endpoint Tests
399+
336400
Run the test script to validate API endpoints:
337401

338402
```bash
@@ -346,10 +410,14 @@ You can specify specific endpoints to test:
346410
./scripts/test_endpoints.sh --endpoint servers
347411
```
348412

349-
## License
413+
### Publish Endpoint Test
350414

351-
See the [LICENSE](LICENSE) file for details.
415+
```bash
416+
# Test publish endpoint (requires GitHub token)
417+
export BEARER_TOKEN=your_github_token_here
418+
./scripts/test_publish.sh
419+
```
352420

353-
## Contributing
421+
## License
354422

355-
See the [CONTRIBUTING](CONTRIBUTING.md) file for details.
423+
See the [LICENSE](LICENSE) file for details.

0 commit comments

Comments
 (0)