Content
# Tool List
Cloudflare and Honoで作る最もシンプルなリモートMCPサーバー。
## Overview
This project is a sample implementation of an MCP (Model Context Protocol) server running on Cloudflare Workers, using the Hono framework. It demonstrates how to build an MCP server with minimal code.
## Provided Tools
### factorize
A tool for factorizing positive integers.
**Input**:
- `number`: A positive integer to be factorized (1 or more, up to 15 digits)
**Output**:
- List of prime factors
- Number of divisions
**Example**:
```
Input: 12
Output:
- Factorization result of 12:
- Prime factors: [2, 2, 3]
- Number of divisions: 3
```
## Prerequisites
- Node.js v18 or later
- Cloudflare account (for deployment)
## Setup
```bash
# Clone the repository
git clone <repository-url>
cd simple-mcp-server
# Install dependencies
npm install
```
## Local Execution
```bash
npm run dev
```
The server starts at `http://localhost:8787`. The MCP endpoint is `http://localhost:8787/mcp`.
## Testing
```bash
npm test
```
## Deployment to Cloudflare
```bash
# Log in to Cloudflare (only for the first time)
npx wrangler login
# Deploy
npm run deploy
```
After deployment, you can access it at `https://<your-worker>.workers.dev/mcp`.
## Connecting from MCP Client
### Claude Desktop
Add the following to `claude_desktop_config.json`:
```json
{
"mcpServers": {
"simple-mcp-server": {
"url": "http://localhost:8787/mcp"
}
}
}
```
After deployment, change the `url` to your Cloudflare Workers URL.
### Claude Code
```bash
claude mcp add simple-mcp-server http://localhost:8787/mcp --transport http
```
## Verification
Verification with curl:
```bash
# Get tool list
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}'
# Perform prime factorization
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}'
```
## Technical Stack
- [Hono](https://hono.dev/) - Lightweight web framework
- [@hono/mcp](https://github.com/honojs/middleware/tree/main/packages/mcp) - Hono's MCP support
- [Cloudflare Workers](https://workers.cloudflare.com/) - Serverless execution environment
- [Vitest](https://vitest.dev/) - Testing framework
- [zod](https://zod.dev/) - Schema validation
## License
MIT
## License Notice
Claude Code-related documents (`.claude/`, `.steering/`, etc.) are based on [GenerativeAgents/claude-code-book-chapter8](https://github.com/GenerativeAgents/claude-code-book-chapter8) (MIT License).