Skip to main content
Glama
DrVelvetFog

kaspa-script-mcp

by DrVelvetFog

kaspa-script-mcp

An MCP server with tooling for Kaspa's Toccata-era script/covenant layer. Pure TypeScript, no node or SDK dependency at runtime — the opcode table and pricing constants are generated from rusty-kaspa v2.1.0 (commit 01b532e).

Tools

  • disassemble_script — hex → opcodes + data pushes, the way the engine's parser walks it; flags disabled/reserved opcodes and truncated pushes.

  • estimate_script_cost — approximate script units, compute-mass grams, share of the 500,000-gram block compute limit, and the minimum per-input compute budget to commit. Size a budget before signing to avoid ExceededCommittedScriptUnits.

  • explain_script_error — plain-language explanation + fix for txscript errors (metering, stack, opcode, push-encoding, ZK integrity).

  • lookup_opcode — by hex code or name.

Related MCP server: Casper Network MCP Server

Build & run

npm install && npm run build
node dist/selftest.js   # 17 checks
node dist/index.js      # stdio MCP server

Client config (Claude Code / desktop)

{ "mcpServers": { "kaspa-script": { "command": "node", "args": ["<path>/kaspa-script-mcp/dist/index.js"] } } }

Scope & honesty

estimate_script_cost is an estimate of the dominant charges (per-byte, pushed bytes, hash opcodes, fixed ZK costs), not the consensus value; ZK per-public-input VK pricing isn't fully derivable statically and is flagged in the output. The opcode table and constants are pinned to a specific rusty-kaspa commit; regenerate on consensus changes.

License

MIT

Available Tools

4 tools
disassemble_scriptA

Disassemble a Kaspa (rusty-kaspa v2.1.0 / Toccata) script from hex into opcodes and data pushes, exactly as the engine's parser walks it. Flags disabled/reserved opcodes and truncated pushes.

ParametersJSON Schema
NameRequiredDescriptionDefault
script_hexYesScript bytes as hex (0x-prefixed or bare).

TDQS

A4.2/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It discloses meaningful behavior beyond a simple summary: it follows the exact engine parser semantics and flags disabled/reserved opcodes and truncated pushes. It does not cover invalid-hex handling or output shape, but the disclosed edge cases add genuine value.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences with no filler. The first states the core function and resource; the second adds important edge-case behavior. Everything present earns its place and is front-loaded.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With one required parameter and no output schema, the description gives enough detail for an agent to know what input to supply and what special cases to expect. It does not explicitly describe the return structure, but 'into opcodes and data pushes' already implies the primary output shape.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% because the only parameter, script_hex, is described as hex and whether 0x-prefixing is allowed. The description adds the 'from hex' framing but does not materially expand on the schema's parameter documentation, so the baseline of 3 applies.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Uses a specific verb ('Disassemble') and a specific resource ('Kaspa script from hex into opcodes and data pushes'). The action is unambiguous and clearly distinct from sibling tools like estimate_script_cost, explain_script_error, and lookup_opcode.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description gives a clear context for use: disassembling a script into its parser-visible opcodes and pushes. It does not explicitly name alternatives or state when not to use this tool, but the verb and scope make the intended use obvious enough.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

estimate_script_costA

Estimate a Kaspa script's compute cost: script units, compute-mass grams, share of the 500,000-gram block compute limit, and the minimum per-input compute budget to commit. Approximate; use it to size a compute budget before signing and to avoid ExceededCommittedScriptUnits.

ParametersJSON Schema
NameRequiredDescriptionDefault
script_hexYesScript bytes as hex.

TDQS

A4.2/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden. It discloses that the estimate is 'Approximate' and that it is meant for pre-signing budget sizing, implying no side effects. It could add more about what happens on invalid hex or exactness, but the key behavioral trait is well covered.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences, no filler. The output list is front-loaded, and the approximate nature and use case follow immediately. Every sentence earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

No output schema exists, so the description compensates by listing the returned values: script units, compute-mass grams, share of the block limit, and minimum per-input budget. It omits potential error handling for invalid scripts, but for a single-parameter estimator this is quite complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the baseline is 3. The description adds little beyond 'script_hex' being the script to estimate; it doesn't clarify encoding or edge cases. This matches the baseline exactly.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a specific verb ('Estimate') and a specific resource ('Kaspa script's compute cost'), then enumerates the concrete outputs. It is clearly distinct from siblings like disassemble_script, explain_script_error, and lookup_opcode, which target different operations.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description gives clear usage context: 'use it to size a compute budget before signing and to avoid ExceededCommittedScriptUnits.' It doesn't explicitly say when not to use or name alternatives, but the intended scenario is clear and non-overlapping with the sibling tools.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

explain_script_errorA

Explain a rusty-kaspa txscript error message (e.g. 'script units exceeded...', 'stack contains N unexpected items', 'ZK Integrity: ...', disabled-opcode, push-encoding errors) in plain terms with a concrete fix.

ParametersJSON Schema
NameRequiredDescriptionDefault
error_textYesThe exact error string from the node or SDK.

TDQS

A4.4/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states that the tool returns a plain-term explanation and a concrete fix, which conveys the read-only nature (it does not modify anything). It does not explicitly declare non-mutation, but the verb 'explain' and the context strongly imply it. Minor gap: no mention of any side effects or dependencies, but the behavior is clear.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, well-structured sentence that front-loads the purpose and includes illustrative examples. Every word earns its place; no filler or repetition. It is appropriately concise for a simple tool.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a one-parameter tool with no output schema, the description is nearly complete. It explains what the tool does, gives examples of handled errors, and mentions the fix output. It does not specify the exact return format (e.g., plain text vs JSON), but that is not critical given the absence of an output schema. The description covers all essential information for an agent to use the tool correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema already documents the single parameter (error_text) with 100% coverage. The description adds value beyond the schema by specifying that the error string should be the 'exact error string from the node or SDK' and providing concrete error examples that clarify acceptable inputs. This enhances parameter understanding without redundancy.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states a specific verb (explain) and resource (rusty-kaspa txscript error message) with concrete examples of error types it handles. This distinguishes it from sibling tools like disassemble_script, estimate_script_cost, and lookup_opcode, which have different purposes.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage context: when you have an error string and need a plain explanation with a fix. It provides examples of applicable error categories, which helps the agent identify relevant scenarios. It does not explicitly mention alternatives or when-not-to-use, but the purpose is specific enough.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

lookup_opcodeA

Look up a Kaspa opcode by hex code (e.g. '0xa8') or by name (e.g. 'OpSHA256'). Returns code, name, disabled/illegal status.

ParametersJSON Schema
NameRequiredDescriptionDefault
queryYesOpcode hex code or name.

TDQS

A4/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations present, the description carries the full burden. It discloses the return payload (code, name, disabled/illegal status), which is the core behavioral trait for a lookup. It does not describe error handling, case sensitivity, or behavior for unknown/illegal opcodes, but for a simple lookup the stated return values provide adequate transparency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

One concise sentence that front-loads the action and resource, includes examples, and lists the return fields. Every clause earns its place with no repetition or filler.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a single-parameter lookup tool with no output schema, the description covers the essential information: what the tool does, acceptable inputs, and the shape of the result. The main omission is behavior for invalid or unknown queries, but this is a minor gap for such a simple operation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% since the query parameter has its own description. The description adds value beyond the schema by providing concrete examples ('0xa8', 'OpSHA256') and clarifying that both hex and name forms are accepted, which reduces ambiguity about input formatting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a specific verb ('look up'), a clear resource ('Kaspa opcode'), and the two accepted input formats (hex code or name). It also names the output fields (code, name, disabled/illegal status), making the tool's purpose unmistakable and distinct from siblings like disassemble_script or explain_script_error.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description gives clear input-format guidance (hex or name with examples), which helps the agent formulate the query. However, it does not explicitly say when to use this tool versus siblings, such as when a disassembly or cost estimate is needed instead. Usage context is implied rather than stated.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 4 tool updatesv0.1.0
    • First observeddisassemble_script
    • First observedestimate_script_cost
    • First observedexplain_script_error
    • First observedlookup_opcode

TDQS

A4.4/5.0

Scored across 4 tools

Disambiguation5/5

Each tool has a clearly distinct purpose: disassembling scripts, estimating cost, explaining errors, and looking up opcodes. There is no meaningful overlap between any of the four tools.

Naming Consistency5/5

All tool names follow a consistent verb_noun snake_case pattern: disassemble_script, estimate_script_cost, explain_script_error, lookup_opcode. This makes the toolset predictable and easy for an agent to navigate.

Tool Count5/5

Four tools is an appropriately scoped size for a focused diagnostic utility server. Each tool handles a distinct part of the script analysis workflow without bloat or redundancy.

Completeness5/5

The toolset covers the full diagnostic lifecycle for Kaspa scripts: disassembly, cost estimation, error explanation, and opcode reference. There are no obvious dead ends for the server's apparent purpose.

Maintenance

ActivityMaintained
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers