docs/publishing/guides/ts-modelfetch.mdx
ModelFetch is a delightful TypeScript/JavaScript SDK for building and deploying MCP servers anywhere TypeScript/JavaScript runs - Write your MCP server once and run it anywhere without vendor lock-in.
npx -y create-modelfetch@latest
Follow the interactive prompts to:
Then navigate to your project:
cd my-mcp-server
Edit the server file to add your MCP tools, resources, and prompts:
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(
'add',
{
title: 'Add Numbers',
description: 'Add two numbers together',
inputSchema: {
a: z.number(),
b: z.number()
}
},
({ a, b }) => ({
content: [
{
type: 'text',
text: `${a} + ${b} = ${a + b}`
}
]
})
)
export default server
ModelFetch supports multiple deployment targets. Deploy your server to any platforms that support these runtimes:
See the ModelFetch documentation for more details.
<Warning> For development, you can use [ngrok](https://ngrok.com) to temporarily expose your local server. Only use this in a safe environment as it exposes your server to the internet. </Warning>Now that you have a publicly available MCP server, you can follow the existing MCP server guide to deploy it to Agentic.