How the-x-35/solana-chatgpt-kit works
Project type and purpose
• This is a full-stack Next.js 15 application that embeds itself as a native ChatGPT App via the OpenAI Apps SDK (MCP).
• Its primary function is to expose Solana blockchain operations (swap, transfer, balance check, stake, price lookup) directly inside ChatGPT with natural-language commands and interactive widgets using Jupiter and other Solana services.
File structure
Top-level folders and files:
• app/ – Next.js App Router:
– app/mcp/route.ts: MCP server endpoint that registers “tools” (API endpoints) and “resources” (UI widget HTML) with ChatGPT.
– app/api/...: Serverless functions implementing blockchain operations (swap/quote, swap/execute, transfer, stake, wallet/balance, price).
– app/swap/, app/transfer/, app/stake/, etc.: React pages for each widget.
– app/hooks/: Custom React hooks for state, display mode, OpenAI integration, sending messages.
– layout.tsx, globals.css: Global layout and styling.
– custom-page/page.tsx: Any static or override page.
• components/: Shared UI primitives (Radix UI wrappers: Button, Card, Input, Label, Badge).
• lib/: Core utilities and configuration: address resolution, Solana config, token resolver, utils, wallet-utils, x402 payment config.
• middleware.ts: Next.js middleware for routing or request handling.
• next.config.ts, tsconfig.json, postcss.config.mjs: Build and runtime configuration.
Key insights from the README
• Architecture section calls out five main pieces:
1. MCP Server (app/mcp)
2. API Routes (app/api)
3. Wallet modes (server-key vs. browser extension + x402 payment protocol)
4. UI Widgets (app/swap, app/transfer, etc.)
5. Address Resolution (lib/address-resolver.ts)
• Tech stack: Next.js, React, TypeScript, Tailwind, Solana Web3.js, Jupiter API, OpenAI Apps SDK, Zod for validation.
• External services: Jupiter aggregator, Bonfida SNS, AllDomains, PayAI/x402 facilitator, Solana JSON RPC.