DEV Community

Andrew Lee
Andrew Lee

Posted on

6

Deploy MCP to Vercel and use it with Cursor

1. Deploy to Vercel using template

Navigate to https://vercel.com/templates/next.js/model-context-protocol-mcp-with-next-js and click on Deploy.

Click Deploy

2. Set up Upstash for Redis

Go to the Storage tab and add Upstash for Redis.

Add Upstash for Redis

Afterwards go to Settings and verify that environment variables are properly populated.

Environment Variables

3. Clone your repo and deploy

Clone the repo created in Step 1 and add app/layout.tsx and app/page.tsx. Committing and pushing will trigger a deploy.

// app/layout.tsx
export const metadata = {
  title: 'Remote MCP',
  description: 'Remote MCP on Vercel tutorial',
}

export default function RootLayout({
  children,
}: {
  children: React.ReactNode
}) {
  return (
    <html lang="en">
      <body>{children}</body>
    </html>
  )
} 
Enter fullscreen mode Exit fullscreen mode
// app/page.tsx
export default function HomePage() {
  return (
    <h1>Remote MCP</h1>
  );
} 
Enter fullscreen mode Exit fullscreen mode

4. Connect to your Remote MCP using Cursor

Add the following to your mcp.json after going to Settings -> MCP -> Add new global MCP server.

{
  "mcpServers": {
    // ...
    "Remote MCP Demo": {
      "command": "npx",
      "args": [
        "mcp-remote",
        "https://your-vercel-name.vercel.app/sse"
      ]
    }
  }
}
Enter fullscreen mode Exit fullscreen mode

5. Trigger your remote MCP

Trigger remote MCP

If you want to add a custom domain to this MCP, you can follow this tutorial: https://dev.to/andyrewlee/how-to-add-custom-domain-to-vercel-using-namecheap-dp8.

Tiugo image

Fast, Lean, and Fully Extensible

CKEditor 5 is built for developers who value flexibility and speed. Pick the features that matter, drop the ones that don’t and enjoy a high-performance WYSIWYG that fits into your workflow

Start now

Top comments (0)

Dev Diairies image

User Feedback & The Pivot That Saved The Project

🔥 Check out Episode 3 of Dev Diairies, following a successful Hackathon project turned startup.

Watch full video 🎥

👋 Kindness is contagious

Dive into this thoughtful piece, beloved in the supportive DEV Community. Coders of every background are invited to share and elevate our collective know-how.

A sincere "thank you" can brighten someone's day—leave your appreciation below!

On DEV, sharing knowledge smooths our journey and tightens our community bonds. Enjoyed this? A quick thank you to the author is hugely appreciated.

Okay