sortie

sortie

Extends Solana debugging to AI agents via MCP: decode transaction failures, trace CPI trees, and profile compute for any Solana transaction.

Category
访问服务器

README

<div align="center">

<a href="./public/logo.svg"><img src="./public/logo.svg" width="120" alt="SORTIE" /></a>

SORTIE

Semantic execution debugger for Solana transactions.

Decode failures (0x1771 → "slippage tolerance exceeded"). Trace CPI trees. Profile compute. Let AI agents inspect transactions through MCP.

Live Version License MIT Solana Next.js TypeScript

Live demo · Report bug · Request feature

</div>


What it does

When a Solana transaction fails on mainnet, the raw error is useless: InstructionE...: custom program error: 0x1771. SORTIE does the work you shouldn't have to:

  1. Decodes the error — maps the program ID + instruction index + error code to a human-readable string. "Slippage tolerance exceeded on output token." Covers 12+ protocols (Jupiter, Raydium, Orca, Drift, Meteora, Kamino, Mango, Marinade, Sanctum, SPL Token, System, Associated Token).
  2. Reconstructs the CPI tree — the full call stack with parent/child relationships. Failed branches highlighted. Per-instruction status, compute, error. Drag to explore.
  3. Profiles compute — per-step CU breakdown. Hot spots, by-program totals, optimization hints when something eats >80% of the budget.
  4. Streams live failures — recent failed transactions on mainnet, sampled from a public RPC. Refreshes every 15s. Click any to debug.
  5. Exposes it to AI agents via MCP — JSON-RPC 2.0 endpoint at /api/mcp. Four tools: explain_failure, analyze_transaction, list_protocols, get_recent_failures. Works with Claude Code, Codex, any MCP-compatible client.

Quick start

git clone https://github.com/srivtx/sortie.git
cd sortie
npm install
npm run dev
# → http://localhost:3000

Open http://localhost:3000 for the live failure feed. Paste any Solana transaction signature (or click one in the feed) to debug it.

MCP setup

The MCP endpoint is at http://localhost:3000/api/mcp. Configure your AI agent:

{
  "mcpServers": {
    "sortie": {
      "url": "http://localhost:3000/api/mcp",
      "transport": "http"
    }
  }
}

Four tools:

Tool What it does
explain_failure Decode a transaction error: program, instruction, error code, likely cause
analyze_transaction Full analysis: CPI tree, compute profile, step-by-step timeline
list_protocols List all supported protocols and their decoders
get_recent_failures Recent failures across the network (filter by program)

A live playground is at /mcp-demo — try each tool from your browser.

Architecture

sortie/
├── app/
│   ├── page.tsx                    # live failure feed (home)
│   ├── tx/[signature]/page.tsx     # transaction detail (5 tabs: timeline / tree / profile / logs / raw)
│   ├── mcp-demo/page.tsx           # MCP playground
│   └── api/
│       ├── mcp/route.ts            # MCP JSON-RPC 2.0 server
│       ├── recent-failures/        # live failure sampler
│       └── transaction/[signature]/ # transaction fetcher
├── components/                     # reusable UI primitives
│   ├── CpiFlow.tsx                 # React Flow CPI tree
│   ├── ExecutionTimeline.tsx       # step-by-step walk
│   ├── ComputeProfiler.tsx         # CU breakdown + hot spots
│   ├── FailureAnalysis.tsx         # auto-categorized errors
│   ├── RecentFailures.tsx          # live feed component
│   ├── CopyButton.tsx              # one-click clipboard
│   └── ThemeToggle.tsx             # light/dark
├── lib/
│   ├── ir/                         # intermediate representation
│   │   ├── types.ts                # ExecutionStep, Action, etc.
│   │   └── builder.ts              # parse raw tx → IR
│   └── parser/                     # Solana-specific parsers
│       ├── transaction.ts          # main entry
│       ├── instructions.ts         # instruction decoding
│       ├── errors.ts               # error code → human readable
│       ├── logs.ts                 # program log parsing
│       ├── balances.ts             # balance change extraction
│       └── protocols/              # per-program decoders
├── public/                         # logo, favicon
└── tailwind.config.ts              # design tokens

Data flow

Public RPC → Solana transaction
  ↓
lib/parser/transaction.ts
  ↓
Intermediate Representation (IR): tree of ExecutionSteps
  ↓
Components render the IR:
  CpiFlow         → the call tree
  ExecutionTimeline → chronological steps
  ComputeProfiler → CU breakdown
  FailureAnalysis → error categorization

The IR is the key abstraction. Add a new program decoder → it automatically works in every view (live feed, timeline, CPI tree, failure decoder).

Adding a new program decoder

// lib/parser/protocols/my-program.ts
import { ProtocolDecoder } from './types';

export const myProgram: ProtocolDecoder = {
  programId: 'MyProgram11111111111111111111111111111111',
  decodeError: (code: number) => {
    const errors: Record<number, string> = {
      0: 'Success',
      1: 'Insufficient liquidity',
      2: 'Slippage exceeded',
    };
    return errors[code] ?? `Unknown error: 0x${code.toString(16)}`;
  },
  decodeInstruction: (data: Buffer) => ({
    type: 'swap',
    params: { /* parsed fields */ },
  }),
};

Register it in lib/parser/protocols/index.ts. It shows up in the live feed, the failure decoder, the timeline, and the MCP tool responses — everywhere.

Tech stack

  • Framework: Next.js 14 (App Router)
  • UI: React 18, TypeScript 5 (strict mode)
  • Styling: Tailwind CSS 3 with custom design tokens (CSS variables for light/dark theming)
  • Visualization: React Flow (CPI tree)
  • Icons: Lucide React
  • Data: Public Solana RPC (no API key required for read-only calls)
  • MCP: Hand-rolled JSON-RPC 2.0 server (no SDK — small surface, full control)

Supported programs

  • Jupiter — aggregator, slippage errors
  • Raydium — AMM, pool errors
  • Orca — AMM (Whirlpools)
  • SPL Token — token program, transfer errors
  • System Program — account creation, transfers
  • Associated Token — ATA derivation
  • Marinade — liquid staking
  • Mango — perp dex
  • Meteora — DLMM
  • Drift — perpetuals
  • Kamino — lending
  • Sanctum — LSTs

Open an issue or PR to add more. See CONTRIBUTING.md for the protocol-decoder spec.

Development

npm install        # install deps
npm run dev        # dev server
npm run build      # production build
npm start          # serve production build
npm run lint       # next lint
npx tsc --noEmit   # type-check

Conventions

  • TypeScript strict — "strict": true in tsconfig.json. No any in committed code.
  • Server components by default — only 'use client' when you need state, effects, or browser APIs.
  • Design tokens via CSS variables — colors in :root in app/globals.css, exposed via tailwind.config.ts. Theme switching works without re-renders.
  • No external state library — local state, URL state, server state via fetch. Add Zustand/Redux only if you actually need it.
  • Public RPC by default — no API key needed for read-only calls. For production, switch to Helius/QuickNode.

Deployment

Deploys to Vercel with zero config:

vercel

Or any Next.js-compatible host. The MCP endpoint is a standard Next.js API route — works on Vercel, Netlify, Cloudflare Pages, your own Node server.

Environment variables: none required for the public RPC. If you want a private RPC:

# .env.local
SOLANA_RPC_URL=https://mainnet.helius-rpc.com/?api-key=YOUR_KEY

Then update lib/parser/transaction.ts to use it.

Performance

  • Transaction parsing: < 50ms for typical transactions (10-20 instructions)
  • CPI tree render: < 100ms for trees up to ~100 nodes
  • Live failure feed: 15s refresh interval, 4 RPC calls/min (well under public RPC limits)
  • MCP server: stateless, ~2s for a full analyze_transaction call

Contributing

See CONTRIBUTING.md for the full guide on adding program decoders, reporting issues, and the PR process.

License

MIT — Copyright (c) 2026 srivtx

Acknowledgments

  • Solana — the chain
  • React Flow — the tree visualization
  • Anza (formerly Solana Labs) — the RPC and tooling
  • Helius — reference docs and transaction parsing examples
  • The Solana developer community — bug reports, feedback, and protocols to decode

Contact


<sub>Built for the Superteam Earn "Ship useful agent skills" bounty. Released under MIT.</sub>

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选