OpenGuard-Solana
Provides a fail-closed transaction firewall for Solana AI agents: decodes Solana transactions, resolves address lookup tables via Solana RPC, optionally simulates transactions, and enforces policy before signing.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
OpenGuard-Solana
A fail-closed transaction firewall for Solana AI agents. It sits between the agent and the signer, decodes every transaction the agent wants signed, and returns one of three verdicts: AutoApprove, HoldForHuman, or Reject.
Status: Milestone-1 preview (
v0.1.0-preview.1). This repository is the public preview of the core SDK described in our Solana Foundation grant proposal, OpenGuard-Solana: Open-Source MCP Transaction Firewall, Per-Request Intent Signing & SPL Spend-Cap SDK for Solana AI Agents. It is not audited and has not been run against mainnet. See What is not done yet before you rely on it.
Why
Most agent setups hand the runtime a keypair or a signing callback and sign whatever transaction a tool builds. On Solana that leaves three gaps:
Instruction smuggling. A prompt-injected agent can append
SetAuthority,CloseAccountorApproveCheckedto an otherwise normal transfer, or hide the real recipient behind an address lookup table.No intent binding. Nothing ties the bytes being signed to what a human or orchestrator actually authorised: which mint, which recipient, how much, until when.
No pre-sign balance check. Simulating without comparing exact pre/post balances misses hidden outflows from Token-2022 hooks or opaque programs.
OpenGuard-Solana closes those gaps without ever touching a private key.
Related MCP server: safe-solana-mcp
What it does
Check | Behaviour |
Wire decoding | Own bounds-checked decoder for legacy and v0 messages. Truncated input, trailing bytes, bad compact-u16, duplicate keys, out-of-range indexes: |
Lookup tables | Resolves every ALT key (static map or RPC). Missing, deactivated, short, or duplicate-loading tables: |
Program allowlist | System, SPL Token, Token-2022, Associated Token, Memo, Compute Budget. Anything else is |
Instruction allowlist | Only known-safe instruction types pass. |
Approvals | Unlimited ( |
Spend caps | Per-transaction, rolling 1h and rolling 24h caps per asset ( |
Signed intents |
|
Simulation guard | Optional |
Replay guard | A message hash or idempotency key is approved once. Retry storms past |
Hold queue |
|
Audit log | Every decision is appended to a SHA-256 hash chain ( |
Quick start
Requires Node.js 24.
npm install
npx tsc --noEmit
npm test
npm run buildCheck a transaction (base64, or @file) against a policy:
node dist/cli/main.js check \
--policy examples/policy.devnet.json \
--state .openguard \
--session demo-1 \
--tx @tx.b64Exit codes: 0 AutoApprove, 3 HoldForHuman, 1 Reject, 2 usage error. Other commands:
node dist/cli/main.js decode --tx @tx.b64
node dist/cli/main.js hold list --policy examples/policy.devnet.json --state .openguard
node dist/cli/main.js hold approve <id> --policy examples/policy.devnet.json --state .openguard --approver alice
node dist/cli/main.js audit verify --state .openguardLibrary use
import { Firewall, parsePolicy, FirewallState, FileStore, AuditLog, RpcLookupResolver, SolanaRpc } from "@openguard-solana/sdk";
const fw = new Firewall({
policy: parsePolicy(JSON.parse(policyJson)),
state: new FirewallState(new FileStore(".openguard/state.json")),
audit: new AuditLog(".openguard/audit.jsonl"),
lookupResolver: new RpcLookupResolver(new SolanaRpc("https://api.devnet.solana.com")),
});
const decision = await fw.evaluate({ tx: txBase64, sessionId: "agent-42", intent: signedIntent });
if (decision.verdict === "AutoApprove") {
// hand the same bytes to your signer
}The firewall never signs. Your signer should only sign bytes whose message hash matches an AutoApprove decision (decision.txHash is the SHA-256 of the serialized message).
MCP server
node dist/cli/main.js mcp --policy <file> --state <dir> starts a stdio MCP server (newline-delimited JSON-RPC 2.0). It exposes the six tools named in the proposal:
Tool | Purpose |
| Allowed programs, caps, remaining rolling headroom |
| Check a signed intent without consuming its nonce |
| Dry-run verdict, no state change |
| Real evaluation: records spend and marks the tx hash used. Does not sign. |
| Kill a session and its pending holds |
| One audit entry plus a full chain verification |
A sample client config is in examples/mcp.json. SSE transport and the signer adapter are Milestone 2.
Signed intents
An orchestrator signs "openguard-solana:intent:v1\n" + JCS(intent) with its own Ed25519 key:
{
"version": "OPENGUARD_SOL_INTENT_v1",
"kind": "transfer",
"cluster": "devnet",
"agent": "<agent wallet>",
"sessionId": "agent-42",
"asset": "SOL",
"recipient": "<recipient wallet>",
"maxAmount": "250000000",
"nonce": "17",
"notBefore": 1796040000000,
"expiresAt": 1796040300000
}The SDK exports intentSigningBytes() and verifySignedIntent(). It has no signing helper on purpose. Full rules are in SPEC.md.
Tests
154 Vitest tests across seven files. Transactions in the tests are built with the reference @solana/web3.js and @solana/spl-token encoders (dev dependencies only), so the decoder is checked against the real wire format and not against itself. Adversarial fixtures include:
SOL drain over cap, and the same drain split into 12 small transfers
SetAuthorityhijack smuggled after a legitimate transfer (Token and Token-2022)CloseAccountdrain to the attackerUnknown program receiving the Token program for a CPI
Unlimited
ApproveChecked, andApproveto an unlisted delegateSeveral bounded approvals summed past the per-tx cap, and an approval piggybacked on an unrelated intent
SOL laundered as rent for attacker-owned ATAs (per-tx, hourly, allowlist, intent)
Opaque program with no simulation, and with a zero-delta simulation
A caller-supplied clock, and a hold approved after policy was tightened
Retry storm, tx replay, idempotency-key reuse
u64::MAXtransfers, a sum past 2^64, and a cap that aNumberwould round past (2^53 + 1)Durable nonce,
System::Assign, priority-fee burn, duplicate compute budgetUnresolvable, short, and duplicate-loading lookup tables
Hidden simulation outflow, CPI to an unlisted program, owner change
2,000 mutated byte strings through the decoder
20 parallel requests racing the hourly cap (exactly 5 approved)
An attack-corpus test runs 15 fixtures and an R1 exploit corpus runs 9 more scenarios (with their own policies and intents); both assert zero AutoApprove.
What is not done yet
Honest list, so nobody mistakes the preview for the finished product:
Not audited. Do not put real funds behind it yet.
No live network runs. RPC helpers are tested against a mocked transport only. Devnet and mainnet-beta verification bundles are Milestone 2.
Token-2022 extensions (transfer fees, transfer hooks, confidential transfers) are rejected rather than understood.
Multisig token authorities are rejected.
Opaque programs such as swap routers can only be cleared through simulation evidence plus a human, because M1 cannot see where their funds go.
Persistence is a single JSON file with atomic rename. It is safe for one process. SQLite/Redis stores with cross-process locking are Milestone 2.
Network fees (base fee and priority fee) are bounded per transaction by
maxPriorityFeeLamportsbut are not counted against the SOL spend caps.
Repository layout
src/
wire.ts legacy + v0 transaction decoder
alt.ts lookup table parsing and resolution
decoders/ System, Token, Token-2022, ATA, Memo, Compute Budget
pda.ts PDA / ATA derivation (pure BigInt curve check)
intent.ts OPENGUARD_SOL_INTENT_v1 verification
jcs.ts RFC 8785 canonical JSON
policy.ts policy parsing and validation
state.ts spend ledger, replay guard, nonces, holds
simulation.ts balance-delta guard and RPC helpers
firewall.ts the evaluation pipeline
audit.ts hash-chained audit log
mcp/server.ts stdio MCP server
cli/main.ts CLI
test/ Vitest suites and fixtures
docs/ci.example.ymlLicense
Apache-2.0. See LICENSE.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Remote MCP for LiveLaunch, the Solana token launchpad. Unsigned-transaction tools for AI agents.
Ledger of record for AI spend: verifiable receipts, waste auditor & model arbitrage MCP.
Native Solana staking for AI agents. 26 MCP tools, one-shot signing, webhooks.
Pre-sign Solana tx guard for agents: ALLOW/WARN/BLOCK verdict, x402 USDC pay-per-call.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceAI-native Solana wallet CLI with scoped MCP server, enabling AI agents to manage wallets with granular permissions, spend limits, and tamper-evident audit logging.5-
- AlicenseAqualityDmaintenanceAn MCP server providing policy-gated Solana access for AI agents, with read-only operations and guarded transfers that require policy checks and simulation, returning unsigned transactions.7MIT
- AlicenseNot gradedqualityBmaintenanceMCP server that gives AI agents a Solana wallet with a capped, revocable token allowance from a user-owned vault, enforced on-chain by SPL Token delegations plus local guardrails, without exposing the owner's private key.54 npm9Apache 2.0
- FlicenseAqualityCmaintenanceAn MCP server that exposes governance, trust-scoring, compliance, guardrail, cost, drift, and supply-chain scanning tools and resources to any MCP client over stdio, Streamable HTTP, or legacy HTTP+SSE. It lets agents route every tool call through a deterministic five-way decision (allow, redact, require approval, deny, or quarantine) with hash-chained evidence, human approval workflows, and in-agent trust gates for LangChain, LangGraph, and Google ADK.30-