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.
mcp-server.ts into your valThe 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
Example usage in Claude:
Use the greet tool to say hello to Alice in Spanish
The server uses:
McpServer from the MCP SDK to define toolsStreamableHTTPServerTransport for HTTP-based MCP communicationfetch-to-node to convert between Hono's fetch API and Node.js streamsTo 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",
},
],
};
},
);