Agents · · 9 min read

How to host a remote MCP server in Europe, tested with Claude Code

A TypeScript MCP server with two tools, a SQLite table and a bearer token, deployed on V8 isolates and called from Claude Code. The code, the timings we measured, and what this setup leaves out.

A remote MCP server is a web service with one endpoint, usually /mcp, that answers JSON-RPC messages over HTTPS. Any host that runs a web app can run one. On 24 November 2026 we built a small one in TypeScript with the official MCP SDK, Hono and a SQLite table, deployed it to Eurobase, and connected it to Claude Code: it went live on the first deploy, and a tool call answered in about 80 ms once the connection was open. The full code is below, with what it doesn't cover yet.

Where you can run a remote MCP server

PlatformHow it runsSign-inCost and limits
EurobaseYour Git repository, on V8 isolates or a containerWhatever your code checks; this page uses a bearer tokenFree plan, then €10 or €20 a month + VAT per workspace
CloudflareWorkers, with createMcpHandler from its Agents SDKNone in the template, or OAuth through its OAuth provider libraryNot stated in the guide
VercelVercel Functions, with the mcp-handler packageHelpers to check bearer tokens and publish OAuth metadata; you bring the authorization serverA tool call runs within one function: 300 s by default, up to 800 s on Pro and Enterprise
Fly.ioA Docker image on a MachineOAuth 2.1, or a bearer token from Fly secrets$2.19 for 30 days of a 256 MB Machine running all the time
RailwayA service from a GitHub repositoryA bearer token in MCP_API_KEYHobby plan $5 a month; streaming requests capped at 15 minutes

Read from each provider's guide on 24 November 2026; the links are under Sources. Choose Cloudflare if your users must sign in through OAuth: its guide uses its own OAuth provider library, and Eurobase has no OAuth provider. Vercel's guide covers OAuth too, with an authorization server you bring. Choose Railway if a tool streams progress for minutes: its guide allows streaming requests up to 15 minutes, and we haven't tested event-stream responses on Eurobase. For what MCP is and how hosting platforms use it, read What is MCP, and how do hosting platforms use it?.

The server: two tools and a SQLite table

The example keeps notes. It has two tools, add_note and list_notes, and stores the notes in a SQLite database. It uses @modelcontextprotocol/sdk 1.32.2, Hono 4.13 and zod 3.25. The SDK's WebStandardStreamableHTTPServerTransport takes a standard Request and returns a Response, so it runs on V8 isolates with no Node.js server underneath.

// src/index.ts
import { Hono } from 'hono';
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
import { WebStandardStreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/webStandardStreamableHttp.js';
import { z } from 'zod';

type Env = { DB: D1Database; MCP_TOKEN_SHA256?: string };

async function sha256(text: string) {
  const digest = await crypto.subtle.digest('SHA-256', new TextEncoder().encode(text));
  return [...new Uint8Array(digest)].map((b) => b.toString(16).padStart(2, '0')).join('');
}

function notesServer(db: D1Database) {
  const server = new McpServer({ name: 'notes', version: '1.0.0' });
  server.registerTool(
    'add_note',
    { description: 'Save a short note', inputSchema: { text: z.string().min(1).max(2000) } },
    async ({ text }) => {
      const row = await db.prepare('INSERT INTO notes (text) VALUES (?) RETURNING id').bind(text).first<{ id: number }>();
      return { content: [{ type: 'text', text: `Saved note ${row?.id}` }] };
    }
  );
  server.registerTool(
    'list_notes',
    { description: 'List the latest notes', inputSchema: { limit: z.number().int().min(1).max(50).default(10) } },
    async ({ limit }) => {
      const { results } = await db.prepare('SELECT id, text, created_at FROM notes ORDER BY id DESC LIMIT ?').bind(limit).all();
      return { content: [{ type: 'text', text: JSON.stringify(results) }] };
    }
  );
  return server;
}

const app = new Hono<{ Bindings: Env }>();

app.all('/mcp', async (c) => {
  const expected = c.env.MCP_TOKEN_SHA256;
  const header = c.req.header('authorization') ?? '';
  const token = header.startsWith('Bearer ') ? header.slice(7) : '';
  if (!expected || !token || (await sha256(token)) !== expected) {
    return c.json({ error: 'unauthorized' }, 401);
  }
  // A new server and transport for every request, so any instance can answer any request.
  const server = notesServer(c.env.DB);
  const transport = new WebStandardStreamableHTTPServerTransport({ sessionIdGenerator: undefined, enableJsonResponse: true });
  await server.connect(transport);
  return transport.handleRequest(c.req.raw);
});

export default app;

Two settings matter. sessionIdGenerator: undefined makes the server stateless: it keeps nothing between requests, so it doesn't matter which instance answers. The MCP specification dated 28 July 2026 drops sessions altogether. Our server and Claude Code 2.1.292 still agreed on the 2025-06-18 revision; we haven't tested a client on the newer one. enableJsonResponse: true returns each answer as one JSON body instead of an event stream, which is all a tool that answers at once needs.

The database and its table come from the Wrangler config and one migration file:

// wrangler.jsonc
{
  "name": "mcp-notes",
  "main": "src/index.ts",
  "compatibility_date": "2026-11-01",
  "compatibility_flags": ["nodejs_compat"],
  "d1_databases": [
    { "binding": "DB", "database_name": "notes", "database_id": "local-notes", "migrations_dir": "migrations" }
  ]
}

-- migrations/0001_notes.sql
CREATE TABLE notes (
  id INTEGER PRIMARY KEY AUTOINCREMENT,
  text TEXT NOT NULL,
  created_at TEXT NOT NULL DEFAULT (datetime('now'))
);

On Eurobase each d1_databases entry becomes a SQLite database of the project, and the migration runs once when a deployment activates. Every later deployment, rollbacks included, sees the same notes.

Keep only the token's hash on the server

Most guides store the bearer token itself as a secret and compare it with the header. This server stores only the token's SHA-256 and compares hashes, so the value it holds can't be used to call it. That makes the variable safe to keep as a plain environment variable, and safe to set from a coding agent, which never sees the token. Create the token and its hash on your own computer:

openssl rand -hex 24 > mcp-token.txt
printf %s "$(cat mcp-token.txt)" | shasum -a 256 | cut -d' ' -f1

Add the hash as MCP_TOKEN_SHA256 in the project's environment variables, under App deployments. If it's missing, the server refuses every request with 401 instead of running open. Comparing hashes doesn't make a weak token strong: use a long random token like the one above.

Deploy it and connect Claude Code

Push the repository to GitHub, GitLab, Codeberg, Forgejo or Gitea, create a Eurobase project from it, and deploy. Eurobase finds Hono through wrangler.jsonc and runs it on V8 isolates. Our first deployment was accepted at 19:53:27 UTC and was serving at 19:54:28, 61 seconds later, with 40 seconds of build.

Then add the server to Claude Code with the token in a header:

claude mcp add --transport http notes https://<name>.eurobase.dev/mcp --header "Authorization: Bearer $(cat mcp-token.txt)"

claude mcp get notes then reported Connected, and with Claude Code 2.1.292 we asked it to save a note and list the notes. It called add_note, then list_notes, and printed the row it had just stored in SQLite. Codex 0.169.0 takes a bearer token too, through codex mcp add notes --url <url> --bearer-token-env-var <VARIABLE>; we haven't run that one.

What we measured

All timings are from one office computer about 38 ms of network round trip away from the server, using curl with a new connection per call.

RequestTime to first byte, after TLS
list_notes, 30 calls89 ms median, 120 ms p90
add_note, 30 calls77 ms median, 128 ms p90
A plain text page on the same app, 30 calls66 ms median
list_notes after 17 minutes idle1.18 s, then 109 ms for the next call

A tool call costs about 10 to 25 ms more than a plain page: the token hash, the MCP handling and one SQLite query. For CPU, we sent 200 calls, half add_note and half list_notes, and read the project's usage before and after: Workers CPU grew by 3,328 ms, about 17 ms a call. The Free plan allows 50 ms of CPU per request and 3,000,000 ms a month, which is roughly 180,000 calls like these. A tool that parses large documents or loops over many rows uses more: on Free a request can borrow from a 2 s reserve that refills at 50 ms a second, and paid plans allow 30 s per request.

What this setup doesn't do

  • No OAuth sign-in. A bearer token suits Claude Code, Codex and your own scripts. A client that connects by opening a sign-in page in the browser needs the server to implement MCP's OAuth 2.1 authorization, which this example doesn't, and Eurobase has no OAuth provider to plug in.
  • No streamed progress. Each answer is one JSON body. We haven't tested event-stream responses, so long tools that report progress are untested here. A response must start within about 50 seconds on Eurobase.
  • No Durable Objects. Eurobase refuses Durable Object bindings at build time, so a server that keeps per-session state in one won't build there. Keep state in SQLite or call your own API, as this example does. We haven't tried Cloudflare's createMcpHandler on Eurobase.
  • The first call after a quiet spell is slower. An app with no traffic for 15 minutes stops and starts again on the next request; the table above shows what that cost us.
  • One branch per project. There are no preview deployments, so test a new tool locally with wrangler dev before you push.

Frequently asked questions

Do I need a container to host an MCP server?

No. A stateless server written with the TypeScript SDK runs on V8 isolates, as this one does. Use a container when the server is written in Python or another language, or depends on Node.js APIs isolates don't offer.

Is a bearer token enough to protect a remote MCP server?

For a server only you or your team call from Claude Code, Codex or scripts, a long random token checked on every request is a reasonable gate. If other people sign in with their own accounts, or the client only supports browser sign-in, implement OAuth 2.1 as the MCP authorization specification describes.

Why store a hash of the token instead of the token?

Because the server never needs the token itself, only a way to check it. If the variable leaks through logs, a screenshot or a coding agent's context, the hash can't be used to call the server.

Where does this MCP server's data live?

The notes live in a SQLite database of the Eurobase project, on European infrastructure. What your MCP client sends to its own model is up to that client and its provider.

Sources

Deploy your app in Europe

Sign up