MCP System Overview
Authentication
All endpoints require a valid Bearer token in the Authorization header and appropriate RBAC permissions. Required Permissions:mcp:read- Read MCP servers and instancesmcp:write- Connect accounts and manage instances
Base URL
MCP Server Discovery
List All MCP Servers
Retrieve all available MCP servers in the platform.GET /api/mcp/list_servers
Response Fields:
Get Server with Tools
Retrieve detailed information about an MCP server including all available tools.GET /api/mcp/server_with_tools
Query Parameters:
Connection Management
Connect Account (Start OAuth)
Initiate OAuth flow to connect an MCP server to the user’s account.POST /api/mcp/connect_account
Request Body:
Response Fields:
Flow:
- Call this endpoint with server_id
- Redirect user to
redirect_url - User completes OAuth on external service
- External service redirects back to callback
- System automatically creates MCP instance
- User redirected to frontend with success
OAuth Callback Handler
Internal endpoint that handles OAuth callbacks from external services. Endpoint:GET /api/mcp/callback
Query Parameters:
Behavior:
- Validates OAuth callback
- Updates session status to “active”
- Auto-creates MCP instance via Composio
- Redirects to frontend with parameters
Note: This endpoint is called by OAuth providers, not by clients directly
Note: This endpoint is called by OAuth providers, not by clients directly
The callback endpoint is configured in the OAuth application settings and is automatically invoked by the external service after user authorization. Clients should not call this endpoint directly.
Generate MCP URL
Generate the MCP connection URL for an active session.POST /api/mcp/generate_url
Request Body:
Response:
Usage:
The generated URL is used internally by the MCP Playground to establish connections with MCP servers.
Instance Management
List User Instances
Retrieve all MCP instances (connections) for the authenticated user’s organization.GET /api/mcp/list_instances
Query Parameters:
Response:
Array of MCP instance objects with fields:
Update Instance
Update the custom name of an MCP instance.PUT /api/mcp/instance
Query Parameters:
Request Body:
Delete Instance
Delete an MCP instance and disconnect from the external service.DELETE /api/mcp/instance
Query Parameters:
Behavior:
- Deletes MCP instance from Composio (if active)
- Removes session record from database
- Revokes OAuth access tokens
- Cannot be undone
Error Responses
Error Response Format:
Implementation Notes
OAuth Flow
Complete OAuth flow implementation:Session Management
Best practices for managing MCP sessions:Feature Flags
MCP functionality is controlled by feature flags:mcp_sessions: Quota for number of MCP connections- Checked on
POST /connect_account - Returns 402 Payment Required if quota exceeded
Composio Integration
The service integrates with Composio for:-
OAuth Management:
- Creating connected accounts
- Generating redirect URLs
- Handling callbacks
-
Instance Management:
- Creating MCP instances
- Generating MCP URLs
- Deleting instances
-
Authentication:
- Token management
- Automatic token refresh
- Secure credential storage
Rate Limiting
Rate limits may apply based on:- Feature flag quotas (
mcp_sessions) - Composio API limits
- External service OAuth limits
Security Considerations
OAuth Security
- OAuth tokens never exposed to client
- Tokens stored securely in Composio
- Automatic token refresh
- Callback URL validation
Access Control
- All endpoints require authentication
- RBAC permissions enforced
- Org-scoped operations
- User isolation
Data Privacy
- No MCP data stored permanently
- OAuth scopes request minimal permissions
- Users can revoke access anytime
- Audit trail for connections
Next Steps
Explore MCP integration further:- MCP Playground Service - Chat with MCP tools
- MCP Concepts - Understanding MCP architecture
- Authentication Guide - Security and RBAC
- Getting Started - Quick start guide