> ## Documentation Index
> Fetch the complete documentation index at: https://docs.leanmcp.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Deploy on Vercel

> Deploy simple MCPs on Vercel with important caveats

Vercel is a great platform for frontend applications and simple APIs. You can deploy MCPs on Vercel, but there are important limitations to understand.

The LeanMCP SDK does not block you from deploying to Vercel or any other platform. However, Vercel's architecture introduces constraints that may not work for all MCPs.

***

## When Vercel Works Well

Vercel is a good choice if:

* Your MCP is **simple** — basic API wrappers, quick tool calls
* You're building an **agent frontend** and the MCP is just one part of your application
* Your tool calls complete in **under 30 seconds** (or under 5 seconds on Edge)
* You don't have **long-running network requests** or complex orchestration

***

## When Vercel Doesn't Work

Vercel runs on AWS Lambda under the hood. This means you inherit Lambda's limitations:

### Timeout Limits

| Vercel Runtime       | Timeout                 |
| -------------------- | ----------------------- |
| Edge Functions       | 5 seconds               |
| Serverless Functions | 30 seconds (Pro plan)   |
| Serverless Functions | 10 seconds (Hobby plan) |

If your MCP does sophisticated things — like summarizing API responses to reduce tokens, orchestrating multiple backend calls, or processing large datasets — you'll hit these timeouts.

### Cold Starts

Lambda functions have cold starts. The first request after a period of inactivity takes longer. For MCPs that need consistent low latency, this can be problematic.

### No Built-in MCP Features

Vercel doesn't have an MCP SDK. You need to:

* Build your own HTTP transport layer
* Handle authentication yourself
* Set up your own monitoring and logging
* Manage observability separately

***

## Deploying to Vercel

If your use case fits, here's how to deploy:

### Step 1: Create API Route

```typescript theme={null}
// app/api/mcp/route.ts
import { LeanMCP } from '@leanmcp/sdk';

const mcp = new LeanMCP({
  name: 'my-vercel-mcp',
  version: '1.0.0'
});

mcp.addTool({
  name: 'quick_lookup',
  description: 'Look up data quickly',
  inputSchema: {
    type: 'object',
    properties: {
      query: { type: 'string' }
    }
  },
  handler: async (args) => {
    // Keep this fast - under 30 seconds!
    const result = await quickLookup(args.query);
    return result;
  }
});

export async function POST(request: Request) {
  return mcp.handleRequest(request);
}
```

### Step 2: Configure Vercel

```json theme={null}
// vercel.json
{
  "functions": {
    "app/api/mcp/route.ts": {
      "maxDuration": 30
    }
  }
}
```

### Step 3: Deploy

```bash theme={null}
vercel deploy --prod
```

Or connect your GitHub repository for automatic deployments.

***

## Adding Monitoring

Vercel doesn't include MCP-specific monitoring. You'll need to add your own:

```typescript theme={null}
// Add logging manually
mcp.addTool({
  name: 'my_tool',
  handler: async (args) => {
    const start = Date.now();
    try {
      const result = await doSomething(args);
      console.log(`Tool completed in ${Date.now() - start}ms`);
      return result;
    } catch (error) {
      console.error(`Tool failed: ${error.message}`);
      throw error;
    }
  }
});
```

Consider integrating with external monitoring services like Datadog, New Relic, or Sentry.

***

## Comparison: Vercel vs LeanMCP Platform

| Feature         | Vercel                 | LeanMCP Platform |
| --------------- | ---------------------- | ---------------- |
| **Timeout**     | 5-30 seconds           | No limit         |
| **MCP SDK**     | DIY                    | Built-in         |
| **Monitoring**  | External services      | Built-in         |
| **Auth**        | DIY                    | One-click setup  |
| **Cold starts** | Yes                    | Optimized        |
| **Best for**    | Simple MCPs, frontends | Production MCPs  |

***

## Recommendation

If you're building an agent application where the frontend is on Vercel and the MCP is a small part — Vercel works fine.

If you're building production MCPs with complex tool calls, long-running operations, or need monitoring and auth — use [LeanMCP Platform](/deploy/leanmcp-platform) instead.

<CardGroup cols={2}>
  <Card title="LeanMCP Platform" icon="rocket" href="/deploy/leanmcp-platform">
    No timeout limits, built-in monitoring
  </Card>

  <Card title="Cloud Providers" icon="cloud" href="/deploy/cloud-providers">
    AWS, GCP, Azure deployment
  </Card>
</CardGroup>
