Deep DiveAnvilCalc

AnvilCalc is also an MCP server: let your AI assistant plan the anvil order

AnvilCalc, our Minecraft anvil cost calculator, has a second front door besides the website: a remote Model Context Protocol (MCP) server. It lets an AI assistant call the same calculation engine the website uses, so it can work out an exact anvil plan instead of guessing at enchanting costs. This post describes what the server offers and how to connect to it. The setup is also documented on AnvilCalc’s own MCP server page.

The MCP page on anvilcalc.com showing the endpoint and a client configuration entry

Why an assistant might want it

Anvil costs are easy to get wrong from memory. Every item and book carries a prior work count, each combine adds a penalty that roughly doubles with it, and the order of operations decides whether a build is cheap, expensive, or refused with “Too Expensive!”. A language model asked for a plan will often produce something plausible that does not add up. An assistant connected to the server can instead hand the question to code that applies the actual rules. The enchanting strategy guide on AnvilCalc explains the rules themselves.

What the server is

  • Public and read-only. No account, API key or sign-in is needed.
  • Stateless. It runs as a Cloudflare Worker. Every request is answered on its own, and nothing about your items is stored.
  • The same engine as the website. The calculation code is shared, so the numbers match what you see in the calculator.
  • Java and Bedrock. Both tools take an optional edition (java or bedrock, default java) and version. Without a version you get the latest one supported for that edition; an unsupported combination returns an error that lists what is available.

The two tools

anvil_combine_cost

This simulates exactly one anvil operation: an item in the left slot, a sacrifice in the right slot, and optionally a new name. There is no search involved. It is the equivalent of putting two things in the anvil and reading the price. The result contains the cost in XP levels, whether the operation is allowed, and the enchantments of the result. A book is described like any other item, with the id enchanted_book or book, and each side carries its own enchantments and prior work count.

anvil_migration_path

This one searches. You describe a sourceItem (what you have now, with its enchantments, prior work count and name) and a targetItem (the enchantments you want), and it returns the cheapest multi-step path with a cost for every step and a total. Both must be the same kind of item, since an anvil cannot turn one item into another, and a target that would need a lower enchantment level than the item already has is reported as an error.

You can also pass availableSources, a list of books and items you actually own, each with its enchantments and prior work count. Two Unbreaking II books, one from a villager and one fished up, combine into Unbreaking III at a real cost, and the tool can account for that instead of assuming fresh books. A source can declare a quantity, or be marked unlimited for something you can always get again, such as a standing villager trade. By default the tool still assumes that a missing book can be obtained fresh; setting inventoryOnly to true turns that off, so the plan uses only what you declared. If even the cheapest sequence breaks the per-operation cap, the steps that exceed it are flagged in the result rather than the tool refusing to answer.

Renaming is supported in both tools and costs a flat extra level, whatever the name is.

Connecting a client

The server speaks MCP over Streamable HTTP at https://mcp.anvilcalc.com/mcp. Opening the bare domain, mcp.anvilcalc.com, returns a short JSON note that points back to the MCP page and to that endpoint. Clients that support remote MCP servers, Claude Desktop and Claude Code among them, accept a configuration entry of this shape:

{
  "mcpServers": {
    "anvilcalc": {
      "url": "https://mcp.anvilcalc.com/mcp"
    }
  }
}

If you would rather try it without configuring a client, the MCP Inspector can be pointed at the same URL. The MCP page has the full list of fields for both tools with example requests.

When to use the website instead

For a one-off build, the calculator is quicker: pick the item and the enchantments, and read the steps. The server is for the cases where an assistant is already in the loop, for example while you are planning several items at once and want the arithmetic checked rather than estimated.