Community-driven API registry for the Open Context Protocol. Browse APIs at opencontextprotocol.io/registry or access programmatically via the API at opencontextprotocol.io/api/v1.
Dual Deployment Model:
- Frontend: Static content generated and integrated into ocp-spec Hugo site
- Backend: FastAPI service providing registry data and search
- Data Source: YAML files in
data/as single source of truth - Deployment: Automated via GitHub Actions → GHCR → VPS
ocp-registry/
├── data/ # Source of truth
│ ├── apis/
│ │ ├── github/
│ │ │ ├── meta.yaml
│ │ │ └── tools.json (generated)
│ │ └── stripe/
│ │ ├── meta.yaml
│ │ └── tools.json (generated)
│ └── categories.yaml
├── scripts/ # Build tools
│ ├── generate-tools.py # Fetch OpenAPI specs → tools.json
│ └── build-database.py # YAML + tools.json → SQLite
├── src/
│ └── ocp_registry/ # FastAPI service
│ ├── main.py
│ ├── models.py
│ ├── database.py
│ └── service.py
└── tests/ # API tests
from ocp_agent import OCPAgent
# Libraries use https://opencontextprotocol.io/api/v1
agent = OCPAgent(registry_url='https://opencontextprotocol.io/api/v1')
api = await agent.register_api('github')import { OCPAgent } from '@opencontextprotocol/agent';
const agent = new OCPAgent(
'my-agent',
'user',
'workspace',
'description',
'https://opencontextprotocol.io/api/v1'
);# Clone and setup
git clone https://github.com/opencontextprotocol/ocp-registry.git
cd ocp-registry
poetry install
# Generate tools from OpenAPI specs
poetry run python scripts/generate-tools.py
# Build database
poetry run python scripts/build-database.py
# Run API service
poetry run uvicorn src.ocp_registry.main:app --reload
# API available at http://localhost:8000All endpoints are prefixed with /api/v1:
GET /api/v1/registry # List all APIs
GET /api/v1/registry/{name} # Get specific API with tools
GET /api/v1/search?q={query} # Search APIs by name/description
GET /api/v1/stats # Registry statistics
POST /api/v1/registry # Register new API (validation)
-
Fork this repository
-
Create API metadata:
mkdir data/apis/my-api cat > data/apis/my-api/meta.yaml << EOF name: my-api display_name: My Amazing API description: What your API does openapi_url: https://api.example.com/openapi.json base_url: https://api.example.com category: development tags: [example, demo] status: active EOF
-
Test locally:
poetry run python scripts/generate-tools.py my-api poetry run python scripts/build-database.py
-
Submit PR - CI will validate, generate tools, and deploy automatically
Fetches OpenAPI specs and generates tools.json for each API:
poetry run python scripts/generate-tools.py # Process all APIs
poetry run python scripts/generate-tools.py github # Process specific APINote: tools.json files are committed to the repository. Run this script when adding new APIs or updating existing ones.
Builds SQLite database from YAML metadata and generated tools:
poetry run python scripts/build-database.py # Creates registry.db
poetry run python scripts/build-database.py /path/db # Custom database pathPush to main branch triggers:
- GitHub Actions builds Docker image
- Image pushed to
ghcr.io/opencontextprotocol/ocp-registry:latest - Triggers deployment on VPS via ocp-server
- Services restart with latest image
# Build image
docker build -t ocp-registry .
# Run container
docker run -p 8000:8000 ocp-registry
# Test API
curl http://localhost:8000/api/v1/registry# Build database from sources
poetry run python scripts/build-database.py
# Run API service
poetry run uvicorn src.ocp_registry.main:app --host 0.0.0.0 --port 8000# Run all tests
poetry run pytest
# Run with coverage
poetry run pytest --cov=src/ocp_registry
# Test specific API endpoint
curl "https://opencontextprotocol.io/api/v1/search?q=github"
curl "https://opencontextprotocol.io/api/v1/registry/github"# Format code
poetry run black src/ scripts/
poetry run isort src/ scripts/
# Type checking
poetry run mypy src/
# Linting
poetry run ruff check src/ scripts/