Overview
| Mode | Use Case | Transport | Entry Point |
|---|---|---|---|
| SDK Mode | Embed in agent code | In-process | connect(), connectOpenAI(), etc. |
| Server Mode | Standalone HTTP server | HTTP (SSE, Streamable) | @FrontMcp with http.port |
| Handler Mode | Serverless functions | HTTP (stateless) | createHandler() or FRONTMCP_SERVERLESS=1 |
SDK Mode (Embedded)
Use SDK mode when your agent code directly calls FrontMCP tools without HTTP. This is ideal for:- LangChain, Vercel AI, or OpenAI SDK integrations
- In-process agent frameworks
- Testing and local development
Entry Points
| Function | Platform | Tool Format |
|---|---|---|
connect() | Auto-detect | Based on clientInfo |
connectOpenAI() | OpenAI | [{ type: 'function', function: { name, parameters } }] |
connectClaude() | Anthropic | [{ name, input_schema }] |
connectLangChain() | LangChain | [{ name, schema }] |
connectVercelAI() | Vercel AI | { [name]: { parameters } } |
Benefits
- Zero network overhead — tools execute in-process
- Automatic format conversion — tools are formatted for your LLM platform
- Simple auth injection — pass JWT tokens directly via
authTokenoption - Singleton scope — config objects are cached for efficient reuse
Example: OpenAI Integration
Example: Vercel AI SDK
Example: Anthropic Claude
Server Mode (HTTP)
Use Server mode when you need a standalone MCP server that clients connect to over HTTP. This is ideal for:- Claude Desktop and other MCP clients
- Shared server for multiple clients
- Production deployments with persistent connections
Configuration
Transport Protocols
Server mode supports multiple transport protocols:| Protocol | Description | Use Case |
|---|---|---|
legacy | SSE + Streamable + Legacy SSE | Maximum compatibility (default) |
modern | SSE + Streamable HTTP | Newer MCP clients |
stateless-api | No sessions, request/response | Simple API access |
full | All protocols enabled | Maximum flexibility |
Session Storage
For production, configure Redis for session persistence:Running the Server
Handler Mode (Serverless)
Use Handler mode when deploying to serverless platforms like Vercel, AWS Lambda, or Cloudflare Workers. This mode:- Does not start an HTTP server
- Exports a request handler for the platform
- Requires distributed storage (Redis, Vercel KV)
Configuration
Handler mode is triggered by settingFRONTMCP_SERVERLESS=1 in your entry point wrapper:
Quick Start
- Vercel
- AWS Lambda
- Cloudflare
Storage Requirements
- Vercel KV
- Upstash
- Redis
Comparison Table
| Feature | SDK Mode | Server Mode | Handler Mode |
|---|---|---|---|
| Network | In-process | HTTP | HTTP (stateless) |
| Use Case | Embedded agents | Standalone server | Serverless platforms |
| Session | In-memory | Configurable | Distributed required |
| Entry Point | connect() | @FrontMcp | createHandler() |
| Scaling | Single process | Horizontal | Auto-scaling |
| Auth | Token injection | OAuth/JWT | OAuth/JWT |
| Cold Start | None | None | Platform-dependent |
Decision Guide
When to use SDK Mode
When to use SDK Mode
Choose SDK mode when:
- Your agent code calls FrontMCP tools directly
- You’re using LangChain, Vercel AI SDK, or OpenAI SDK
- You want zero network overhead
- You need automatic tool format conversion
- You’re building an in-process agent
- External clients need to connect to your server
- You need Claude Desktop compatibility
When to use Server Mode
When to use Server Mode
Choose Server mode when:
- MCP clients connect over the network (Claude Desktop, etc.)
- You need SSE or Streamable HTTP transport
- You want a long-running server process
- Multiple clients share the same server
- You’re deploying to serverless platforms
- Your agent code runs in the same process
When to use Handler Mode
When to use Handler Mode
Choose Handler mode when:
- Deploying to Vercel, AWS Lambda, or Cloudflare Workers
- You want auto-scaling without managing servers
- You need serverless cost efficiency
- You need persistent WebSocket connections
- Cold start latency is unacceptable
- In-memory session state is required
Related Documentation
Local Dev Server
Run and test your FrontMCP server locally
Production Build
Build and optimize for production deployment
Serverless Deployment
Detailed guide for Vercel, Lambda, and Cloudflare
Redis Setup
Configure Redis for session persistence