Skip to content
Early access

Search the docs

Find a page or a section by keyword.

MCP servers

An MCP server is your own Model Context Protocol server — the tools your team or your product exposes to AI agents — running as an app on the platform. Import it from a GitHub repository exactly like a web app; the difference is what it speaks: instead of pages, it answers the Model Context Protocol over Streamable HTTP, and the app's Overview page renders a connect card your clients take the URL from.

Import an MCP server

Import the repository from Web apps → Deploy an app and choose MCP server as the type. The build, the health gates and the serving path are the same as any app's. You can also switch an existing app's type from its General settings — it changes what the console shows, not how the app runs.

The server must:

  • Listen on $PORT — the platform injects the port it routes to as the PORT environment variable.
  • Speak Streamable HTTP — the Model Context Protocol's remote transport. A server written for stdio needs a bridge in front of it: wrap it in your repository's own Dockerfile with a stdio-to-HTTP bridge, and import with Dockerfile as the framework.

A minimal server

A Node server with the official TypeScript SDK:

ts
import express from "express";
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js";

const app = express();
app.use(express.json());
const mcp = new McpServer({ name: "my-tools", version: "1.0.0" });

mcp.tool("ping", () => ({ content: [{ type: "text", text: "pong" }] }));

app.post("/mcp", async (req, res) => {
  // Stateless: a fresh transport per request, dropped when the response closes.
  const transport = new StreamableHTTPServerTransport({ sessionIdGenerator: undefined });
  res.on("close", () => {
    transport.close();
  });
  await mcp.connect(transport);
  await transport.handleRequest(req, res, req.body);
});

app.listen(Number(process.env.PORT));

A Python server with FastMCP:

python
import os
from fastmcp import FastMCP

mcp = FastMCP("my-tools")

@mcp.tool
def ping() -> str:
    return "pong"

mcp.run(transport="http", host="0.0.0.0", port=int(os.environ["PORT"]))

The path the protocol answers on is your choice — /mcp is the convention.

The connect card

The Overview page of an MCP server lists every address it answers on — the generated subdomain plus each active custom domain — as a ready URL, with a path field and copyable config for the clients that take a remote MCP server: an mcpServers JSON block for the JSON-configured ones, and a curl initialize for a quick probe. Claude Code and Claude Desktop take the URL as a custom connector; every other MCP client reads the JSON above.

Health checks

The deploy gates probe the app before it takes traffic. Without a configured health path, any reply below 500 on / passes — an MCP endpoint that answers 405 on a bare GET passes as-is. If your server serves an ordinary 2xx route, set it as the Health path in Runtime settings for a stronger gate.

Sessions and redeploys

Streamable HTTP sessions are stateful: a deploy restarts the container and open sessions are dropped, so a client reconnects on its next request. A server that keeps no session state is unaffected. Redeploys, rollbacks and cancellations work exactly as they do for web apps.

Authenticate your callers

Out of the box the server URL is public — anyone who holds it can call your server, so a server that exposes anything private must authenticate its callers itself: check a token or a key in the request header, and refuse the rest. The keys your tools call with belong in Environment variables — they reach the container as env vars, and secrets stay masked in the console.

For MCP servers the platform can do this for you: switch Private on in the app's General settings, and every public hostname of the app answers only a workspace API key of your workspace — the platform's gate stands in front of your server and checks each call before a byte reaches it.

Private servers and connectors

With Private on, workspace members connect an MCP client with no key dance at all: the clients that support OAuth — Claude Desktop, Claude Code, and others — handle the flow themselves. Add the URL as a connector, sign in with your Sahabti account, approve the workspace, and every call the client makes carries a token the platform issued and checks before it reaches your server. The server itself needs no OAuth code — the platform answers the protocol's discovery and token checks for it. Anyone who is not a member of the workspace is refused at sign-in, no matter that they hold the URL.

Next steps

  • Web apps — the full app lifecycle: builds, rollbacks, domains
  • Environment variables — where your server's secrets live
  • Domains — serve your MCP server on a hostname you own
  • MCP — manage your Sahabti workspace itself from an MCP client