MCP Server on Val Town

A Model Context Protocol server deployed as a serverless HTTP endpoint on Val Town.

Transport

Uses Streamable HTTP (the modern MCP transport as of spec 2025-03-26), replacing the older SSE transport.

Endpoint

POST https://NK5--beb4815432c311f19d3342dde27851f2.web.val.run/mcp

Health check:

GET https://NK5--beb4815432c311f19d3342dde27851f2.web.val.run/

Capabilities

Tools

ToolDescription
echoReturns the exact message you send
calculateEvaluates a safe math expression (e.g. 2 + 2 * 3)
fetch_urlFetches a URL and returns its text content

Resources

URIDescription
info://serverServer info and capability listing

Prompts

PromptDescription
summarizeTemplate to ask a model to summarize text (brief or detailed)

Connecting

Claude Desktop / Cursor

Add to your MCP config:

{ "mcpServers": { "val-town-mcp": { "transport": "http", "url": "https://NK5--beb4815432c311f19d3342dde27851f2.web.val.run/mcp" } } }

MCP Inspector

npx @modelcontextprotocol/inspector # Enter the URL above and select "Streamable HTTP"

Architecture

Rendering mermaid diagram...

Stateless mode: Each request creates a fresh server instance — ideal for serverless. No session state is maintained between calls.

Extending

Add your own tools inside buildServer() in main.ts:

server.registerTool("my-tool", { title: "My Tool", description: "Does something useful", inputSchema: { input: z.string() }, }, async ({ input }) => ({ content: [{ type: "text", text: `Result: ${input}` }], }));