Skip to main content
Glama
edk4971

Minecraft Recipe MCP Server

by edk4971
README.md
# Minecraft Recipe MCP Server

A Model Context Protocol server that returns Minecraft crafting recipes for a given item.

Primary compatibility: MCP 2026-07-28 with Streamable HTTP at `POST /mcp`. Implemented with the official `mcp` Python SDK.

## Tool

`minecraft_get_recipe`

Arguments:
```json
{ "item": "string" }
```

Input is normalized: lowercased, spaces → `_`, optional `minecraft:` prefix stripped. Matches `slots.crafting.result.id` verbatim.

Returns one `ContentBlock` per matching recipe, each `type: "text"` containing the raw recipe JSON object exactly as in `recipes.json`.

If no recipes found, returns empty content array. Errors return `isError: true`.

## Running

Local:
```bash
pip install mcp
python server_mcp.py
```
Server runs on http://localhost:3000/mcp

Docker:
```bash
docker build -t minecraft-recipe-mcp .
docker run -p 3000:3000 minecraft-recipe-mcp
```

Traefik labels can be added as usual; the service listens on port 3000 and endpoint `/mcp`.

## Example

Get recipes with per-request meta:
```bash
curl -X POST http://localhost:3000/mcp \
 -H "Content-Type: application/json" \
 -H "MCP-Protocol-Version: 2026-07-28" \
 -d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"minecraft_get_recipe","arguments":{"item":"red dye"}},"_meta":{"io.modelcontextprotocol/protocolVersion":"2026-07-28","io.modelcontextprotocol/clientCapabilities":{}}}'
```


```bash
curl -X POST http://localhost:3000/mcp -H "Content-Type: application/json" \
 -d '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"minecraft_get_recipe","arguments":{"item":"red dye"}}}'
```

Returns 4 recipes for `minecraft:red_dye`.

## Files

* `server_mcp.py` – MCP SDK server
* `server.py` – legacy Flask prototype
* `recipes.json` – Minecraft recipes data – source: https://github.com/destruc7i0n/crafting/blob/main/src/data/generated/vanilla-recipes/26.2.json
* `requirements.txt`
* `Dockerfile`