@agentutility/mcp-rollforge 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,99 @@
1
+ # @agentutility/mcp-rollforge
2
+
3
+ > The whole tabletop toolkit, one call at a time.
4
+
5
+ Dice, characters, NPCs, encounters, loot, and the full 5e SRD reference — monsters, spells, equipment, classes, races, conditions, magic items. Build a character, stat an encounter, resolve the rolls, and look up every rule without leaving the cluster.
6
+
7
+ **Pricing:** pay-per-call in USDC on Base. No subscriptions, no API keys. See per-tool prices below.
8
+
9
+ ## Install — Claude Desktop
10
+
11
+ Edit `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS) or `%APPDATA%\Claude\claude_desktop_config.json` (Windows):
12
+
13
+ ```json
14
+ {
15
+ "mcpServers": {
16
+ "agentutility-rollforge": {
17
+ "command": "npx",
18
+ "args": ["-y", "@agentutility/mcp-rollforge"],
19
+ "env": { "X402_PRIVATE_KEY": "0xYOUR_PRIVATE_KEY_HEX" }
20
+ }
21
+ }
22
+ }
23
+ ```
24
+
25
+ Restart Claude Desktop. 26 tools appear in the tool palette.
26
+
27
+ ## Install — Cursor
28
+
29
+ Add to `.cursor/mcp.json`:
30
+
31
+ ```json
32
+ {
33
+ "mcpServers": {
34
+ "agentutility-rollforge": {
35
+ "command": "npx",
36
+ "args": ["-y", "@agentutility/mcp-rollforge"],
37
+ "env": { "X402_PRIVATE_KEY": "0x..." }
38
+ }
39
+ }
40
+ }
41
+ ```
42
+
43
+ ## Funding
44
+
45
+ Send any amount of **USDC on Base mainnet** to the address derived from your `X402_PRIVATE_KEY`. The MCP server uses it to pay for tool calls automatically.
46
+
47
+ USDC on Base contract: `0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913`
48
+
49
+ ## Tools (26)
50
+
51
+ | Tool | Description |
52
+ |---|---|
53
+ | `ability-check` | (0.001 USDC/call) D20 ability check / skill check / attack roll / saving throw resolver API for tabletop RPGs. Rolls a d20 with an optional modifier and advantage/disadvantage, compares to a DC, and reports total, success/failure, and natural-20 / natural-1. Seedable. Pure deterministic compute, no upstream API. |
54
+ | `background-gen` | (0.001 USDC/call) Character background generator API / personality trait, ideal, bond, flaw generator for tabletop RPGs. Rolls the four roleplaying hooks for a character sheet — a personality trait, an ideal, a bond, and a flaw. Seedable. Pure compute, no upstream. Original generic-fantasy phrasing. |
55
+ | `character-gen` | (0.002 USDC/call) Tabletop character generator API / D&D 5e character builder / RPG character creator / random fantasy character. Generates a complete 5e-style character: ability scores (4d6-keep-highest-3, 3d6, or standard array) assigned by class priority, race / class / background / alignment, racial ability bonuses, derived hit points, ability modifiers, proficiency bonus, saving-throw proficiencies, and a procedurally generated name. Pin any field (race, class, level 1-20, method, name) or omit to randomize; pass 'seed' for a reproducible character. Pure deterministic compute, no upstream API. Uses only 5e SRD content (OGL 1.0a / CC-BY-4.0). |
56
+ | `character-portrait` | (0.08 USDC/call) Character portrait generator API / RPG character art / D&D character image / fantasy avatar generator. Builds a portrait from structured inputs — race, class, gender, a free-text description, and an art style (fantasy-art, realistic, anime, oil-painting, ink-sketch, watercolor, pixel-art, comic-book) — and renders it to a hosted PNG URL. Pairs with character-gen: generate the character, then its portrait. Text-to-image via Venice, output hosted on fal. |
57
+ | `class-lookup` | (0.003 USDC/call) D&D 5e class lookup API / SRD class reference / class proficiencies and hit dice. Look up a class by name for hit dice, armor/weapon/tool/skill proficiencies, saving throws, spellcasting ability, and starting equipment, or list all SRD classes. SRD content only (OGL 1.0a / CC-BY-4.0) via Open5e. |
58
+ | `condition-lookup` | (0.003 USDC/call) D&D 5e condition lookup API / SRD conditions reference (blinded, grappled, prone, stunned, etc.). Look up a condition by name for its full rules text, or list all SRD conditions. SRD content only (OGL 1.0a / CC-BY-4.0) via Open5e. |
59
+ | `dice-roll` | (0.001 USDC/call) Dice roller API / dice notation evaluator / RPG dice / tabletop random roll engine. Evaluates standard dice notation — XdY, flat modifiers (+/-), and keep-highest / keep-lowest (4d6kh3 for stat rolls, 2d20kh1 / 2d20kl1 for advantage/disadvantage). Returns each individual die, which were kept vs dropped, the per-roll total, and the grand total; roll the whole expression up to 100 times with 'rolls'. Pass 'seed' for reproducible output. Pure deterministic compute, no upstream API. |
60
+ | `dice-stats` | (0.002 USDC/call) Dice probability calculator API / anydice-style dice statistics / odds of a dice roll. For plain XdY+mod returns the EXACT distribution (mean, stdev, min, max, and P(>= target)); for keep-highest/lowest (4d6kh3, 2d20kl1) estimates via seeded Monte Carlo. For sizing DCs, damage, and stat rolls. Pure compute, no upstream. |
61
+ | `dungeon-room` | (0.001 USDC/call) Dungeon room generator API / random dungeon generator / D&D room description for GMs. Generates a room: shape, contents, a notable feature, a hazard, an occupant, and the number of exits. Pass 'rooms' for a small batch. Seedable. Pure compute, no upstream. |
62
+ | `encounter-builder` | (0.002 USDC/call) Encounter builder / encounter difficulty calculator API for D&D 5e. Give the party (levels, or size + level) to get easy/medium/hard/deadly XP thresholds; optionally give monster CRs to get the multiplier-adjusted XP and the resulting difficulty rating. SRD DMG tables (OGL 1.0a / CC-BY-4.0). Pure compute, no upstream. |
63
+ | `equipment-lookup` | (0.003 USDC/call) D&D 5e equipment lookup API / SRD weapons and armor / gear stats. Look up a weapon or piece of armor by name (weapon damage dice/type/properties/cost, or armor class/cost/weight/stealth), or list items by type ('weapon' or 'armor'). SRD content only (OGL 1.0a / CC-BY-4.0) via Open5e. |
64
+ | `initiative-roll` | (0.001 USDC/call) Initiative tracker / initiative order roller API for tabletop combat. Each combatant rolls 1d20 plus their initiative (DEX) modifier; returns the full turn order, ties broken by modifier then input order. Seedable. Pure deterministic compute, no upstream API. |
65
+ | `loot-gen` | (0.002 USDC/call) Loot generator / treasure generator API for D&D 5e. Rolls coins (and, for hoards, gems/art objects and a magic-item slot) scaled by a challenge-rating band. SRD-style treasure math (OGL 1.0a / CC-BY-4.0). Seedable. Pure compute, no upstream. |
66
+ | `magic-item-lookup` | (0.003 USDC/call) D&D 5e magic item lookup API / SRD magic items / wondrous item reference. Look up a magic item by name for its type, rarity, attunement, and full description, or list items filtered by rarity and/or type. SRD content only (OGL 1.0a / CC-BY-4.0) via Open5e. |
67
+ | `monster-lookup` | (0.003 USDC/call) D&D 5e monster lookup API / SRD monster stat block / bestiary search. Look up a monster by name for a compact stat block (size, type, alignment, AC, HP, hit dice, speed, ability scores, challenge rating, and actions), or list monsters filtered by challenge rating and/or type. SRD content only (OGL 1.0a / CC-BY-4.0) via Open5e. |
68
+ | `name-gen` | (0.001 USDC/call) Fantasy name generator API / RPG name generator / D&D character & NPC names / random fantasy names by race. Generates original syllable-built names, optionally flavored by race (Dwarf, Elf, Half-Orc, etc.). Batch up to 50 at once with 'count'; pass 'seed' for reproducible output. Pure deterministic compute, no upstream API. |
69
+ | `npc-gen` | (0.001 USDC/call) NPC generator API / random D&D NPC / tabletop character generator for GMs. Generates a quick non-player character: name, race, occupation, personality trait, distinctive appearance, mannerism, and a hidden secret/plot hook. Pin race or occupation, or omit to randomize. Seedable. Pure compute, no upstream. |
70
+ | `quest-gen` | (0.001 USDC/call) Quest generator API / random plot hook / D&D adventure seed generator. Generates a quest hook: giver, objective, location, complication, and reward, plus a one-line ready-to-read hook. Seedable. Pure compute, no upstream. Original generic-fantasy content. |
71
+ | `race-lookup` | (0.003 USDC/call) D&D 5e race lookup API / SRD race reference / racial traits and ability score increases. Look up a race by name for ability score increases, speed, size, languages, vision, and racial traits, or list all SRD races. SRD content only (OGL 1.0a / CC-BY-4.0) via Open5e. |
72
+ | `random-table` | (0.001 USDC/call) Random table roller API / weighted random picker / loot & rumor table roller. Roll on a caller-provided table — weighted entries ([{value, weight?}]) or classic die-range rows ([{min,max,result}] with a 'die') — any number of times, with or without replacement. Seedable. A generic random-selection utility for any custom table. Pure compute, no upstream. |
73
+ | `settlement-gen` | (0.001 USDC/call) Settlement generator API / random town generator / D&D village & city generator. Generates a settlement: name, size category with a plausible population, government, primary trade, a notable feature, and a current problem the party could engage with. Pin 'size' (hamlet/village/town/city) or randomize. Seedable. Pure compute, no upstream. |
74
+ | `spell-lookup` | (0.003 USDC/call) D&D 5e spell lookup API / SRD spell search / spell card details. Look up a spell by name for full details (level, school, casting time, range, components, duration, concentration, ritual, classes, description, higher-level scaling), or list spells filtered by level and/or school. SRD content only (OGL 1.0a / CC-BY-4.0) via Open5e. |
75
+ | `spell-slots` | (0.001 USDC/call) Spell slots by class and level API / D&D 5e spellcasting slot table / pact magic lookup. Returns the level 1-9 spell-slot array for any 5e class at a given level (full casters, half-casters like Paladin/Ranger, Warlock pact magic, and non-casters), plus proficiency bonus. SRD spellcasting tables (OGL 1.0a / CC-BY-4.0). Pure compute, no upstream. |
76
+ | `tavern-gen` | (0.001 USDC/call) Tavern generator API / random fantasy inn / D&D tavern name & details. Generates a tavern: name, proprietor, the house drink and meal, a notable patron, and a rumor overheard inside. Seedable. Pure compute, no upstream. Original generic-fantasy content. |
77
+ | `weather-gen` | (0.001 USDC/call) Fantasy weather generator API / random RPG weather / tabletop campaign weather forecast. Rolls a day's weather for a climate (temperate, arid, cold, tropical) with conditions and wind. Pass 'days' for a short forecast. Seedable. Pure compute, no upstream. |
78
+ | `xp-level` | (0.001 USDC/call) XP to level calculator / D&D 5e experience table / level from XP lookup API. Give 'xp' to get the current level, XP to the next level, and progress; or give 'level' to get the XP needed to reach it. Returns proficiency bonus. SRD advancement table (OGL/CC). Pure compute, no upstream. |
79
+
80
+ ## How it works
81
+
82
+ 1. Agent calls a tool (e.g. `ability-check`).
83
+ 2. MCP server POSTs to `https://x402.agentutility.ai/ability-check`.
84
+ 3. The endpoint responds **HTTP 402** with payment instructions.
85
+ 4. The MCP server signs an EIP-3009 USDC transfer authorization with `X402_PRIVATE_KEY` and retries.
86
+ 5. CDP facilitator settles on Base.
87
+ 6. The endpoint returns the actual response.
88
+
89
+ The agent never sees the payment flow — it just gets the result.
90
+
91
+ ## Links
92
+
93
+ - Cluster overview: https://agentutility.ai/rollforge/
94
+ - All MCP packages: https://mcp.agentutility.ai/
95
+ - Source: https://github.com/rooz21/x402/tree/main/packages/mcp-rollforge
96
+
97
+ ---
98
+
99
+ **Version:** 0.1.0 · **License:** MIT
package/dist/index.js ADDED
@@ -0,0 +1,86 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * @agentutility/mcp-<cluster> — stdio MCP server exposing the cluster's
4
+ * x402-paid endpoints as MCP tools. Forwards every CallToolRequest to
5
+ * x402.agentutility.ai, where @x402/fetch handles 402 → payment → retry
6
+ * using the agent's own wallet (X402_PRIVATE_KEY env var).
7
+ *
8
+ * Boilerplate is single-sourced at packages/_template/src/index.ts and
9
+ * copied verbatim into each packages/mcp-<cluster>/src/index.ts by
10
+ * scripts/generate-mcp-clusters.mjs. The codegen also writes a matching
11
+ * tools.generated.ts so this file imports CLUSTER_SLUG + VERSION + TOOLS
12
+ * rather than hard-coding.
13
+ *
14
+ * Required env: X402_PRIVATE_KEY (hex EVM key, USDC on Base).
15
+ * Optional env: X402_BASE_URL (default https://x402.agentutility.ai)
16
+ * X402_RPC_URL (default https://mainnet.base.org)
17
+ */
18
+ import { Server } from "@modelcontextprotocol/sdk/server/index.js";
19
+ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
20
+ import { CallToolRequestSchema, ListToolsRequestSchema, } from "@modelcontextprotocol/sdk/types.js";
21
+ import { wrapFetchWithPayment, x402Client } from "@x402/fetch";
22
+ import { ExactEvmScheme, toClientEvmSigner } from "@x402/evm";
23
+ import { privateKeyToAccount } from "viem/accounts";
24
+ import { createPublicClient, http } from "viem";
25
+ import { base } from "viem/chains";
26
+ import { TOOLS, CLUSTER_SLUG, VERSION } from "./tools.generated.js";
27
+ const BASE_URL = (process.env.X402_BASE_URL || "https://x402.agentutility.ai").replace(/\/$/, "");
28
+ const RPC_URL = process.env.X402_RPC_URL || "https://mainnet.base.org";
29
+ const PK = process.env.X402_PRIVATE_KEY;
30
+ if (!PK) {
31
+ console.error(`[@agentutility/mcp-${CLUSTER_SLUG}] FATAL: X402_PRIVATE_KEY env var is required.`);
32
+ console.error("Set it to a hex-encoded EVM private key with USDC balance on Base (chain 8453).");
33
+ console.error("USDC on Base: 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913");
34
+ process.exit(1);
35
+ }
36
+ const account = privateKeyToAccount((PK.startsWith("0x") ? PK : `0x${PK}`));
37
+ const publicClient = createPublicClient({
38
+ chain: base,
39
+ transport: http(RPC_URL),
40
+ });
41
+ const signer = toClientEvmSigner(account, publicClient);
42
+ const client = new x402Client().register("eip155:8453", new ExactEvmScheme(signer));
43
+ const paidFetch = wrapFetchWithPayment(fetch, client);
44
+ async function trackedFetch(url, init) {
45
+ const headers = new Headers(init?.headers);
46
+ headers.set("X-Agent-Channel", `mcp-stdio-${CLUSTER_SLUG}`);
47
+ headers.set("X-Agent-Id", "47167");
48
+ if (!headers.has("User-Agent")) {
49
+ headers.set("User-Agent", `agentutility-mcp/${CLUSTER_SLUG}/${VERSION}`);
50
+ }
51
+ return paidFetch(url, { ...init, headers });
52
+ }
53
+ const server = new Server({ name: `agentutility-${CLUSTER_SLUG}`, version: VERSION }, { capabilities: { tools: {} } });
54
+ server.setRequestHandler(ListToolsRequestSchema, async () => ({
55
+ tools: TOOLS.map((t) => ({
56
+ name: t.name,
57
+ description: t.description,
58
+ inputSchema: t.input_schema,
59
+ })),
60
+ }));
61
+ server.setRequestHandler(CallToolRequestSchema, async (req) => {
62
+ const name = req.params.name;
63
+ const tool = TOOLS.find((t) => t.name === name);
64
+ if (!tool) {
65
+ return { content: [{ type: "text", text: `Unknown tool: ${name}` }], isError: true };
66
+ }
67
+ try {
68
+ const res = await trackedFetch(`${BASE_URL}/${tool.http_name}`, {
69
+ method: "POST",
70
+ headers: { "Content-Type": "application/json" },
71
+ body: JSON.stringify(req.params.arguments ?? {}),
72
+ });
73
+ const body = await res.text();
74
+ if (!res.ok) {
75
+ return { content: [{ type: "text", text: `HTTP ${res.status}: ${body}` }], isError: true };
76
+ }
77
+ return { content: [{ type: "text", text: body }] };
78
+ }
79
+ catch (err) {
80
+ return {
81
+ content: [{ type: "text", text: `tool call failed: ${err instanceof Error ? err.message : String(err)}` }],
82
+ isError: true,
83
+ };
84
+ }
85
+ });
86
+ await server.connect(new StdioServerTransport());
@@ -0,0 +1,611 @@
1
+ /** Auto-generated by scripts/generate-mcp-clusters.mjs. Do not edit by hand. */
2
+ export const CLUSTER_SLUG = "rollforge";
3
+ export const VERSION = "0.1.0";
4
+ export const TOOLS = [
5
+ {
6
+ "name": "ability-check",
7
+ "http_name": "ability-check",
8
+ "description": "(0.001 USDC/call) D20 ability check / skill check / attack roll / saving throw resolver API for tabletop RPGs. Rolls a d20 with an optional modifier and advantage/disadvantage, compares to a DC, and reports total, success/failure, and natural-20 / natural-1. Seedable. Pure deterministic compute, no upstream API.",
9
+ "method": "POST",
10
+ "input_schema": {
11
+ "type": "object",
12
+ "properties": {
13
+ "dc": {
14
+ "type": "number",
15
+ "description": "Difficulty class to beat. Omit to just get the roll."
16
+ },
17
+ "modifier": {
18
+ "type": "number",
19
+ "description": "Total bonus/penalty added to the d20 (-20..40). Default 0."
20
+ },
21
+ "advantage": {
22
+ "type": "boolean",
23
+ "description": "Roll twice, take the higher."
24
+ },
25
+ "disadvantage": {
26
+ "type": "boolean",
27
+ "description": "Roll twice, take the lower."
28
+ },
29
+ "seed": {
30
+ "type": "number",
31
+ "description": "Optional integer seed for a reproducible roll."
32
+ }
33
+ }
34
+ }
35
+ },
36
+ {
37
+ "name": "background-gen",
38
+ "http_name": "background-gen",
39
+ "description": "(0.001 USDC/call) Character background generator API / personality trait, ideal, bond, flaw generator for tabletop RPGs. Rolls the four roleplaying hooks for a character sheet — a personality trait, an ideal, a bond, and a flaw. Seedable. Pure compute, no upstream. Original generic-fantasy phrasing.",
40
+ "method": "POST",
41
+ "input_schema": {
42
+ "type": "object",
43
+ "properties": {
44
+ "seed": {
45
+ "type": "number",
46
+ "description": "Optional integer seed."
47
+ }
48
+ }
49
+ }
50
+ },
51
+ {
52
+ "name": "character-gen",
53
+ "http_name": "character-gen",
54
+ "description": "(0.002 USDC/call) Tabletop character generator API / D&D 5e character builder / RPG character creator / random fantasy character. Generates a complete 5e-style character: ability scores (4d6-keep-highest-3, 3d6, or standard array) assigned by class priority, race / class / background / alignment, racial ability bonuses, derived hit points, ability modifiers, proficiency bonus, saving-throw proficiencies, and a procedurally generated name. Pin any field (race, class, level 1-20, method, name) or omit to randomize; pass 'seed' for a reproducible character. Pure deterministic compute, no upstream API. Uses only 5e SRD content (OGL 1.0a / CC-BY-4.0).",
55
+ "method": "POST",
56
+ "input_schema": {
57
+ "type": "object",
58
+ "properties": {
59
+ "race": {
60
+ "type": "string",
61
+ "description": "SRD race: Human, Elf, Dwarf, Halfling, Dragonborn, Gnome, Half-Elf, Half-Orc, Tiefling. Omit to randomize."
62
+ },
63
+ "class": {
64
+ "type": "string",
65
+ "description": "SRD class: Barbarian, Bard, Cleric, Druid, Fighter, Monk, Paladin, Ranger, Rogue, Sorcerer, Warlock, Wizard. Omit to randomize."
66
+ },
67
+ "level": {
68
+ "type": "number",
69
+ "description": "Character level 1-20. Default 1."
70
+ },
71
+ "method": {
72
+ "type": "string",
73
+ "description": "Ability score method: 4d6kh3 (default), 3d6, or standard-array."
74
+ },
75
+ "name": {
76
+ "type": "string",
77
+ "description": "Optional fixed name; omit to generate one."
78
+ },
79
+ "seed": {
80
+ "type": "number",
81
+ "description": "Optional integer seed for a reproducible character."
82
+ }
83
+ }
84
+ }
85
+ },
86
+ {
87
+ "name": "character-portrait",
88
+ "http_name": "character-portrait",
89
+ "description": "(0.08 USDC/call) Character portrait generator API / RPG character art / D&D character image / fantasy avatar generator. Builds a portrait from structured inputs — race, class, gender, a free-text description, and an art style (fantasy-art, realistic, anime, oil-painting, ink-sketch, watercolor, pixel-art, comic-book) — and renders it to a hosted PNG URL. Pairs with character-gen: generate the character, then its portrait. Text-to-image via Venice, output hosted on fal.",
90
+ "method": "POST",
91
+ "input_schema": {
92
+ "type": "object",
93
+ "properties": {
94
+ "race": {
95
+ "type": "string",
96
+ "description": "Character race, e.g. 'Elf', 'Half-Orc'."
97
+ },
98
+ "class": {
99
+ "type": "string",
100
+ "description": "Character class, e.g. 'Wizard', 'Rogue'."
101
+ },
102
+ "gender": {
103
+ "type": "string",
104
+ "description": "Optional gender/presentation descriptor."
105
+ },
106
+ "description": {
107
+ "type": "string",
108
+ "description": "Free-text details: appearance, gear, mood, setting."
109
+ },
110
+ "style": {
111
+ "type": "string",
112
+ "description": "Art style: fantasy-art (default), realistic, anime, oil-painting, ink-sketch, watercolor, pixel-art, comic-book."
113
+ },
114
+ "seed": {
115
+ "type": "number",
116
+ "description": "Optional integer seed for reproducibility."
117
+ }
118
+ }
119
+ }
120
+ },
121
+ {
122
+ "name": "class-lookup",
123
+ "http_name": "class-lookup",
124
+ "description": "(0.003 USDC/call) D&D 5e class lookup API / SRD class reference / class proficiencies and hit dice. Look up a class by name for hit dice, armor/weapon/tool/skill proficiencies, saving throws, spellcasting ability, and starting equipment, or list all SRD classes. SRD content only (OGL 1.0a / CC-BY-4.0) via Open5e.",
125
+ "method": "POST",
126
+ "input_schema": {
127
+ "type": "object",
128
+ "properties": {
129
+ "name": {
130
+ "type": "string",
131
+ "description": "Class name, e.g. 'Wizard'. Omit to list all classes."
132
+ }
133
+ }
134
+ }
135
+ },
136
+ {
137
+ "name": "condition-lookup",
138
+ "http_name": "condition-lookup",
139
+ "description": "(0.003 USDC/call) D&D 5e condition lookup API / SRD conditions reference (blinded, grappled, prone, stunned, etc.). Look up a condition by name for its full rules text, or list all SRD conditions. SRD content only (OGL 1.0a / CC-BY-4.0) via Open5e.",
140
+ "method": "POST",
141
+ "input_schema": {
142
+ "type": "object",
143
+ "properties": {
144
+ "name": {
145
+ "type": "string",
146
+ "description": "Condition name, e.g. 'Grappled'. Omit to list all conditions."
147
+ }
148
+ }
149
+ }
150
+ },
151
+ {
152
+ "name": "dice-roll",
153
+ "http_name": "dice-roll",
154
+ "description": "(0.001 USDC/call) Dice roller API / dice notation evaluator / RPG dice / tabletop random roll engine. Evaluates standard dice notation — XdY, flat modifiers (+/-), and keep-highest / keep-lowest (4d6kh3 for stat rolls, 2d20kh1 / 2d20kl1 for advantage/disadvantage). Returns each individual die, which were kept vs dropped, the per-roll total, and the grand total; roll the whole expression up to 100 times with 'rolls'. Pass 'seed' for reproducible output. Pure deterministic compute, no upstream API.",
155
+ "method": "POST",
156
+ "input_schema": {
157
+ "type": "object",
158
+ "properties": {
159
+ "notation": {
160
+ "type": "string",
161
+ "description": "Dice notation: 1d20, 3d6+2, 4d6kh3 (keep highest 3), 2d20kl1 (keep lowest 1)."
162
+ },
163
+ "rolls": {
164
+ "type": "number",
165
+ "description": "How many times to evaluate the whole expression. 1-100, default 1."
166
+ },
167
+ "seed": {
168
+ "type": "number",
169
+ "description": "Optional integer seed for reproducible rolls."
170
+ }
171
+ },
172
+ "required": [
173
+ "notation"
174
+ ]
175
+ }
176
+ },
177
+ {
178
+ "name": "dice-stats",
179
+ "http_name": "dice-stats",
180
+ "description": "(0.002 USDC/call) Dice probability calculator API / anydice-style dice statistics / odds of a dice roll. For plain XdY+mod returns the EXACT distribution (mean, stdev, min, max, and P(>= target)); for keep-highest/lowest (4d6kh3, 2d20kl1) estimates via seeded Monte Carlo. For sizing DCs, damage, and stat rolls. Pure compute, no upstream.",
181
+ "method": "POST",
182
+ "input_schema": {
183
+ "type": "object",
184
+ "properties": {
185
+ "notation": {
186
+ "type": "string",
187
+ "description": "Dice notation: 2d6+3, 1d20, 4d6kh3, 2d20kl1."
188
+ },
189
+ "target": {
190
+ "type": "number",
191
+ "description": "Optional target; returns probability of rolling at least this."
192
+ },
193
+ "trials": {
194
+ "type": "number",
195
+ "description": "Monte-Carlo trials for keep-variants (1000-200000, default 50000)."
196
+ },
197
+ "seed": {
198
+ "type": "number",
199
+ "description": "Optional integer seed for the Monte-Carlo case."
200
+ }
201
+ },
202
+ "required": [
203
+ "notation"
204
+ ]
205
+ }
206
+ },
207
+ {
208
+ "name": "dungeon-room",
209
+ "http_name": "dungeon-room",
210
+ "description": "(0.001 USDC/call) Dungeon room generator API / random dungeon generator / D&D room description for GMs. Generates a room: shape, contents, a notable feature, a hazard, an occupant, and the number of exits. Pass 'rooms' for a small batch. Seedable. Pure compute, no upstream.",
211
+ "method": "POST",
212
+ "input_schema": {
213
+ "type": "object",
214
+ "properties": {
215
+ "rooms": {
216
+ "type": "number",
217
+ "description": "How many rooms to generate, 1-20. Default 1."
218
+ },
219
+ "seed": {
220
+ "type": "number",
221
+ "description": "Optional integer seed."
222
+ }
223
+ }
224
+ }
225
+ },
226
+ {
227
+ "name": "encounter-builder",
228
+ "http_name": "encounter-builder",
229
+ "description": "(0.002 USDC/call) Encounter builder / encounter difficulty calculator API for D&D 5e. Give the party (levels, or size + level) to get easy/medium/hard/deadly XP thresholds; optionally give monster CRs to get the multiplier-adjusted XP and the resulting difficulty rating. SRD DMG tables (OGL 1.0a / CC-BY-4.0). Pure compute, no upstream.",
230
+ "method": "POST",
231
+ "input_schema": {
232
+ "type": "object",
233
+ "properties": {
234
+ "party_levels": {
235
+ "type": "array",
236
+ "description": "Array of character levels, e.g. [3,3,4,2]."
237
+ },
238
+ "party_size": {
239
+ "type": "number",
240
+ "description": "Number of characters (use with party_level if levels are uniform)."
241
+ },
242
+ "party_level": {
243
+ "type": "number",
244
+ "description": "Shared character level (use with party_size)."
245
+ },
246
+ "monster_crs": {
247
+ "type": "array",
248
+ "description": "Optional monster challenge ratings, e.g. [\"1\",\"1/2\",\"2\"], to rate the encounter."
249
+ }
250
+ }
251
+ }
252
+ },
253
+ {
254
+ "name": "equipment-lookup",
255
+ "http_name": "equipment-lookup",
256
+ "description": "(0.003 USDC/call) D&D 5e equipment lookup API / SRD weapons and armor / gear stats. Look up a weapon or piece of armor by name (weapon damage dice/type/properties/cost, or armor class/cost/weight/stealth), or list items by type ('weapon' or 'armor'). SRD content only (OGL 1.0a / CC-BY-4.0) via Open5e.",
257
+ "method": "POST",
258
+ "input_schema": {
259
+ "type": "object",
260
+ "properties": {
261
+ "name": {
262
+ "type": "string",
263
+ "description": "Item name, e.g. 'Longsword' or 'Breastplate'."
264
+ },
265
+ "type": {
266
+ "type": "string",
267
+ "description": "List a category: 'weapon' or 'armor'."
268
+ },
269
+ "limit": {
270
+ "type": "number",
271
+ "description": "Max results when listing, 1-60. Default 30."
272
+ }
273
+ }
274
+ }
275
+ },
276
+ {
277
+ "name": "initiative-roll",
278
+ "http_name": "initiative-roll",
279
+ "description": "(0.001 USDC/call) Initiative tracker / initiative order roller API for tabletop combat. Each combatant rolls 1d20 plus their initiative (DEX) modifier; returns the full turn order, ties broken by modifier then input order. Seedable. Pure deterministic compute, no upstream API.",
280
+ "method": "POST",
281
+ "input_schema": {
282
+ "type": "object",
283
+ "properties": {
284
+ "combatants": {
285
+ "type": "array",
286
+ "description": "Array of { name?, modifier? } — one per combatant (max 50)."
287
+ },
288
+ "seed": {
289
+ "type": "number",
290
+ "description": "Optional integer seed for reproducible rolls."
291
+ }
292
+ },
293
+ "required": [
294
+ "combatants"
295
+ ]
296
+ }
297
+ },
298
+ {
299
+ "name": "loot-gen",
300
+ "http_name": "loot-gen",
301
+ "description": "(0.002 USDC/call) Loot generator / treasure generator API for D&D 5e. Rolls coins (and, for hoards, gems/art objects and a magic-item slot) scaled by a challenge-rating band. SRD-style treasure math (OGL 1.0a / CC-BY-4.0). Seedable. Pure compute, no upstream.",
302
+ "method": "POST",
303
+ "input_schema": {
304
+ "type": "object",
305
+ "properties": {
306
+ "challenge_rating": {
307
+ "type": "number",
308
+ "description": "Encounter/monster CR (0-30) to scale the treasure. Default 1."
309
+ },
310
+ "hoard": {
311
+ "type": "boolean",
312
+ "description": "Generate a treasure hoard (coins + gems/art + magic items) instead of individual coins."
313
+ },
314
+ "seed": {
315
+ "type": "number",
316
+ "description": "Optional integer seed for reproducible loot."
317
+ }
318
+ }
319
+ }
320
+ },
321
+ {
322
+ "name": "magic-item-lookup",
323
+ "http_name": "magic-item-lookup",
324
+ "description": "(0.003 USDC/call) D&D 5e magic item lookup API / SRD magic items / wondrous item reference. Look up a magic item by name for its type, rarity, attunement, and full description, or list items filtered by rarity and/or type. SRD content only (OGL 1.0a / CC-BY-4.0) via Open5e.",
325
+ "method": "POST",
326
+ "input_schema": {
327
+ "type": "object",
328
+ "properties": {
329
+ "name": {
330
+ "type": "string",
331
+ "description": "Magic item name, e.g. 'Bag of Holding'."
332
+ },
333
+ "rarity": {
334
+ "type": "string",
335
+ "description": "Filter list by rarity: common, uncommon, rare, very rare, legendary."
336
+ },
337
+ "type": {
338
+ "type": "string",
339
+ "description": "Filter list by type, e.g. 'Wondrous item', 'Weapon', 'Armor'."
340
+ },
341
+ "limit": {
342
+ "type": "number",
343
+ "description": "Max results when listing, 1-50. Default 20."
344
+ }
345
+ }
346
+ }
347
+ },
348
+ {
349
+ "name": "monster-lookup",
350
+ "http_name": "monster-lookup",
351
+ "description": "(0.003 USDC/call) D&D 5e monster lookup API / SRD monster stat block / bestiary search. Look up a monster by name for a compact stat block (size, type, alignment, AC, HP, hit dice, speed, ability scores, challenge rating, and actions), or list monsters filtered by challenge rating and/or type. SRD content only (OGL 1.0a / CC-BY-4.0) via Open5e.",
352
+ "method": "POST",
353
+ "input_schema": {
354
+ "type": "object",
355
+ "properties": {
356
+ "name": {
357
+ "type": "string",
358
+ "description": "Monster name for a full stat block, e.g. 'Goblin'."
359
+ },
360
+ "challenge_rating": {
361
+ "type": "string",
362
+ "description": "Filter list by CR: 0, 1/8, 1/4, 1/2, or an integer 1-30."
363
+ },
364
+ "type": {
365
+ "type": "string",
366
+ "description": "Filter list by creature type, e.g. Dragon, Undead, Beast."
367
+ },
368
+ "limit": {
369
+ "type": "number",
370
+ "description": "Max results when listing, 1-40. Default 20."
371
+ }
372
+ }
373
+ }
374
+ },
375
+ {
376
+ "name": "name-gen",
377
+ "http_name": "name-gen",
378
+ "description": "(0.001 USDC/call) Fantasy name generator API / RPG name generator / D&D character & NPC names / random fantasy names by race. Generates original syllable-built names, optionally flavored by race (Dwarf, Elf, Half-Orc, etc.). Batch up to 50 at once with 'count'; pass 'seed' for reproducible output. Pure deterministic compute, no upstream API.",
379
+ "method": "POST",
380
+ "input_schema": {
381
+ "type": "object",
382
+ "properties": {
383
+ "count": {
384
+ "type": "number",
385
+ "description": "How many names to generate, 1-50. Default 5."
386
+ },
387
+ "race": {
388
+ "type": "string",
389
+ "description": "Optional race flavor: Human, Elf, Dwarf, Halfling, Dragonborn, Gnome, Half-Elf, Half-Orc, Tiefling."
390
+ },
391
+ "seed": {
392
+ "type": "number",
393
+ "description": "Optional integer seed for reproducible names."
394
+ }
395
+ }
396
+ }
397
+ },
398
+ {
399
+ "name": "npc-gen",
400
+ "http_name": "npc-gen",
401
+ "description": "(0.001 USDC/call) NPC generator API / random D&D NPC / tabletop character generator for GMs. Generates a quick non-player character: name, race, occupation, personality trait, distinctive appearance, mannerism, and a hidden secret/plot hook. Pin race or occupation, or omit to randomize. Seedable. Pure compute, no upstream.",
402
+ "method": "POST",
403
+ "input_schema": {
404
+ "type": "object",
405
+ "properties": {
406
+ "race": {
407
+ "type": "string",
408
+ "description": "Optional race: Human, Elf, Dwarf, Halfling, Dragonborn, Gnome, Half-Elf, Half-Orc, Tiefling."
409
+ },
410
+ "occupation": {
411
+ "type": "string",
412
+ "description": "Optional occupation to pin (e.g. blacksmith). Omit to randomize."
413
+ },
414
+ "seed": {
415
+ "type": "number",
416
+ "description": "Optional integer seed for a reproducible NPC."
417
+ }
418
+ }
419
+ }
420
+ },
421
+ {
422
+ "name": "quest-gen",
423
+ "http_name": "quest-gen",
424
+ "description": "(0.001 USDC/call) Quest generator API / random plot hook / D&D adventure seed generator. Generates a quest hook: giver, objective, location, complication, and reward, plus a one-line ready-to-read hook. Seedable. Pure compute, no upstream. Original generic-fantasy content.",
425
+ "method": "POST",
426
+ "input_schema": {
427
+ "type": "object",
428
+ "properties": {
429
+ "seed": {
430
+ "type": "number",
431
+ "description": "Optional integer seed."
432
+ }
433
+ }
434
+ }
435
+ },
436
+ {
437
+ "name": "race-lookup",
438
+ "http_name": "race-lookup",
439
+ "description": "(0.003 USDC/call) D&D 5e race lookup API / SRD race reference / racial traits and ability score increases. Look up a race by name for ability score increases, speed, size, languages, vision, and racial traits, or list all SRD races. SRD content only (OGL 1.0a / CC-BY-4.0) via Open5e.",
440
+ "method": "POST",
441
+ "input_schema": {
442
+ "type": "object",
443
+ "properties": {
444
+ "name": {
445
+ "type": "string",
446
+ "description": "Race name, e.g. 'Elf'. Omit to list all races."
447
+ }
448
+ }
449
+ }
450
+ },
451
+ {
452
+ "name": "random-table",
453
+ "http_name": "random-table",
454
+ "description": "(0.001 USDC/call) Random table roller API / weighted random picker / loot & rumor table roller. Roll on a caller-provided table — weighted entries ([{value, weight?}]) or classic die-range rows ([{min,max,result}] with a 'die') — any number of times, with or without replacement. Seedable. A generic random-selection utility for any custom table. Pure compute, no upstream.",
455
+ "method": "POST",
456
+ "input_schema": {
457
+ "type": "object",
458
+ "properties": {
459
+ "entries": {
460
+ "type": "array",
461
+ "description": "Weighted entries: [{ value, weight? }]. Use this OR table+die."
462
+ },
463
+ "table": {
464
+ "type": "array",
465
+ "description": "Die-range rows: [{ min, max, result }]. Requires 'die'."
466
+ },
467
+ "die": {
468
+ "type": "number",
469
+ "description": "Die sides for a range table (e.g. 100 for a d100 table)."
470
+ },
471
+ "rolls": {
472
+ "type": "number",
473
+ "description": "How many results to draw, 1-100. Default 1."
474
+ },
475
+ "unique": {
476
+ "type": "boolean",
477
+ "description": "Draw without replacement."
478
+ },
479
+ "seed": {
480
+ "type": "number",
481
+ "description": "Optional integer seed."
482
+ }
483
+ }
484
+ }
485
+ },
486
+ {
487
+ "name": "settlement-gen",
488
+ "http_name": "settlement-gen",
489
+ "description": "(0.001 USDC/call) Settlement generator API / random town generator / D&D village & city generator. Generates a settlement: name, size category with a plausible population, government, primary trade, a notable feature, and a current problem the party could engage with. Pin 'size' (hamlet/village/town/city) or randomize. Seedable. Pure compute, no upstream.",
490
+ "method": "POST",
491
+ "input_schema": {
492
+ "type": "object",
493
+ "properties": {
494
+ "size": {
495
+ "type": "string",
496
+ "description": "Optional: hamlet, village, town, or city. Omit to randomize."
497
+ },
498
+ "seed": {
499
+ "type": "number",
500
+ "description": "Optional integer seed."
501
+ }
502
+ }
503
+ }
504
+ },
505
+ {
506
+ "name": "spell-lookup",
507
+ "http_name": "spell-lookup",
508
+ "description": "(0.003 USDC/call) D&D 5e spell lookup API / SRD spell search / spell card details. Look up a spell by name for full details (level, school, casting time, range, components, duration, concentration, ritual, classes, description, higher-level scaling), or list spells filtered by level and/or school. SRD content only (OGL 1.0a / CC-BY-4.0) via Open5e.",
509
+ "method": "POST",
510
+ "input_schema": {
511
+ "type": "object",
512
+ "properties": {
513
+ "name": {
514
+ "type": "string",
515
+ "description": "Spell name for full details, e.g. 'Fireball'."
516
+ },
517
+ "level": {
518
+ "type": "number",
519
+ "description": "Filter list by spell level 0-9 (0 = cantrip)."
520
+ },
521
+ "school": {
522
+ "type": "string",
523
+ "description": "Filter list by school, e.g. evocation, abjuration."
524
+ },
525
+ "limit": {
526
+ "type": "number",
527
+ "description": "Max results when listing, 1-50. Default 20."
528
+ }
529
+ }
530
+ }
531
+ },
532
+ {
533
+ "name": "spell-slots",
534
+ "http_name": "spell-slots",
535
+ "description": "(0.001 USDC/call) Spell slots by class and level API / D&D 5e spellcasting slot table / pact magic lookup. Returns the level 1-9 spell-slot array for any 5e class at a given level (full casters, half-casters like Paladin/Ranger, Warlock pact magic, and non-casters), plus proficiency bonus. SRD spellcasting tables (OGL 1.0a / CC-BY-4.0). Pure compute, no upstream.",
536
+ "method": "POST",
537
+ "input_schema": {
538
+ "type": "object",
539
+ "properties": {
540
+ "class": {
541
+ "type": "string",
542
+ "description": "5e class: Bard, Cleric, Druid, Sorcerer, Wizard, Warlock, Paladin, Ranger, Barbarian, Fighter, Monk, Rogue."
543
+ },
544
+ "level": {
545
+ "type": "number",
546
+ "description": "Class level 1-20. Default 1."
547
+ }
548
+ },
549
+ "required": [
550
+ "class"
551
+ ]
552
+ }
553
+ },
554
+ {
555
+ "name": "tavern-gen",
556
+ "http_name": "tavern-gen",
557
+ "description": "(0.001 USDC/call) Tavern generator API / random fantasy inn / D&D tavern name & details. Generates a tavern: name, proprietor, the house drink and meal, a notable patron, and a rumor overheard inside. Seedable. Pure compute, no upstream. Original generic-fantasy content.",
558
+ "method": "POST",
559
+ "input_schema": {
560
+ "type": "object",
561
+ "properties": {
562
+ "seed": {
563
+ "type": "number",
564
+ "description": "Optional integer seed."
565
+ }
566
+ }
567
+ }
568
+ },
569
+ {
570
+ "name": "weather-gen",
571
+ "http_name": "weather-gen",
572
+ "description": "(0.001 USDC/call) Fantasy weather generator API / random RPG weather / tabletop campaign weather forecast. Rolls a day's weather for a climate (temperate, arid, cold, tropical) with conditions and wind. Pass 'days' for a short forecast. Seedable. Pure compute, no upstream.",
573
+ "method": "POST",
574
+ "input_schema": {
575
+ "type": "object",
576
+ "properties": {
577
+ "climate": {
578
+ "type": "string",
579
+ "description": "temperate (default), arid, cold, or tropical."
580
+ },
581
+ "days": {
582
+ "type": "number",
583
+ "description": "Days to forecast, 1-14. Default 1."
584
+ },
585
+ "seed": {
586
+ "type": "number",
587
+ "description": "Optional integer seed."
588
+ }
589
+ }
590
+ }
591
+ },
592
+ {
593
+ "name": "xp-level",
594
+ "http_name": "xp-level",
595
+ "description": "(0.001 USDC/call) XP to level calculator / D&D 5e experience table / level from XP lookup API. Give 'xp' to get the current level, XP to the next level, and progress; or give 'level' to get the XP needed to reach it. Returns proficiency bonus. SRD advancement table (OGL/CC). Pure compute, no upstream.",
596
+ "method": "POST",
597
+ "input_schema": {
598
+ "type": "object",
599
+ "properties": {
600
+ "xp": {
601
+ "type": "number",
602
+ "description": "Total experience points; returns the level it maps to."
603
+ },
604
+ "level": {
605
+ "type": "number",
606
+ "description": "Level 1-20; returns the XP needed to reach it."
607
+ }
608
+ }
609
+ }
610
+ }
611
+ ];
package/package.json ADDED
@@ -0,0 +1,46 @@
1
+ {
2
+ "name": "@agentutility/mcp-rollforge",
3
+ "version": "0.1.0",
4
+ "description": "MCP server for the @agentutility rollforge cluster — pay-per-call x402 tools, no API keys, USDC on Base.",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "main": "dist/index.js",
8
+ "bin": {
9
+ "agentutility-mcp-rollforge": "dist/index.js"
10
+ },
11
+ "files": [
12
+ "dist",
13
+ "README.md"
14
+ ],
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "https://github.com/rooz21/x402",
18
+ "directory": "packages/mcp-rollforge"
19
+ },
20
+ "homepage": "https://mcp.agentutility.ai/rollforge/",
21
+ "scripts": {
22
+ "build": "tsc",
23
+ "prepublishOnly": "npm run build"
24
+ },
25
+ "keywords": [
26
+ "mcp",
27
+ "model-context-protocol",
28
+ "x402",
29
+ "agentutility",
30
+ "agent-tools",
31
+ "rollforge"
32
+ ],
33
+ "dependencies": {
34
+ "@modelcontextprotocol/sdk": "^1.0.4",
35
+ "@x402/fetch": "^2.12.0",
36
+ "@x402/evm": "^2.12.0",
37
+ "viem": "^2.21.0"
38
+ },
39
+ "devDependencies": {
40
+ "@types/node": "^22.0.0",
41
+ "typescript": "^5.5.0"
42
+ },
43
+ "engines": {
44
+ "node": ">=18"
45
+ }
46
+ }