remote-capable server
The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.
Integrations
Supports serverless deployment to AWS Lambda with state persistence across function invocations.
Supports deployment as a scalable application with multiple replicas for high availability and load balancing.
Enables authorized access to Notion databases and pages with capabilities for searching, reading, writing, and deleting content with granular permission scopes.
MCPToolKit - Production-Ready MCP Server Framework
The Problems We Solve
1. Scaling MCP Servers in Production
The standard FastMCP framework faces significant challenges in production environments:
- State Management: Traditional FastMCP servers maintain state in memory, making horizontal scaling difficult
- Serverless Limitations: Serverless environments require stateless architectures, which FastMCP wasn't designed for
- Multi-tenant Support: Running multiple tenants on the same server requires complex session management
2. Delegated OAuth Support
Managing authentication for MCP servers is complex:
- Tool-Level Auth: Users should only authenticate when a tool requires it
- Third-Party Integration: Supporting OAuth for services like Notion, Slack, etc. requires complex token management
- Security: Managing multiple authentication flows while maintaining security is challenging
Our Solution
MCPToolKit provides a production-ready framework that solves these problems while maintaining full compatibility with FastMCP. Here's how it works:
This architecture diagram illustrates how MCPToolKit enables production-ready MCP servers:
- LLM Clients (e.g., Claude, ChatGPT, Cursor) initiate requests to the MCP server. These clients can be any application that needs to interact with MCP tools.
- Load Balancer distributes incoming requests across multiple MCP server instances, enabling horizontal scaling and high availability.
- MCP Server Instances (1 through N) handle tool execution and resource access. Each instance:
- Maintains its own Redis state for session persistence
- Can handle requests independently
- Shares the same codebase and configuration
- Can be scaled horizontally based on demand
- Redis serves as the central state store, providing:
- Session state persistence across server restarts
- OAuth token storage and management
- Shared state between server instances
- Enables stateless server instances
- MCP Authorization Server (highlighted in pink) manages all OAuth-related operations:
- Implements OAuth 2.1 with PKCE for secure authentication
- Handles token issuance and refresh
- Manages consent flows
- Centralizes OAuth logic for all server instances
- OAuth Providers (e.g., Notion, Slack) are the third-party services that users can authenticate with. The authorization server manages these connections securely.
This architecture enables:
- True horizontal scaling through stateless server instances
- Centralized OAuth management
- High availability through multiple server instances
- Secure token management
- Consistent user experience across sessions
Migration from FastMCP
Migrating from FastMCP to MCPToolKit is straightforward. Here's how to update your existing FastMCP server:
The migration requires just a few simple changes:
- Change the import statement
- Set the
REDIS_URL
environment variable (required for production) - That's it! All your existing tools, resources, and prompts continue to work exactly as before
For local development, you can set the environment variable:
For serverless deployments, you'll also need to update your deployment configuration:
Key Features:
- Redis-Backed State: Session state persists across server restarts and function invocations
- Serverless Ready: Designed for Vercel, AWS Lambda, and other serverless platforms
- Horizontal Scaling: State persistence enables true horizontal scaling
- Multi-tenant Support: Multiple users can connect to the same endpoint with isolated sessions
2. Delegated OAuth Support
Key Features:
- Lazy Authentication: Users only authenticate when a tool requires it
- Provider Support: Built-in support for common providers (Notion, Slack, etc.)
- Token Management: Automatic token refresh and storage
- Security: Secure token storage and transmission
- Granular Scopes: Fine-grained control over OAuth permissions
- Consent Management: User-friendly consent screens with logical permission groupings
- Human-in-the-Loop: Optional approval requirements for high-risk actions
OAuth Flow
MCPToolKit implements a secure OAuth 2.1 flow with PKCE:
- LLM Client initiates a request to an MCP server
- Server responds with a 401 Unauthorized and redirect link
- User logs in to the OAuth provider and grants requested scopes
- Server returns an auth code to the client
- Client exchanges the code for access + refresh tokens
- Tokens are used for subsequent requests
- MCP server calls the third-party service
Authorization Server Architecture
MCPToolKit supports two deployment models for the authorization server:
- Embedded Authorization Server
- MCP server acts as both Identity Provider and Relying Party
- Handles login, consent, and token issuance directly
- Manages token lifetimes, refresh logic, and revocation
- Best for standalone applications
- External Authorization Server
- MCP server acts as a Relying Party
- Delegates OAuth flow to external services (e.g., Stytch)
- Focuses on tool-level access control
- Best for integrating with existing identity infrastructure
Both models support:
- OAuth 2.1 with PKCE
- Dynamic Client Registration
- Authorization Server Metadata (RFC 8414)
- Custom scopes based on Resources/Actions
- End user consent management
- Granular scope definitions per provider
- Organization-level visibility and control
- Implied permissions (users can only grant permissions they have)
Consent and Access Management
MCPToolKit provides comprehensive consent and access management:
- Organization-Level Visibility: View all connected apps authorized across your organization
- Granular Permissions: See which members have granted access and which scopes they've authorized
- Access Management: Revoke access for specific users or apps at any time
- User-Friendly Consent: Present RBAC permissions in logical groupings
- Implied Permissions: Users can only give an app the same permissions they have
- Human-in-the-Loop: Require human approval for high-risk actions
High-Risk Action Protection
Architecture
Deployment Options
Kubernetes
Serverless (Vercel)
Quick Start
- Install MCPToolKit:
- Create your server:
- Deploy to your preferred platform (Kubernetes, Vercel, etc.)
Requirements
- Python 3.9+
- Redis instance (for session state persistence)
- OAuth provider credentials (if using delegated auth)
License
Same as the MCP Python SDK.
This server cannot be installed
A serverless, multi-tenant implementation of MCP servers that runs on Vercel with fluid compute mode, allowing multiple users to connect to the same endpoint while maintaining session state through Redis.