honoMcp
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
A simple Model Context Protocol (MCP) server built with Hono that can be deployed to Val Town. It provides a greeting tool that generates personalized messages in multiple languages.
- Simple greeting tool that supports English, Spanish, and French
- Built with Hono web framework for fast performance
- Uses the official MCP SDK with Streamable HTTP transport
- Ready to deploy on Val Town
- Create a new val on Val Town
- Copy the contents of
mcp-server.tsinto your val - Save and your MCP server is live!
The server will be available at: https://[your-username]-[val-name].val.run
Add this to your Claude Desktop configuration
(~/Library/Application Support/Claude/claude_desktop_config.json on macOS):
{ "mcpServers": { "greeting-server": { "command": "npx", "args": [ "mcp-remote", "https://[your-username]-[val-name].val.run/mcp" ] } } }
claude mcp add --transport http greeting-server https://[your-username]-[val-name].val.run/mcp
You can test the server is working by visiting:
https://[your-username]-[val-name].val.run/
This should return a JSON response with server information.
Generates a personalized greeting message.
Parameters:
name(string, required): The name of the person to greetlanguage(enum, optional): The language for the greeting- Options: "english", "spanish", "french"
- Default: "english"
Example usage in Claude:
Use the greet tool to say hello to Alice in Spanish
- Framework: Hono (lightweight web framework)
- MCP SDK: Official TypeScript SDK from Anthropic
- Transport: Streamable HTTP using fetch-to-node adapter
- Runtime: Deno (via Val Town)
The server uses:
McpServerfrom the MCP SDK to define toolsStreamableHTTPServerTransportfor HTTP-based MCP communicationfetch-to-nodeto convert between Hono's fetch API and Node.js streams- Zod for input validation
To add more tools, add additional server.tool() calls in the getServer()
function:
server.tool(
"tool-name",
"Tool description",
{
param1: z.string().describe("Parameter description"),
// more parameters...
},
async ({ param1 }) => {
// Tool implementation
return {
content: [
{
type: "text",
text: "Response text",
},
],
};
},
);