Skip to main content
Glama

Hono Math MCP Server

by ericbfriday
CLAUDE.md2.53 kB
# CLAUDE.md This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. ## Project Overview This is a Hono-based MCP (Model Context Protocol) server that provides mathematical operation tools. It's developed using **Bun JS** as the primary runtime and package manager, and designed for deployment on **Vercel** as a serverless function. The server uses the `mcp-handler` library to simplify MCP server creation. ## Development Commands **Primary development with Bun:** ```bash # Install dependencies (Bun is the preferred package manager) bun install # Local development with Vercel CLI vc dev # Build the project vc build bun run build # Deploy to Vercel vc deploy ``` **Alternative commands (if Bun is not available):** ```bash # Install dependencies npm install pnpm install # Build npx tsc ``` ## Architecture ### Core Components 1. **MCP Handler Setup** (`src/index.ts:8-83`) - The server uses `createMcpHandler` from the `mcp-handler` library to define MCP tools - Tools are defined with Zod schemas for runtime validation - Each tool returns content in MCP format with type and text fields 2. **HTTP Server Integration** (`src/index.ts:86-87`) - Hono app mounts the MCP handler on `/mcp/*` route - The handler processes raw requests and manages MCP transport protocol internally - All HTTP methods are supported via `app.all()` 3. **Tool Definitions** - Four mathematical operation tools: add, subtract, multiply, divide - Each tool accepts two number parameters validated by Zod - Division tool includes zero-division protection ### Technology Stack - **Hono**: Lightweight web framework optimized for edge runtimes - **MCP Handler**: Simplifies MCP server creation with declarative tool definitions - **Zod**: Runtime type validation for tool parameters - **TypeScript**: Configured for ESNext target with strict mode ### Deployment - Optimized for Vercel serverless deployment - No explicit Vercel configuration file; uses default Node.js runtime - Entry point is `src/index.ts` which exports the Hono app as default ## Key Implementation Details - The MCP handler configuration includes `basePath: '/'`, `maxDuration: 60`, and `verboseLogs: true` - Tools use descriptive parameter names with Zod's `.describe()` method for better documentation - Error handling is implemented at the tool level (e.g., division by zero check) - The root endpoint (`/`) provides a JSON response with server information and available tools list

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/ericbfriday/vercel-hono-mcp-bun'

If you have feedback or need assistance with the MCP directory API, please join our Discord server