Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions starter/hono-mcp/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# dev
.yarn/
!.yarn/releases
.vscode/*
!.vscode/launch.json
!.vscode/*.code-snippets
.idea/workspace.xml
.idea/usage.statistics.xml
.idea/shelf

# deps
node_modules/

# env
.env
.env.production

# logs
logs/
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

# misc
.DS_Store
.vercel

dist
73 changes: 73 additions & 0 deletions starter/hono-mcp/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Hono Remote MCP Server Example

This example demonstrates how to build a Model Context Protocol (MCP) server using [Hono](https://hono.dev/), a lightweight web framework, and deploy it to Vercel. The server exposes mathematical operation tools (add, subtract, multiply, divide) that can be consumed by MCP clients.

## Demo

To connect your MCP client to the server, use: [https://hono-mcp-demo.vercel.app/mcp](https://hono-mcp-demo.vercel.app/mcp)

You can also visit [https://hono-mcp-demo.vercel.app](https://hono-mcp-demo.vercel.app) in your browser.

## What is MCP?

The Model Context Protocol (MCP) is an open protocol that standardizes how applications provide context to Large Language Models (LLMs). This example shows how to create an MCP server that exposes tools as HTTP endpoints.

## Features

- **Math Operations**: Four basic calculator tools (add, subtract, multiply, divide)
- **MCP Handler**: Uses `mcp-handler` library for easy MCP server creation
- **Type Safety**: Built with TypeScript and Zod for runtime validation
- **Vercel Deployment**: Optimized for serverless deployment on Vercel

## Prerequisites

- [Vercel CLI](https://vercel.com/docs/cli) installed globally

## Development

To develop locally:

```
npm install
vc dev
```

```
open http://localhost:3000
```

## Build

To build locally:

```
npm install
vc build
```

## Deployment

To deploy:

```
npm install
vc deploy
```

## API Endpoints

- **GET `/`** - Welcome endpoint with server information
- **POST `/mcp/*`** - MCP protocol endpoint for tool execution

## Available Tools

The server exposes the following MCP tools:

- **add** - Add two numbers
- **subtract** - Subtract two numbers
- **multiply** - Multiply two numbers
- **divide** - Divide two numbers (with zero-division protection)

## Using the MCP Server

Once deployed, you can connect to this MCP server from any MCP-compatible client by pointing to the `/mcp` endpoint. The server handles the MCP protocol transport and tool execution automatically.
14 changes: 14 additions & 0 deletions starter/hono-mcp/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "hono-mcp",
"type": "module",
"dependencies": {
"@modelcontextprotocol/sdk": "^1.17.3",
"hono": "^4.9.2",
"mcp-handler": "^1.0.1",
"zod": "^3"
},
"devDependencies": {
"@types/node": "^20.11.17",
"typescript": "^5.8.3"
}
}
Loading