Overview

The MCP Server with LangGraph exposes RESTful API endpoints for identity management, authentication, and user provisioning. All endpoints require authentication and follow RESTful conventions.

Service Principals

Machine-to-machine authentication for automated workflows

API Keys

Long-lived authentication for CLI tools and legacy integrations

SCIM 2.0

Automated user provisioning from identity providers

Service Principals API

Service principals enable machine-to-machine authentication for batch jobs, streaming tasks, and background processes.

Base Path

Authentication

All endpoints require Bearer token authentication:

Create Service Principal

Creates a new service principal for machine-to-machine authentication.
Endpoint: POST /api/v1/service-principalsHeaders:
Body:
Parameters:
  • name (required): Human-readable name for the service principal
  • description (optional): Description of purpose
  • authentication_mode (required): client_credentials or service_account
  • associated_user_id (optional): User ID to inherit permissions from
  • inherit_permissions (optional): Enable permission inheritance (default: false)
  • refresh_token_lifespan (optional): Refresh token lifetime in seconds (default: 2592000 = 30 days)

List Service Principals

Retrieves all service principals for the authenticated user.
Endpoint: GET /api/v1/service-principalsHeaders:
Query Parameters:
  • page (optional): Page number (default: 1)
  • page_size (optional): Items per page (default: 20, max: 100)
  • authentication_mode (optional): Filter by mode (client_credentials or service_account)

Get Service Principal

Retrieves details of a specific service principal.
Endpoint: GET /api/v1/service-principals/{service_id}Headers:
Path Parameters:
  • service_id: Service principal ID

Delete Service Principal

Deletes a service principal and revokes all its credentials.
Endpoint: DELETE /api/v1/service-principals/{service_id}Headers:
Path Parameters:
  • service_id: Service principal ID to delete

Rotate Secret

Rotates the client secret for a service principal.
Endpoint: POST /api/v1/service-principals/{service_id}/rotate-secretHeaders:
Body:
Parameters:
  • grace_period_hours (optional): Hours to keep old secret valid (default: 24)

API Keys API

API keys provide simple, long-lived authentication for CLI tools, webhooks, and legacy integrations.

Base Path

Authentication

All endpoints require Bearer token authentication:

Create API Key

Creates a new API key for the authenticated user.
Endpoint: POST /api/v1/api-keysHeaders:
Body:
Parameters:
  • name (required): Descriptive name for the API key
  • expires_days (optional): Days until expiration (default: 365, max: 730)

List API Keys

Retrieves all API keys for the authenticated user.
Endpoint: GET /api/v1/api-keysHeaders:
Query Parameters:
  • include_expired (optional): Include expired keys (default: false)

Revoke API Key

Revokes an API key, making it invalid immediately.
Endpoint: DELETE /api/v1/api-keys/{key_id}Headers:
Path Parameters:
  • key_id: API key ID to revoke

Using API Keys

API keys are used in the apikey header:
Key Format:
  • Prefix: mcpkey_
  • Environment: live_ (production) or test_ (development)
  • Token: 48-character random string (base62)
Internally: The API key is exchanged for a JWT token via Kong Gateway’s custom plugin, then validated like any other JWT.

SCIM 2.0 API

SCIM (System for Cross-domain Identity Management) enables automated user provisioning from identity providers.

Base Path

Authentication

SCIM endpoints support two authentication methods: Option 1: Bearer Token (Recommended)
Option 2: OAuth 2.0 Client Credentials
(obtained via service principal client credentials flow)

Supported Schemas

  • urn:ietf:params:scim:schemas:core:2.0:User
  • urn:ietf:params:scim:schemas:core:2.0:Group
  • urn:ietf:params:scim:api:messages:2.0:ListResponse
  • urn:ietf:params:scim:api:messages:2.0:PatchOp

User Endpoints

Endpoint: POST /scim/v2/UsersRequest:
Response: 201 Created
Endpoint: GET /scim/v2/Users/{id}Response: 200 OK
Endpoint: PUT /scim/v2/Users/{id}Request:
Response: 200 OK (updated user object)
Endpoint: PATCH /scim/v2/Users/{id}Request:
Supported Operations:
  • add: Add attribute value
  • replace: Replace attribute value
  • remove: Remove attribute
Response: 200 OK (updated user object)
Endpoint: DELETE /scim/v2/Users/{id}Response: 204 No Content
This sets active: false on the user but doesn’t delete the account. The user can be reactivated via PATCH.
Endpoint: GET /scim/v2/Users?filter={filter}Query Parameters:
  • filter: SCIM filter expression
  • startIndex: Pagination start (default: 1)
  • count: Results per page (default: 20)
Example Filter:
Response: 200 OK
Supported Filter Operators:
  • eq: Equal
  • ne: Not equal
  • co: Contains
  • sw: Starts with
  • ew: Ends with
  • pr: Present (attribute exists)

Group Endpoints

Endpoint: POST /scim/v2/GroupsRequest:
Response: 201 Created
Endpoint: GET /scim/v2/Groups/{id}Response: 200 OK
Endpoint: PATCH /scim/v2/Groups/{id}Request:
Response: 200 OK

Bulk Operations

Endpoint: POST /scim/v2/Bulk Create, update, or delete multiple resources in a single request.
Response: 200 OK

Error Responses

All SCIM endpoints return errors in SCIM format:
SCIM Error Types:
  • invalidValue: Invalid attribute value
  • tooMany: Too many results
  • uniqueness: Uniqueness constraint violated
  • mutability: Immutable attribute modification attempted
  • invalidSyntax: Invalid filter syntax
  • invalidFilter: Invalid filter
  • invalidPath: Invalid path expression

Rate Limiting

All API endpoints are rate-limited to prevent abuse: Rate Limit Headers:
Rate Limit Exceeded Response:

Error Handling

Common HTTP Status Codes

Error Response Format


Best Practices

Secure Credentials

  • Store API keys and client secrets in secrets managers
  • Never commit credentials to version control
  • Rotate credentials regularly (90 days recommended)
  • Use different credentials per environment

Error Handling

  • Implement exponential backoff for retries
  • Handle rate limiting gracefully
  • Log request IDs for debugging
  • Validate responses before processing

Performance

  • Cache JWT tokens until expiration
  • Use bulk SCIM operations for multiple users
  • Implement request pooling/batching
  • Monitor rate limit headers

Security

  • Use HTTPS for all API calls
  • Validate SSL certificates in production
  • Implement request signing for SCIM (optional)
  • Monitor for unusual API usage patterns

See Also