Home / MCP Server
Use AnvilCalc from an AI agent (MCP)
AnvilCalc's anvil combine-cost engine is also available as a remote Model Context Protocol (MCP) server, so an AI agent can compute an exact combine plan instead of guessing at enchanting costs or scraping this page.
Endpoint
The server speaks MCP over Streamable HTTP at:
https://mcp.anvilcalc.com/mcpIt's public and read-only — no API key or account needed. (The bare domain https://mcp.anvilcalc.com/ returns a small JSON pointer back to this page and the endpoint above; the actual protocol traffic goes to /mcp.)
Connecting a client
Most MCP clients (Claude Desktop, Claude Code, and others that support remote/HTTP MCP servers) accept a config entry like:
{
"mcpServers": {
"anvilcalc": {
"url": "https://mcp.anvilcalc.com/mcp"
}
}
}To try it without any client setup, point the MCP Inspector at the endpoint above.
Tools
anvil_combine_cost
Simulates exactly one anvil operation — item (the base, left slot) combined with sacrifice (the right slot), optionally renaming the result — with no search or planning involved. It's a direct simulation of a single in-game anvil use, the same way you'd read the cost off the anvil UI with two items in it. Returns the XP-level cost, feasibility, and the resulting enchantments. A book is just "id": "enchanted_book" or "id": "book", not a separate flag — item and sacrifice use the same shape either way, each carrying its own enchantments and prior-work count.
{
"item": {
"id": "diamond_sword",
"enchantments": [{ "id": "sharpness", "level": 3 }]
},
"sacrifice": {
"id": "enchanted_book",
"enchantments": [{ "id": "sharpness", "level": 4 }]
}
}For finding the cheapest multi-step path to a target enchantment set — not just one operation's cost — use anvil_migration_path instead.
anvil_migration_path
Takes two item descriptions — sourceItem (the item's current state: its enchantments, prior-work count, and name, if any) and targetItem (the desired end state). Searches for and returns the cheapest multi-step path from one to the other. sourceItem.id and targetItem.id must be the same item (an anvil can't turn one item type into another) — a mismatch is a tool error, not a silent conversion. Fails clearly if the target would require downgrading an enchantment level — a vanilla anvil can't do that. Optionally takes an availableSources array so the plan reflects books or items you actually have — including their own prior-work count — instead of assuming everything comes from a fresh book. This matters: two Unbreaking II books (say, one from a villager and one fished up) combine into Unbreaking III at a real, calculable cost that a "just assume fresh books" calculator can't give you.
{
"sourceItem": {
"id": "diamond_sword",
"enchantments": [{ "id": "sharpness", "level": 3 }]
},
"targetItem": {
"id": "diamond_sword",
"enchantments": [
{ "id": "sharpness", "level": 5 },
{ "id": "unbreaking", "level": 3 }
]
},
"availableSources": [
{ "sourceId": "book-1", "isBook": true, "enchantments": [{ "id": "unbreaking", "level": 2 }], "priorWorkCount": 0, "origin": "villager_trade" },
{ "sourceId": "book-2", "isBook": true, "enchantments": [{ "id": "unbreaking", "level": 2 }], "priorWorkCount": 0, "origin": "fishing" }
]
}Realistic sourcing: quantity, unlimited supply, and inventoryOnly
Each entry in availableSources can also declare quantity (how many identical physical copies are owned — default 1) and unlimited (true if more can always be obtained on demand, e.g. a standing villager trade — quantity is ignored when this is true). By default, anvil_migration_path also assumes any needed book/item not listed is obtainable (a fresh book) to bridge a genuine gap the declared sources can't close on their own — pass "inventoryOnly": true to disable that and get a strictly honest "can this actually be done with only what's declared" answer. If even the cheapest possible sequence busts the level cap, the tool still returns it (marked [EXCEEDS CAP] per offending step) instead of just refusing outright.
Optional: rename the item
anvil_combine_cost takes an optional newName param, diffed against item.name. anvil_migration_path's item objects each accept an optional name field — a rename is included only if targetItem.name differs from sourceItem.name (pass "" on targetItem.name to clear an existing name). Either way, renaming costs a flat +1 XP level (plus whatever prior-work penalty already applies to that operation) — the text itself never affects cost.
Editions and versions
Both tools take optional edition ("java" or "bedrock", default "java") and version params. Omit them to get the latest supported version for the edition; an unsupported combination returns a clear error listing what's actually available.
Source
The calculation engine is the same open code that powers the calculator on this site — one implementation, two consumers, so the numbers always match.