Back to Home

Build MCP Servers Without Fighting the Protocol

Ever tried building an MCP server with Hono or Bun and hit mysterious runtime errors? You're not alone. The Model Context Protocol is powerful, but the devil's in the protocol handshakes and runtime compatibility.

2 min read
mcpmcp-handlerabridged
John Ryan Cottam
John Ryan Cottam
Build MCP Servers Without Fighting the Protocol

Build MCP Servers Without Fighting the Protocol

Ever tried building an MCP server with Hono or Bun and hit mysterious runtime errors? You're not alone. The Model Context Protocol is powerful, but the devil's in the protocol handshakes and runtime compatibility.

The fix: Vercel's MCP Adapter handles all the messy bits so you can focus on building tools.

What You Need to Know

MCP (Model Context Protocol) is Anthropic's open standard for connecting AI agents to external tools. Think of it as a universal adapter between Claude (or any AI) and your APIs.

Vercel's adapter lets you build MCP servers on any stack—Next.js, Nuxt, Hono, Express, whatever. It abstracts away:

  • Protocol handshakes
  • Message serialization
  • Runtime differences (Bun vs Node.js)
  • Error handling
  • Transport negotiation

Quick Example

Here's an MCP server that generates ASCII art, built with Hono:

import { createMcpHandler } from "@vercel/mcp";
import { z } from "zod";
import figlet from "figlet";

const handler = createMcpHandler(
  (server) => {
    server.tool(
      "createAsciiArt",
      "Create ASCII art from text using figlet",
      { text: z.string() },
      async ({ text }) => {
        const art = figlet.textSync(text);
        return {
          content: [{ type: "text", text: art }],
        };
      }
    );
  },
  {},
  { basePath: "/", maxDuration: 60 }
);

app.all("/mcp/*", async (c) => {
  return await handler(c.req.raw);
});

That's it. Type-safe, framework-agnostic, and ready to deploy.

Testing Your Server

Use the MCP Protocol Inspector during development:

npx @modelcontextprotocol/inspector

Connect to Claude Desktop by adding to your config:

{
  "mcpServers": {
    "your-server": {
      "url": "http://your-server.com/mcp"
    }
  }
}

Key Takeaways

  • Skip the protocol complexity: Let the adapter handle handshakes and serialization
  • Build once, run anywhere: Works across frameworks and runtimes
  • Type safety included: Zod schemas validate your tool inputs
  • Production-ready: Built-in auth and error handling

Resources

Bottom line: If you're building MCP servers, use the adapter. It saves hours of debugging runtime quirks and lets you ship faster.