Skip to main content

Introduction

The Secure MCP Gateway provides a comprehensive REST API that exposes all CLI functionality through HTTP endpoints. This allows you to programmatically manage configurations, projects, users, and system operations.

Getting Started

Starting the API Server

Start the REST API server using the CLI:

API Documentation

Once the server is running, you can access:
  • Interactive API Documentation: http://localhost:8001/docs
  • ReDoc Documentation: http://localhost:8001/redoc
  • OpenAPI Schema: http://localhost:8001/openapi.json

Base URL

All API endpoints are prefixed with:

API Architecture

Framework

The API is built using FastAPI, providing:
  • Automatic request validation
  • OpenAPI/Swagger documentation
  • High performance with async support
  • Type safety with Pydantic models

Transport

  • Protocol: HTTP/HTTPS
  • Port: 8001 (default)
  • CORS: Enabled for all origins
  • Content-Type: application/json

Authentication

All API endpoints (except /health) require authentication using an admin API key.

Admin API Key

The admin API key is automatically generated when you initialize the gateway configuration. It can be found in your configuration file:

Authorization Header

Include the admin API key in the Authorization header with Bearer token format:

Example Request

Response Format

All API responses follow a consistent structure.

Success Response

string
required
Human-readable success message
object
Response payload (varies by endpoint)
string
required
ISO 8601 timestamp of the response

Error Response

string
required
Error category or type
string
Detailed error description
string
required
ISO 8601 timestamp of the error

HTTP Status Codes

The API uses standard HTTP status codes:

Rate Limiting

Currently, the API does not enforce rate limiting. For production deployments, consider implementing rate limiting at the infrastructure level (e.g., using a reverse proxy like NGINX).

Health Check

The health check endpoint does not require authentication:
Response:

API Sections

The REST API is organized into the following sections:

Configuration Management

Manage MCP configurations and servers

Project Management

Create and manage projects

User Management

Manage users and their associations

API Key Management

Generate and manage user API keys

System Operations

System health, backup, and restore operations

Quick Start Example

Here’s a complete workflow to set up a project with a user and API key:

Client Libraries

While official SDKs are not yet available, you can easily integrate with the API using standard HTTP clients:

Python Example

JavaScript/Node.js Example

Next Steps

Authentication

Learn about API authentication and security

Configuration Endpoints

Explore configuration management endpoints

Project Endpoints

Manage projects via API

User Endpoints

User and access management