A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with the Stellar blockchain. This server provides tools for both Stellar Classic operations and Soroban smart contract development, allowing LLMs to manage accounts, process payments, deploy contracts, and perform complex blockchain operations.
- Overview
- Features
- Architecture
- Installation
- Configuration
- Usage
- Available Tools
- Development
- Contributing
- License
Full documentation lives in apps/docs as a Fumadocs site.
cd apps/docs
npm install
npm run dev # http://localhost:3000See Deploying the Docs for how to publish it (Vercel, Netlify, static export, or Docker).
Stellar MCP Server bridges the gap between AI assistants and the Stellar blockchain network. It implements the Model Context Protocol to provide a standardized interface for LLMs to:
- Manage Stellar accounts - Create, fund, and monitor accounts
- Process payments - Send and receive payments across the network
- Handle assets - Create custom assets and manage trustlines
- Deploy smart contracts - Build and deploy Soroban contracts
- Interact with contracts - Retrieve contract interfaces and invoke methods
- Monitor transactions - Track transaction history and status
- Account creation and management
- Balance inquiries
- Payment processing
- Asset creation and trustline management
- Claimable balance operations
- Transaction history retrieval
- Testnet account funding via Friendbot
- Contract building and optimization
- Contract deployment with constructor support
- Contract interface retrieval
- Support for complex data types (structs, enums, collections)
- Cross-platform compatibility (Windows, Linux, macOS)
- Type-safe TypeScript implementation
- Comprehensive JSDoc documentation
- Cross-platform support
- Multiple deployment options (local, NPX, Docker)
- MCP Inspector integration for debugging
The Stellar MCP Server is built with a modular architecture that separates concerns and enables easy maintenance:
stellar-mcp-server/
βββ src/
β βββ index.ts # Main server entry point + tool routing
β βββ config/ # Configuration management
β β βββ environment.config.ts
β βββ shared/ # Types shared across features
β β βββ common.interface.ts
β βββ features/ # Feature modules (co-located logic/types/tests)
β β βββ classic/ # Classic Stellar operations
β β β βββ classic.ts
β β β βββ schemas.ts
β β βββ soroban/ # Soroban smart contract operations
β β β βββ soroban.ts
β β β βββ schemas.ts
β β β βββ deployContract.interface.ts
β β β βββ getContractMethods.interface.ts
β β βββ core/ # Core utilities
β β βββ core.ts # Platform-specific commands
β β βββ messages.ts # Message formatting
β β βββ fileSystem.ts # File system operations
β β βββ contractParser.ts # Contract source parsing
β β βββ commands.interface.ts
β β βββ contract.interface.ts
β βββ tools/ # MCP tool definitions
β βββ classic.ts
β βββ soroban.ts
β βββ tools.ts
βββ apps/
β βββ docs/ # Fumadocs documentation site
βββ package.json
βββ tsconfig.json
βββ README.md
- Server Layer (
src/index.ts): MCP server implementation, tool routing, and request handling - Feature Layer (
src/features/): Blockchain logic for Classic and Soroban, plus the sharedcoreutilities - Tool Layer (
src/tools/): MCP tool definitions and schemas - Core Layer (
src/features/core/): Cross-platform utilities and shared functionality - Shared Layer (
src/shared/): Type definitions used across features
- Node.js 18+
- npm or yarn
- Git (for cloning the repository)
npm installnpm run buildCreate a .env file in the project root with the following configuration:
STELLAR_SERVER_URL=https://horizon-testnet.stellar.orgAvailable Stellar Networks:
- Testnet:
https://horizon-testnet.stellar.org - Public:
https://horizon.stellar.org - Futurenet:
https://horizon-futurenet.stellar.org
Configure your MCP client (Cursor, Windsurf, Claude Desktop) to use the Stellar MCP server:
{
"mcpServers": {
"stellar-mcp": {
"command": "node",
"args": ["/path/to/stellar-mcp-server/dist/index.js"]
}
}
}{
"mcpServers": {
"stellar-mcp": {
"command": "npx",
"args": ["-y", "stellar-mcp-server"]
}
}
}{
"mcpServers": {
"stellar-mcp": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"--init",
"-e",
"STELLAR_SERVER_URL=https://horizon-testnet.stellar.org",
"stellar-mcp-server"
]
}
}
}Development Mode:
npm run start:devProduction Mode:
npm run start:prodTo debug the server and monitor interactions:
npx @modelcontextprotocol/inspector node /path/to/stellar-mcp-server/dist/index.jsThen open your browser to http://localhost:5173 to view the inspector interface.
Create a new Stellar account with a random keypair.
Returns: Public key and secret key of the new account
Get the balance of a Stellar account including all assets.
Parameters:
account(string): The public key of the account to check balance
Send a payment to another Stellar account.
Parameters:
destination(string, required): The destination account public keyamount(string, required): The amount to sendsecretKey(string, required): The secret key of the source accountasset(object, optional): Custom asset detailscode(string): The asset codeissuer(string): The asset issuer public key
Get transaction history for a Stellar account.
Parameters:
account(string): The account public key to get transactions for
Create a new custom asset on the Stellar network.
Parameters:
code(string, required): The asset codeissuerSecretKey(string, required): The secret key of the issuing accountdistributorSecretKey(string, required): The secret key of the distributing accounttotalSupply(string, required): The total supply of the asset
Create or modify a trustline for a custom asset.
Parameters:
asset(object, required):code(string, required): The asset codeissuer(string, required): The asset issuer public key
limit(string, required): The trust limitsecretKey(string, required): The secret key of the account changing trust
Create a claimable balance that can be claimed by specified accounts under certain conditions.
Parameters:
asset(object, optional): Custom asset details. If not provided, uses native XLMcode(string): The asset code (e.g., "USD", "EUR")issuer(string): The asset issuer public key
amount(string, required): Amount to lock in the claimable balanceclaimants(array, required): List of accounts that can claim this balancedestination(string): Public key of the account that can claimpredicate(object): Conditions for claimingtype(string): One of: "UNCONDITIONAL", "BEFORE_RELATIVE_TIME", "BEFORE_ABSOLUTE_TIME", "NOT", "AND", "OR"value(number or array): For time predicates: seconds/timestamp, for compound predicates: array of predicates
secretKey(string, required): Secret key of the account creating the balance
Claim a claimable balance using its ID.
Parameters:
balanceId(string, required): ID of the claimable balance to claimsecretKey(string, required): Secret key of the claiming account
Fund a testnet account using the Friendbot faucet.
Parameters:
publicKey(string): The public key of the account to fund
Build and optimize Soroban smart contracts from source code.
Parameters:
contractPath(string, optional): The path to the contract directory. Defaults to current working directory
Features:
- Automatically builds contracts using
stellar contract build - Finds all WASM files in the target directory
- Optimizes each WASM file using
stellar contract optimize - Provides detailed logs of the entire process
Deploy a compiled Soroban contract to the Stellar network.
Parameters:
wasmPath(string, required): Path to the compiled WASM filesecretKey(string, required): Secret key of the deploying accountconstructorArgs(array, optional): Arguments for contract constructor if applicable- Each argument should be an object with:
name(string): Name of the constructor parametertype(string): Type of the argument (e.g., "Address", "String", etc.)value(string): Value of the argument
- Each argument should be an object with:
Features:
- Automatically detects if contract has a constructor
- Validates constructor arguments before deployment
- Provides detailed deployment logs and status updates
- Supports both simple contracts and contracts with initialization logic
Retrieve the complete interface of a deployed Soroban smart contract.
Parameters:
contractAddress(string, required): Address of the deployed contract (starts with "C")secretKey(string, required): Secret key of the account making the query
Returns: A structured ContractInterface object containing:
name: The name of the contractmethods: Array of contract methods with parameters and return typesstructs: Array of contract structs with fieldsenums: Array of contract enums with variants
Features:
- Supports all Soroban data types (primitives, structs, nested structs, enums)
- Handles complex data types and nested structures
- Automatically filters out the
envparameter from method signatures - Supports various enum types including error enums
stellar-mcp-server/
βββ src/
β βββ index.ts # Main server entry point
β βββ config/ # Configuration management
β βββ shared/ # Shared TypeScript types
β βββ features/ # Feature modules (classic, soroban, core)
β βββ tools/ # MCP tool definitions
βββ apps/docs/ # Fumadocs documentation site
βββ package.json
βββ tsconfig.json
βββ README.md
npm run build- Compile TypeScript to JavaScriptnpm run start:dev- Run in development mode with hot reloadnpm run start:prod- Run in production modenpm run lint- Run ESLint for code quality checksnpm test- Run test suite
To add a new Stellar tool:
- Define the tool schema in
src/features/[classic|soroban]/schemas.ts - Implement the tool logic in
src/features/[classic|soroban]/[classic|soroban].ts - Add the tool definition in
src/tools/[classic|soroban].ts - Add the tool handler in
src/index.ts
- Use TypeScript for all new code
- Add JSDoc comments for all public functions and classes
- Follow existing code patterns and conventions
- Use conventional commit messages
We welcome contributions to the Stellar MCP Server! Please see our Contributing Guide for details on how to get started.
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes
- Commit with conventional commit messages
- Push to your fork (
git push origin feature/amazing-feature) - Open a Pull Request
This MCP server is licensed under the MIT License. This means you are free to use, modify, and distribute the software, subject to the terms and conditions of the MIT License. For more details, please see the LICENSE file in the project repository.