# sendaifun/solana-mcp architecture

> Architecture diagram of the GitHub repository sendaifun/solana-mcp, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sendaifun/solana-mcp
- Repository: https://github.com/sendaifun/solana-mcp

## Overview

##### Project Type and Purpose
- This is a Node.js/TypeScript-based backend service (an MCP server) that provides standardized Solana blockchain operations for Claude AI agents.
- Its primary goal is to offer onchain tools—such as querying tokens, deploying assets, transferring funds, and minting NFTs—through the standardized Model Context Protocol (MCP).
- It integrates with the Claude Desktop client via specific configuration (see the JSON examples in the README) and uses libraries like @solana/web3.js, @modelcontextprotocol/sdk, and solana-agent-kit.

##### Analyzing the File Structure
- Top-level files include configuration and build files (e.g., package.json, tsconfig.json), while the primary source code exists under the “src” directory (with src/index.ts as the main entry point).
- The “scripts” folder includes an installation script (install.sh) that aids in the setup process. This shows the project supports both automated and manual deployment options.
- Minimal structure indicates that the business logic is implemented in a single service (in index.ts) which interacts directly with Solana’s RPC endpoints.

##### Components
a. MCP Server Core:
- Node.js/TypeScript “MCP server” as the central module running index.ts.
- That this core component implements the Model Context Protocol to standardize blockchain requests.
b. Integration Points:
- Claude Desktop: Show an external client (Claude Desktop) that connects using configuration details specified in the claude_desktop_config.json.
- Command/Args Interface: Indicate how the MCP server is launched (command “node” with build output or “npx solana-mcp”), as outlined in the README.
c. Blockchain Interaction:
- Solana RPC Endpoint: Represent the Solana blockchain (or its testnet/mainnet endpoints) as the destination for all onchain operations.
- Usage of Solana libraries (@solana/web3.js) to perform transactions, query accounts, and manage wallets.
d. Configuration and Environment:
- Environment Variables (.env): Illustrate how credentials like SOLANA_PRIVATE_KEY, RPC_URL, and optionally OPENAI_API_KEY are provided to the MCP server.
- Installation Script: Optionally include the “scripts/install.sh” as an auxiliary component that initializes the environment and sets up dependencies.
e. External Dependencies/Tooling:
- Dependencies (like @modelcontextprotocol/sdk and solana-agent-kit) that are fundamental to implementing blockchain commands.

##### Relationships and Data Flow
- Communication from Claude Desktop (or another client application) to the MCP server, representing command invocation.
- The MCP server sending commands and queries to the Solana blockchain via the RPC_URL.

##### Detailed Elements
- Clear labels for every component:
- “MCP Server (src/index.ts)” for the main application.
- “Installation Script (scripts/install.sh)” for environment setup.
- “Claude Desktop (External Client)” showing integration.
- “Solana Blockchain (RPC Endpoint)” as a service provider.
- Client request from Claude Desktop to MCP Server.
- MCP Server’s call and response to/from the Solana Blockchain.
- Environment configuration (via .env and claude_desktop_config.json) feeding into the MCP Server.
- Optional sub-components:

##### Final Recommendations
- Do not oversimplify: Although the codebase is small, detail all key components and their interactions.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Configuration & Initialization"
        CDC["Claude Desktop Config (claude_desktop_config.json)"]:::config
        PC1["Project Config (package.json)"]:::config
        PC2["Project Config (tsconfig.json)"]:::config
        ENV["Environment Variables (.env)"]:::config
        IS["Installation Script (scripts/install.sh)"]:::script
    end

    CD["Claude Desktop (External Client)"]:::external
    MCP["MCP Server (src/index.ts)"]:::core
    SB["Solana Blockchain (RPC Endpoint)"]:::external
    DepNote["Dependencies: @solana/web3.js, @modelcontextprotocol/sdk, solana-agent-kit"]:::note

    IS -->|"setup"| ENV
    CDC -->|"config"| MCP
    PC1 -->|"config"| MCP
    PC2 -->|"config"| MCP
    ENV -->|"credentials"| MCP
    CD -->|"command"| MCP
    MCP -->|"blockchain_request"| SB
    MCP ---|"uses"| DepNote

    click MCP "https://github.com/sendaifun/solana-mcp/blob/main/src/index.ts"
    click IS "https://github.com/sendaifun/solana-mcp/blob/main/scripts/install.sh"
    click CDC "https://github.com/sendaifun/solana-mcp/blob/main/claude_desktop_config.json"
    click PC1 "https://github.com/sendaifun/solana-mcp/blob/main/package.json"
    click PC2 "https://github.com/sendaifun/solana-mcp/blob/main/tsconfig.json"

    classDef core fill:#ADD8E6,stroke:#000,stroke-width:2px
    classDef script fill:#FFA500,stroke:#000,stroke-width:2px
    classDef config fill:#FFD700,stroke:#000,stroke-width:2px
    classDef external fill:#90EE90,stroke:#000,stroke-width:2px
    classDef note fill:#D3D3D3,stroke:#000,stroke-dasharray: 5 5,stroke-width:2px
```
