Skip to main content
Glama

Diogenes Web3, DeFi & 402 Security MCP

Solana Anchor & Rust Cross-Program Invocation (CPI) Vulnerability Scanner

scan_solana_cpi_reentrancy
Read-onlyIdempotent

Scans Solana Anchor and native Rust program instructions for unverified Cross-Program Invocation (CPI) program IDs, missing signer checks, and PDA bump seed canonicalization bugs. Use when auditing Solana Rust/Anchor source code or instruction account structs for CPI privilege escalation; for checking live SPL token mint/freeze authorities and rug-pull risk by mint address, use evaluate_solana_token_risk instead. Read-only edge call (32 KB, 60 RPM): accepts 'rust_source_or_idl' ('framework' defaults to 'anchor'), uses '?demo=true' or L402 (30 sats); HTTP 400 if invalid.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "rust_source_or_idl": "<rust_source_or_idl>"
    },
    "name": "scan_solana_cpi_reentrancy"
  }
}

Input Schema

NameRequiredDescriptionDefault
frameworkNoSolana program framework used; defaults to 'anchor' when omitted.
rust_source_or_idlYesSolana Rust/Anchor source code or IDL JSON string to scan for CPI vulnerabilities.

Output Schema

NameRequiredDescriptionDefault
audit_verdictYesOverall Solana program verdict ('SAFE_ANCHOR_PROGRAM' or 'CRITICAL_CPI_VULNERABILITY').
pda_bump_safeYesTrue when canonical bump seeds are enforced on all PDA derivations.
missing_signer_checksYesAccounts mutated without enforcing Signer<'info> or has_one constraints.
arbitrary_cpi_detectedYesTrue if invoke/invoke_signed is called without validating the target program account.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A4.3/5.0
Behavior4/5

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

Annotations already cover read-only/idempotent/non-destructive/closed-world, and the description adds genuinely new operational context: a 32 KB input ceiling, 60 RPM rate limit, demo-mode and L402 pricing (30 sats), and an HTTP 400 failure mode for invalid input. The only gap is that it doesn't explain what the scan report contains, though an output schema exists to carry that.

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

Conciseness4/5

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

Two sentences, front-loaded with the capability and the exclusion, then a dense operational footer. Every clause carries information, though the trailing parenthetical packing limits, pricing, and error codes into one run-on is slightly compressed compared with the clean opening.

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 read-only two-parameter scanner with a full output schema and complete annotations, the description supplies what structured fields cannot: failure modes, rate/size limits, and payment/auth options. Only the consequence of exceeding the 32 KB limit and the shape of the report are left unstated, and the latter is covered by the output schema.

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 both parameters are already fully documented, including the framework enum and its 'anchor' default — which the description merely restates. It confirms the required input is a source-or-IDL string but adds no syntax, size, or format guidance beyond the schema. Baseline 3 applies when the schema does the heavy lifting.

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?

States a specific verb and resource ('Scans Solana Anchor and native Rust program instructions') and enumerates the exact bug classes targeted: unverified CPI program IDs, missing signer checks, PDA bump seed canonicalization. It also explicitly distinguishes itself from evaluate_solana_token_risk, so an agent can route between the two without opening either schema.

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

Usage Guidelines5/5

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

Gives a clear when-to-use ('auditing Solana Rust/Anchor source code or instruction account structs for CPI privilege escalation') and names the alternative with its own trigger condition ('checking live SPL token mint/freeze authorities and rug-pull risk by mint address, use evaluate_solana_token_risk instead'). Both directions of the routing decision are covered.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.