mcp-solana-dex

mcp-solana-dex

1

The MCP Solana DEX Server provides a set of tools for managing decentralized exchange functionalities related to Initial Coin Offerings (ICOs) on Solana. It allows the creation, cancellation, and execution of sell orders, with a focus on pre-condition checks but not on-chain execution, which must be handled by clients. This simplified server is not suitable for production without further client-side implementations.

MCP Solana DEX Server

Purpose

This server provides basic DEX functionalities for tokens associated with ICOs managed by the main server:

  • Creating sell orders.
  • Cancelling sell orders.
  • Executing sell orders (buying from existing orders).
  • Retrieving the current order book for an ICO.

Features

  • MCP Tools: Exposes DEX functions as MCP tools (create_order, cancel_order, execute_order, get_orders).
  • File-Based Persistence: Stores the order book in a JSON file.
  • ICO Association: Orders are associated with specific ico_ids.

Usage

This server is intended to be run as a separate process from the main ICO server.

  1. Ensure dependencies are installed.
  2. Navigate to parent directory.
  3. Start the DEX Server.
  4. Interact using an MCP client connected to the standard input/output of this process.

MCP Tools

  • create_order: Creates a new sell order.
  • cancel_order: Cancels an existing order.
  • execute_order: Performs pre-condition checks for executing a sell order and updates the internal order book if checks pass.
  • get_orders: Retrieves the current sell orders for an ICO.

Testing

This project uses pytest for integration testing. The tests primarily call the server's tool functions directly. Execute pytest from the project root directory.

Future Considerations

  • Client-Side Atomic Swaps: Ensure clients implement secure, atomic order execution.
  • Database Persistence: Replace file storage with a database for better scalability.
  • Buy Orders: Add support for creating and matching buy orders.