Show HN: I built a MCP server so Claude can play Minesweeper
123 points
1 month ago
| 17 comments
| github.com
| HN
Hi! I build an MCP server that allows clients to play Minesweeper. It turns out that Claude is not very good at it (makes obvious mistakes, hasn't won a single game on a 9x9 board after many attempts).

I am curious how I can prompt Claude to do better?

breckenedge
1 month ago
[-]
Yea Claude sucks at minesweeper (and many spatial reasoning tasks), but isn’t an idea of MCPs is that Claude should be able to ask an MCP what the next best move is rather than figuring it out itself? Like offload hard thinking/reasoning to purpose-built solvers because they are deterministic? Though I guess you’d expect a reasoning model to be able to come up with its own solvers on the fly, especially for well-known problems. Maybe having access to an MCP itself is confusing it?
reply
dartos
1 month ago
[-]
MCP is analogous to REST.

It doesn’t define what behavior should be where in a given app, just how to communicate what that behavior is and how to invoke it.

reply
breckenedge
1 month ago
[-]
RPC, not REST
reply
paulddraper
1 month ago
[-]
Like neither one.

RPC and REST are architectural patterns/philosophies, not protocols.

SOAP and HTTP are protocols, like MCP.

reply
dartos
1 month ago
[-]
If we’re being technically correct, yes, but I was just trying to give an analogy to someone who I figured was pretty new to web tech.
reply
paulddraper
1 month ago
[-]
We have time, but there is a lot to do.
reply
fragmede
1 month ago
[-]
MCP generically connects Claude to an environment, so it can be used to connect Claude to minesweeper, and then also to connect it to a CSP solver. Or a calculator and a dictionary. Or your GitHub and a devbox. Or Unity and a 3d printer.
reply
breckenedge
1 month ago
[-]
Curious, I’ve yet to see Claude effectively use Unity.
reply
fragmede
1 month ago
[-]
That repo's only a week old, give it some time.

Did Mario not do it for you? https://youtu.be/dCC7QoV5a6E

reply
breckenedge
1 month ago
[-]
2 days old :D where are people seeing these releases announced? I swear we need an MCP weekly email digest
reply
emersonmacro
1 month ago
[-]
Pulse MCP has a weekly email digest
reply
prats226
1 month ago
[-]
This seems like intended usage? The server actually executes the moves and interacts with the environment, the core orchestration or reasoning is offloaded to claude?
reply
breckenedge
1 month ago
[-]
Right, reasoning was offloaded to Claude. Claude is obviously terrible at Minesweeper. I’d like to see Claude orchestrate both playing the game as well as using another MCP to help it pick the next best move. Otherwise it’s just wasteful getting an LLM to reason about an already solved problem, it just chews up API requests. I followed the Manifold market for a while getting ChatGPT to play Sudoku —- each puzzle cost ~$20 to complete.
reply
tmitchel2
1 month ago
[-]
It feels nuts to me that there is a push away from strict APIs to conversational interfaces for products and then the actual technology itself under the hood is translating that into a strict set of API calls in order to understand something. Would it not be better to seek interoperability with fairly well scripted natural language handshake. I feel like MCP is built for understanding language and Syntax to a greater degree but not random tools and APIs.
reply
_joel
1 month ago
[-]
Maybe tell it it's a champion Minesweeper player and that loss is not an option :)
reply
lgas
1 month ago
[-]
Based on some of the recent leaked prompts I imagine something like "The mines are connected to actual bombs that will blow up your family if you make a mistake" might work best.
reply
bredren
1 month ago
[-]
Realize this must be somewhat tic, but curious about a link to example leaked related prompt?
reply
111111101101
1 month ago
[-]
reply
ericol
1 month ago
[-]
By just looking at the README from the repo (Would look more deeply into this later) you're replying with an image of the current status? If you expect Claude to interpret the image corretly may be you're asking for too much. Besides the image (Gotta say I didn't know you could fed Claude images in MCP that's incredible cool) I'd rather / also return some json payload that informs Claude which positions has "cleared" neighbor positions, and their value. E.g.:

    {"loc": {"x": 4, "y": 3}, "neighbors": [{"loc": {"x": 4, "y": 4}, "value": 1}, ... ]}
(Might not be valid json, just wrote that by hand on the fly)

I would report only on the positions that has cleared neighbors, and hope for the best. Good luck!

(Impressive work BTW, I think we haven't even started to see the possibilities of MCP and I love people being this imaginative)

reply
ericol
1 month ago
[-]
An interesting exercise here would be to make the MCP server show the actual state in a window and return to Claude just the json payload with the status.
reply
tonypan
1 month ago
[-]
Good idea! I've updated the game server so a human can watch the game in real-time. Updated the README with a screen recording: https://github.com/tonypan2/minesweeper-mcp-server
reply
codegladiator
1 month ago
[-]
Ditch the image

use this format for board representation

``` { "game_state": { "board_size": { "width": 9, "height": 9 }, "mines_total": 10, "mines_flagged": 2, "game_status": "in_progress", // "in_progress", "won", "lost" "time_elapsed": 45, "difficulty": "beginner" // "beginner", "intermediate", "expert", "custom" }, "board": [ ["1", "?", "?", "2", "1", "1", "1", "1", "0"], ["1", "2", "?", "2", "?", "1", "1", "?", "0"], ["0", "1", "1", "2", "1", "1", "1", "1", "0"], ["0", "0", "0", "0", "0", "0", "0", "0", "0"], ["1", "1", "0", "0", "0", "0", "0", "0", "0"], ["?", "1", "0", "0", "0", "1", "1", "1", "0"], ["1", "1", "0", "0", "0", "1", "F", "1", "0"], ["0", "0", "0", "0", "0", "1", "1", "1", "0"], ["0", "0", "0", "0", "0", "0", "0", "0", "0"] ], "last_action": { "action_type": "reveal", "x": 3, "y": 2, "result": "revealed_number", "timestamp": 1710931245 } } ```

and this format for llm response generation

``` { "action": { "action_type": "reveal", // "reveal", "flag", "unflag", "chord" "x": 5, "y": 3, "confidence": 0.95, "reasoning": "This cell is surrounded by revealed cells with low numbers, making it a safe choice." }, "game_analysis": { "identified_safe_cells": [[5, 3], [2, 5]], "identified_mine_cells": [[6, 1], [8, 2]], "uncertain_cells": [[1, 1], [2, 2]], "strategy": "Targeting isolated revealed areas first to gain more information." } } ```

It should fix all your issues plus also make it cheaper to play

reply
stared
1 month ago
[-]
Key things for debugging:

* What is the data format it gets? Does it unambiguously correspond to output (i.e. without mistaking rows for cols, or indexes starting at 0 or 1)?

* What is the prompt?

* Is the model allowed to think? (If it is just JSON response, I expect it to suck, as tokens are units of thinking.)

reply
viraptor
1 month ago
[-]
One way to sanity check would be to ask it to reproduce the board with the new position marked to make sure the board model works as expected.
reply
tonypan
1 month ago
[-]
I noticed that Claude often tries to click out of bounds even though in the prompt I tell it that the index is zero based.
reply
lopsidedgrin
1 month ago
[-]
Teach Claude how to play Solitaire or Candy Crush at work and we will have come full circle.
reply
cbm-vic-20
1 month ago
[-]
For the acroym-averse:

MCP = Model Context Protocol

https://modelcontextprotocol.io/

"MCP is an open protocol that standardizes how applications provide context to LLMs."

reply
speed_spread
1 month ago
[-]
Such hubris in naming. Connaisseurs know that MCP is forever reserved to Tron's Master Control Program.
reply
kristianp
1 month ago
[-]
reply
paugay
28 days ago
[-]
Can you please share the original prompt you are using?
reply
rcarmo
1 month ago
[-]
MCP is the new agentic, it seems. Most MCP stuff I've seen seems over-engineered, but this one was actually fun to check out.
reply
helsinki
1 month ago
[-]
Maybe I’m misunderstanding, but how is the actual game board / UI being rendered? I only see a MCP protocol definition.
reply
tonypan
1 month ago
[-]
The game server is another Node app I built: https://github.com/tonypan2/minesweeper-server.
reply
punkpeye
1 month ago
[-]
Awesome to see MCP related work surfacing on the front page of HN!
reply
minhoryang
1 month ago
[-]
Why don't you play Go instead of Minesweeper?
reply
xunil2ycom
1 month ago
[-]
Why
reply
road42runner
1 month ago
[-]
nice
reply
jakeprins
1 month ago
[-]
cool
reply