Migrating from the TypeScript SDK

Checked against FrontMCP 1.11.0 on

Advanced

Migrate one client contract at a time. Before you move any code, record what clients rely on: tool names, input schemas, results, resource URIs and refused requests. FrontMCP adds structure around the protocol. It does not make every SDK middleware, transport or schema choice a drop-in match. For a small, stable server, staying with the SDK may be the simpler choice.

You will learn

  • How to compare an SDK server and a FrontMCP server with the same contract check
  • Which FrontMCP API replaces each official SDK construct
  • How one tool looks before and after the move
  • What to check for auth and for the endpoint before clients switch

Compare two implementations

Download the contract fixtures. Their README includes the SDK migration check. The check runs an official TypeScript SDK server and a FrontMCP server against the same synthetic records. Both servers expose two tools, a resource and the same result shape. The check compares the tool schemas, successful calls, a missing record, an unauthorized operation and resource content.

Extract it and, with Node.js 24 or later, run in its folder:

npm ci
npm run test:migration

The output names the package versions that are actually installed. The dated record keeps one run: official SDK 1.32.1 and FrontMCP 1.10.10, on 2026-10-22.

The official SDK server runs over an in-memory transport. FrontMCP runs through its in-process entry. So the check compares the application contract a client sees. HTTP routing, OAuth and deployment need the endpoint checks below.

Migrate with a coding agent

A coding agent can do this migration in your project. Connect it to FrontMCP's docs server first, so it reads this page and the APIs it needs for the release it installs, rather than writing FrontMCP code from what it was trained on. Then paste this prompt into it, in your SDK project:

Prompt for your coding agent
Migrate this project's MCP server from the official MCP TypeScript SDK (`@modelcontextprotocol/sdk`) to FrontMCP 1.11.0, without changing what its MCP clients see: tool names, input schemas, results, error messages, resource URIs and the requests it refuses.

Follow the guide at https://frontmcp.dev/learn/migrating-from-the-typescript-sdk, one section at a time. If FrontMCP's docs MCP server (https://mcp.frontmcp.dev) is connected, read the guide with its get_page tool and look up every FrontMCP API you use with lookup_api and get_example, passing version "1.11.0". Otherwise fetch https://frontmcp.dev/learn/migrating-from-the-typescript-sdk.md and the pages it links to. Don't write FrontMCP code from memory.

1. List what the server has: every registerTool (or tool), registerResource (with or without a ResourceTemplate) and registerPrompt; how it connects (stdio, or Streamable HTTP inside its own HTTP server); its auth; shared services such as API clients and stores; and how its tools fail (isError results or thrown errors). Show me the list before you change code.
2. Record what clients see now: drive the SDK server in-process with an InMemoryTransport linked pair and the SDK's Client, and save tools/list, a successful call and a refused call for each tool, and each resource read.
3. Add FrontMCP next to the SDK server as https://frontmcp.dev/learn/installation#adding-frontmcp-to-an-existing-project shows, with @frontmcp/sdk and frontmcp pinned to 1.11.0. Keep the SDK server working until I switch clients.
4. Move one contract at a time, by the guide's mapping table: McpServer becomes an @FrontMcp server with an @App; each tool a @Tool class with the same Zod input shape; resources, templates and prompts their decorated classes (a @Prompt's arguments are a list, not a Zod shape); a failure this.fail(new PublicMcpError(message, code)). Move shared services into a provider that tools read with this.get(). After each part, write @frontmcp/testing tests that check the recorded answers, run them, and don't start the next part until they pass.
5. Where FrontMCP answers differently, keep its behaviour and list the difference for me instead of hiding it: a failure gets _meta.code and an errorId, and in production only a PublicMcpError keeps its message.
6. A FrontMCP endpoint is public by default. Ask me which auth mode to use before you move anything protected, and keep the negative cases: call restricted tools directly by name, not only through discovery.
7. Ask me before you rename anything a client sees, change the endpoint path, or delete SDK code.

When you finish, report what you moved, the test results, every difference a client will see, anything with no FrontMCP counterpart, and the guide's checks before switching clients: the exact endpoint path and protocol revision, missing, expired and wrong-audience tokens, two callers with different access, a build for the real target, and a way to roll back.

With the docs server connected, the same prompt is also its migrate_from_typescript_sdk MCP prompt, so a client that lists MCP prompts can start it without copying. Review the agent's work as you would anyone's: the recorded answers and the tests that check them are what show the clients see no difference.

Map SDK constructs to FrontMCP

The left column is v1 of the official SDK, @modelcontextprotocol/sdk. It's the line the migration check runs, and the one FrontMCP builds on. The last column links the FrontMCP reference for each row.

Official SDK v1FrontMCPReference
new McpServer({ name, version })A class decorated with @FrontMcp({ info: { name, version }, apps }). Each app is an @App that lists its tools, resources and prompts.@FrontMcp, @App
server.registerTool(name, { description, inputSchema }, handler), or the deprecated server.tool()A @Tool({ name, description, inputSchema }) class. inputSchema is the same Zod shape, like { id: z.string() }. execute() receives the validated input. The tool() function is the form without a decorator.@Tool
server.registerResource(name, uri, metadata, read)A @Resource({ name, uri, mimeType }) class whose execute() returns the content@Resource
server.registerResource(name, new ResourceTemplate(pattern, { list }), metadata, read)A @ResourceTemplate({ name, uriTemplate }) class. execute(uri, params) receives the matched parameters.@ResourceTemplate
server.registerPrompt(name, { argsSchema }, handler)A @Prompt({ name, arguments }) class. arguments is a list of { name, description, required } entries, not a Zod shape.@Prompt
server.connect(new StdioServerTransport())FrontMcpInstance.runStdio(config)runStdio()
StreamableHTTPServerTransport inside your own HTTP serverIn Node, importing the @FrontMcp class starts an HTTP server. FrontMcpInstance.createHandler() and createFetchHandler() return a handler for a host you choose.FrontMcpInstance, createFetchHandler()
InMemoryTransport.createLinkedPair() with a Clientconnect() gives you an MCP client in memory. create() calls tools directly, with no client.connect(), create()
A handler that returns { isError: true, content }, or throwsthis.fail(new PublicMcpError(message, code))this.fail, Error classes

Move one tool

This is get_report from the migration check. It reads one record by id, and it fails when the record is missing.

Before: the official SDK

Here is the SDK version, for @modelcontextprotocol/sdk 1.32.1 and zod 4. It's the SDK server from scripts/check-migration.mjs, cut down to this one tool and served over stdio instead of in memory. The handler closes over a store object at module scope. This file can't run in a Playground, which only loads FrontMCP packages:

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

const reports = [{ id: "R-1", total: 42 }];

class ReportStore {
  get(id: string) {
    return reports.find((report) => report.id === id);
  }
}

const store = new ReportStore();
const server = new McpServer({ name: "reports", version: "1.0.0" });

server.registerTool(
  "get_report",
  { description: "Read one fixture report", inputSchema: { id: z.string() } },
  async ({ id }) => {
    const report = store.get(id);
    if (!report) return { isError: true, content: [{ type: "text", text: "Report not found" }] };
    return { content: [{ type: "text", text: JSON.stringify(report) }], structuredContent: report };
  },
);

await server.connect(new StdioServerTransport());

On SDK v2, @modelcontextprotocol/server, the comparison's example passes inputSchema as z.object(...) instead.

After: FrontMCP

The same tool in FrontMCP. The store becomes a provider, and the tool reads it with this.get(). The Playground wraps the exported tool and provider in a one-app server and calls get_report. The Tests tab checks the contract:

Open
import { PublicMcpError, Tool, ToolContext, z } from "@frontmcp/sdk";
import { ReportStore } from "./report-store";

@Tool({
  name: "get_report",
  description: "Read one fixture report",
  inputSchema: { id: z.string() },
})
export class GetReport extends ToolContext {
  async execute({ id }: { id: string }) {
    const report = this.get(ReportStore).get(id);
    if (!report) this.fail(new PublicMcpError("Report not found", "NOT_FOUND"));
    return report;
  }
}

Starting FrontMCP in your browser…

FrontMCP starts when this example comes into view.

What stays the same for clients:

  • The tool name, get_report, and its input: id, a required string.
  • A found record arrives as structuredContent, with the same JSON as text.
  • A missing record is an isError result with the text Report not found.

What changes:

  • The store is a provider. Tools ask for it with this.get(ReportStore), so they can share one instance.
  • The failure goes through this.fail(). FrontMCP adds _meta.code (NOT_FOUND here) and an errorId to the result.
  • Only a PublicMcpError keeps its message in production. FrontMCP replaces the message of any other error with an error ID (Error classes).
  • Your code doesn't build the server. In a project, list the tool and the provider in an @App, and the app in @FrontMcp.

The check's other refusal, a caller who may not read the report, depends on who is calling. That needs an auth mode, so this example leaves it out. See Choose auth explicitly.

Move shared services into a provider

Keep your API client independent of the transport. Register it as a provider, as ReportStore is above. Tools then get it with this.get(), instead of reading a module global or wiring it up per request. Move the tools into an app, and register the app on the server. Keep the public names and resource URIs your clients already use. Don't expose new class names to existing clients.

The tool reference, providers, resources and testing cover each step. The reporting download shows a complete local registration, with its tests adapted.

Choose auth explicitly

A FrontMCP endpoint is public by default. Choose an auth mode before you migrate protected data. Check how the server handles issuer, audience, expiry and scopes. Take tenant claims from a trusted identity, and enforce record access in your API. Static test keys don't replace a real identity-provider flow.

Keep your negative cases. A tool missing from discovery is not the same as a server that refuses the call, so also call restricted tools directly by name. For destructive operations, keep authorization separate from user approval.

Verify the endpoint before switching clients

  1. Keep the existing endpoint running while the new one runs in preview.
  2. Test the exact endpoint path and the protocol revision you chose. Test initialize and session behavior where they apply, the tool schemas and resource reads.
  3. Send missing, expired and wrong-audience tokens. Test two callers with different access.
  4. Compare typical success and error results. Include any widget or resource metadata the client reads.
  5. Build for the real target, and configure secrets and state. Then send the same requests to the preview.
  6. Move a small group of clients first, and watch for failures. Keep the previous deployment ready for rollback.

The deployment guide covers each target's constraints. Passing the in-memory contract check does not show that a hosted deployment works, or that OAuth behaves the same. Keep unsupported middleware or client features on the original path until a replacement has been checked.

Report a docs issue · Report a security concern privately