ModelFetch

Overview

Run MCP servers anywhere TypeScript/JavaScript runs

ModelFetch makes it effortless to build and deploy MCP servers anywhere. Create your McpServer with the official MCP TypeScript SDK, then pass it to ModelFetch's handle() function — that's it. ModelFetch takes care of all runtime-specific details, letting you focus on building your MCP server capabilities instead of wrestling with tedious platform differences.

How It Works

ModelFetch works with any McpServer instance from the official MCP TypeScript SDK. Here's all it takes:

Create your McpServer with the official MCP TypeScript SDK

server.ts
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import { z } from "zod";

const server = new McpServer({
  title: "My MCP Server",
  name: "my-mcp-server",
  version: "1.0.0",
});

server.registerTool(
  "roll_dice",
  {
    title: "Roll Dice",
    description: "Rolls an N-sided dice",
    inputSchema: { sides: z.number().int().min(2) },
  },
  ({ sides }) => ({
    content: [
      {
        type: "text",
        text: `🎲 You rolled a ${1 + Math.floor(Math.random() * sides)}!`,
      },
    ],
  }),
);

export default server;

Already have your server?

If you already have an McpServer instance, you can continue to the next step without rewriting your server or learning new APIs.

Run it anywhere with ModelFetch's handle() function

src/index.ts
import handle from "@modelfetch/node"; // Choose your runtime
import server from "./server"; // Import your server

handle(server); // That's it — ModelFetch handles all runtime-specific details

Awesome, isn't it?

That's just a few lines of code to make your McpServer work across all supported platforms.

The handle() Function

Every runtime package exports a default handle() function that takes an McpServer instance as its first parameter and handles all runtime-specific details:

src/index.ts
import handle from "@modelfetch/node"; // Choose your runtime
import server from "./server"; // Import your server

handle(server); // That's it — ModelFetch handles all runtime-specific details

See Runtime for all runtime-specific guides, examples, and API references.