Simple Hono MCP Server
A lightweight MCP server built with Hono and Cloudflare Workers that provides a tool for prime factorization. It serves as a minimal implementation for deploying remote MCP servers to serverless edge environments.
README
simple-mcp-server
CloudflareとHonoで作る最もシンプルなリモートMCPサーバー。
概要
このプロジェクトは、MCP (Model Context Protocol) サーバーをCloudflare Workers上で動作させるサンプル実装です。Honoフレームワークを使用し、最小限のコードでMCPサーバーを構築できることを示しています。
提供するツール
factorize
正の整数を素因数分解するツールです。
入力:
number: 素因数分解する正の整数(1以上、15桁以下)
出力:
- 素因数のリスト
- 割り算回数
例:
入力: 12
出力: 12の素因数分解結果:
素因数: [2, 2, 3]
割り算回数: 3回
前提条件
- Node.js v18以上
- Cloudflareアカウント(デプロイする場合)
セットアップ
# リポジトリのクローン
git clone <repository-url>
cd simple-mcp-server
# 依存関係のインストール
npm install
ローカル実行
npm run dev
サーバーが http://localhost:8787 で起動します。MCPエンドポイントは http://localhost:8787/mcp です。
テスト
npm test
Cloudflareへのデプロイ
# Cloudflareにログイン(初回のみ)
npx wrangler login
# デプロイ
npm run deploy
デプロイ後、https://<your-worker>.workers.dev/mcp でアクセスできます。
MCPクライアントからの接続
Claude Desktop
claude_desktop_config.json に以下を追加:
{
"mcpServers": {
"simple-mcp-server": {
"url": "http://localhost:8787/mcp"
}
}
}
デプロイ後は url をCloudflare WorkersのURLに変更してください。
Claude Code
claude mcp add simple-mcp-server http://localhost:8787/mcp --transport http
動作確認
curlでの確認:
# ツール一覧の取得
curl -X POST http://localhost:8787/mcp \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{"jsonrpc": "2.0", "method": "tools/list", "id": 1}'
# 素因数分解の実行
curl -X POST http://localhost:8787/mcp \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{"jsonrpc": "2.0", "method": "tools/call", "params": {"name": "factorize", "arguments": {"number": 12}}, "id": 2}'
技術スタック
- Hono - 軽量Webフレームワーク
- @hono/mcp - HonoのMCPサポート
- Cloudflare Workers - サーバーレス実行環境
- Vitest - テストフレームワーク
- zod - スキーマバリデーション
ライセンス
MIT
License Notice
Claude Code関連ドキュメント(.claude/、.steering/等)は GenerativeAgents/claude-code-book-chapter8 を参考にしています(MIT License)。
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.