---
title: "Bringing MCP to the Cloud"
description: "Neon moved its MCP server from a locally spawned stdio process authenticated by a long-lived API key to a hosted server at mcp.neon.tech, using SSE for server-to-client messages and HTTP POST to a /messages endpoint routed by an in-memory session map."
url: "https://swe.quest/articles/bringing-mcp-to-the-cloud-de1944b558e43ff0"
canonical: "https://neon.com/blog/bringing-mcp-to-the-cloud"
source: "Neon"
published: "2025-04-11"
difficulty: "medium"
kind: "Case study"
reading_minutes: 8
tags: ["ai-agents","identity-auth","api-design","javascript"]
---

# Bringing MCP to the Cloud

A post on [Neon](https://swe.quest/sources/neon.md), published 2025-04-11, 8 min read, Case study. Original: [https://neon.com/blog/bringing-mcp-to-the-cloud](https://neon.com/blog/bringing-mcp-to-the-cloud)

## Summary

Neon moved its MCP server from a locally spawned stdio process authenticated by a long-lived API key to a hosted server at mcp.neon.tech, using SSE for server-to-client messages and HTTP POST to a /messages endpoint routed by an in-memory session map. Authentication uses OAuth 2.1: the MCP server acts as an OAuth server to MCP clients, with dynamic client registration, PKCE and refresh tokens, and as an OAuth client to Neon upstream. Each session gets its own MCP server instance scoped to the user's Neon token. The server runs as a Docker image on Fly. Open issues include the Node.js dependency introduced by mcp-remote and clients restarting the OAuth flow instead of using refresh tokens.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [AI agents](https://swe.quest/tags/ai-agents.md) (AI & ML)
- [Identity & auth](https://swe.quest/tags/identity-auth.md) (Security)
- [API design](https://swe.quest/tags/api-design.md) (Backend & APIs)
- [JavaScript](https://swe.quest/tags/javascript.md) (Languages)

## Prerequisites

- OAuth 2.0 authorization code flow ([easy posts on Identity & auth](https://swe.quest/tags/identity-auth.md?difficulty=easy))
- Server-Sent Events
- Express.js

## Keywords

Model Context Protocol, Neon, Server-Sent Events, OAuth 2.1, mcp-remote, PKCE, Fly.io, Express.js

## Related posts

- [Every app needs an MCP server, and you can build it with Neon](https://swe.quest/articles/every-app-needs-an-mcp-server-and-you-can-build-it-with-neon-1a5ce4eab0583eca.md): Neon · 2026-11-25 · Easy · 11 min read · AI agents, Identity & auth, Serverless, PostgreSQL
  An MCP server lets users drive an app from AI assistants like ChatGPT, Claude and Cursor through tools the app defines, which keeps authorization and validation in app code instead of exposing the UI or raw database access.
- [Solving the MCP Authentication Headache with Vercel & Better Auth](https://swe.quest/articles/solving-the-mcp-authentication-headache-with-vercel-better-auth-749640ed1439e99c.md): Neon · 2025-05-23 · Medium · 5 min read · Identity & auth, AI agents, TypeScript
  Remote MCP servers can authenticate users with OAuth instead of plaintext bearer tokens or UUIDs stored in a client's mcp.json, using Better Auth's MCP plugin together with Vercel's @vercel/mcp-adapter in a Next.js app.
- [Managed Better Auth is now an OAuth provider, with MCP support](https://swe.quest/articles/managed-better-auth-is-now-an-oauth-provider-with-mcp-support-613f00a7521407ac.md): Neon · 2026-11-02 · Medium · 5 min read · Identity & auth, AI agents, PostgreSQL
  Neon's Managed Better Auth now supports the OAuth Provider plugin, turning an auth instance into an OAuth 2.1 authorization server that both companion apps and MCP clients can use to sign users in.
- [Is MCP good yet?](https://swe.quest/articles/is-mcp-good-yet-c41ace4de474f361.md): Neon · 2026-11-04 · Medium · 9 min read · AI agents, API design, Serverless, LLMs
  Neon's remote MCP server now handles more tool calls than its CLI runs commands and has about twice the CLI's daily active users.
- [MCP or CLI? Yes.](https://swe.quest/articles/mcp-or-cli-yes-bc20ce304cab3de5.md): Sentry · 2026-11-10 · Medium · 6 min read · AI agents, Developer tools, Identity & auth
  Sentry now ships its MCP server launchable from the CLI (\`sentry mcp\`), running stdio mode with a shim that reuses CLI credentials via a separate \`Sentry-Bearer\` token header that bypasses the OAuth proxy's CIMD/DCR flow.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
