Hacker News Explorer MCP

Hacker News Explorer MCP

While exploring ways to remotely deploy an MCP (Model Context Protocol) server, I found existing frameworks overly complex. I prefer to understand the fundamentals and ask: What’s the bare minimum needed to make this work?

I was already a fan of Cloudflare Workers and was warming up to Server-Sent Events (SSE). However, I hit a snag: the serverless nature of Cloudflare Workers doesn’t naturally align with SSE’s requirement for persistent connections to push data to clients. This seemed like a fundamental mismatch.

Then it struck me—Durable Objects could bridge this gap. They offer stateful, single-threaded instances with persistent storage, making them ideal for managing SSE connections in a serverless environment. Excited by this realization, I dove into building the solution, navigating the challenges of working with cutting-edge libraries.

This landing page (README) is my way of guiding others toward building correct, scalable, and secure MCP servers. It also showcases how authentication can prevent DNS rebinding attacks.

Tool Args (JSON) What you get
top_stories { "limit?": integer ≤ 500 } Array of top‑story IDs
get_story { "id": integer } Full item object (title, url, score, kids …)
get_user { "username": string } User profile (karma, created, submissions)

Why an autonomous agent cares

Because the agent calls the tools over MCP, all heavy lifting happens server‑side; the planner stays stateless.

🌩️ Why Cloudflare Durable Objects?

A Developer’s Perspective

When I set out to build an MCP server, I was driven by a desire to understand the fundamentals and minimize complexity. I was already a fan of Cloudflare Workers for their serverless capabilities, and I was exploring Server-Sent Events (SSE) to enable real-time interactions. However, I encountered a challenge: the stateless nature of Workers didn’t mesh well with SSE’s need for persistent connections.

This led me to Durable Objects. Unlike traditional Workers, Durable Objects provide a unique combination of compute and storage, allowing for stateful applications in a serverless environment. Each Durable Object is a globally unique, single-threaded instance that can maintain state across sessions .

Why Durable Objects Fit the MCP Model

Durable Objects align well with the requirements of an MCP server:

Real-World Applications

In practice, Durable Objects have proven effective for:

Considerations

While Durable Objects offer many advantages, it’s important to be mindful of their limitations:

Develop locally

# clone the repository
git clone git@github.com:fintkz/hn-explore-mcp.git

# install dependencies
cd hn-explore-mcp
bun install

# run locally
wrangler dev

Open http://localhost:8787/ in your browser.

Connect the MCP inspector to your server

To explore your new MCP API, use the MCP Inspector.

Inspector config
Inspector tool call

Connect Claude Desktop to your local MCP server

Follow Anthropic's Quickstart. In Claude’s config:

{
  "mcpServers": {
    "hn": {
      "command": "npx",
      "args": ["mcp-remote", "http://localhost:8787/sse"]
    }
  }
}

Once logged in Claude will show top_stories / get_story / get_user in the hammer menu.

Available tools

Deploy to Cloudflare

  1. npx wrangler kv namespace create OAUTH_KV
  2. Add that ID to wrangler.jsonc.
  3. npm run deploy

Call your deployed MCP server

npx @modelcontextprotocol/inspector https://hn-explore-mcp.fintkz.workers.dev/sse

Connect Claude Desktop to production

{
  "mcpServers": {
    "hn": {
      "command": "npx",
      "args": ["mcp-remote", "https://hn-explore-mcp.fintkz.workers.dev/sse"]
    }
  }
}

Debugging tips