Skip to main content
Glama

Soroban MCP Server

An MCP (Model Context Protocol) server that gives AI coding agents direct, structured access to Soroban smart contracts and the Stellar network — so agents can build, test, deploy, and inspect contracts without shelling out blindly to the CLI and parsing raw text output.

Demo: (drop a terminal recording or gif here once you have a working build)


Why this exists

AI coding agents are increasingly used to write and debug smart contracts, but today they either guess at CLI syntax or parse unstructured terminal output to decide whether a build succeeded, what a contract's state looks like, or why a deployment failed.

This server exposes those operations as typed, validated MCP tools with structured results and clear error messages — making agent-assisted Soroban development faster and more reliable.


Related MCP server: solagent-mcp

Features

Tool

Description

build_contract

Builds a Soroban project; returns structured compiler diagnostics (file, line, error code, message)

run_tests

Runs cargo test; returns a structured pass/fail report with failure messages

deploy_contract

Deploys a compiled .wasm to testnet or futurenet

invoke_contract

Simulates a contract function call; returns result + resource cost (CPU, memory, fee)

get_contract_state

Reads a contract's persistent/instance/temporary storage entries

get_account_info

Returns balance, sequence number, and signers for a Stellar account

Resources exposed:

  • soroban://network/{network}/status — current ledger height and health

  • soroban://contract/{id}/abi — contract ABI/spec from on-chain WASM metadata

  • soroban://contract/{id}/transactions — recent transaction history


Installation

npm install -g soroban-mcp-server

Or run directly without installing:

npx soroban-mcp-server

Prerequisites:

  • Node.js ≥ 20

  • stellar-cli on your PATH (required for build_contract and deploy_contract)


Configuration

Add to your MCP client config (e.g. Claude Code's mcp.json):

{
  "mcpServers": {
    "soroban": {
      "command": "npx",
      "args": ["soroban-mcp-server"],
      "env": {
        "STELLAR_NETWORK": "testnet"
      }
    }
  }
}

Env var

Description

Default

STELLAR_NETWORK

testnet, futurenet, or mainnet (read-only ops only on mainnet)

testnet

RPC_URL

Override the default RPC endpoint

network default

SOROBAN_CLI_PATH

Path to the Soroban/Stellar CLI binary

stellar

LOG_LEVEL

debug, info, warn, error

info


Usage example

Once connected to your MCP client, an agent can run a full build-test-deploy cycle:

"Build this contract, run the tests, and if they pass, deploy it to testnet and give me the contract ID."

The agent calls build_contractrun_testsdeploy_contract in sequence, using the structured output of each step to decide whether to proceed — without you needing to copy-paste terminal output back and forth.

Tool call examples

Build a contract:

{
  "tool": "build_contract",
  "arguments": { "project_path": "./contracts/my_token" }
}

Run tests with a filter:

{
  "tool": "run_tests",
  "arguments": { "project_path": "./contracts/my_token", "filter": "test_transfer" }
}

Check an account:

{
  "tool": "get_account_info",
  "arguments": { "public_key": "GABC...", "network": "testnet" }
}

Invoke a contract function:

{
  "tool": "invoke_contract",
  "arguments": {
    "contract_id": "CXXX...",
    "function_name": "balance",
    "args": [{ "type": "address", "value": "GABC..." }],
    "network": "testnet"
  }
}

Error handling

Every tool returns structured errors with a code field instead of raw stack traces:

{
  "error": "Insufficient balance to complete the transaction. Fund the account at https://friendbot.stellar.org",
  "code": "INSUFFICIENT_BALANCE"
}

Known error codes: BUILD_FAILED, WASM_NOT_FOUND, INVALID_WASM, NETWORK_TIMEOUT, NETWORK_UNREACHABLE, RPC_ERROR, INVALID_CONTRACT_ID, CONTRACT_NOT_FOUND, CONTRACT_INVOCATION_FAILED, INSUFFICIENT_BALANCE, ACCOUNT_NOT_FOUND, INVALID_PUBLIC_KEY, CLI_NOT_FOUND, CLI_EXECUTION_FAILED, TEST_EXECUTION_FAILED.


Development

git clone https://github.com/your-org/soroban-mcp-server
cd soroban-mcp-server
npm install

npm run typecheck   # TypeScript strict check
npm run lint        # ESLint
npm test            # Unit tests (all network/CLI calls mocked)

# Live testnet integration tests (requires network access)
INTEGRATION=true npm run test:integration

Roadmap

This project is built to grow alongside the Soroban ecosystem. Planned areas of expansion (and a source of ongoing, scoped contribution issues):

  • TTL managementbump_contract_ttl tool to extend contract state lifetimes

  • Signing support — submit state-changing transactions, not just simulate them

  • Additional wallets/signers — Freighter, hardware wallets

  • Richer error diagnosis — new failure modes as the protocol evolves

  • Prompt templates — common contract patterns (token, escrow, multisig)

  • Local devnet supportquickstart Docker integration for offline development


Contributing

See CONTRIBUTING.md. Issues are labeled by scope and complexity — issues tagged good-first-issue are a great place to start.


License

MIT

Available Tools

6 tools
build_contractA

Builds a Soroban smart contract project using the Stellar CLI. Returns structured compiler diagnostics (file, line, error code, message) — not raw rustc text.

ParametersJSON Schema
NameRequiredDescriptionDefault
networkNoTarget network for the buildtestnet
project_pathYesAbsolute or relative path to the Soroban contract project directory (contains Cargo.toml)

TDQS

A3.8/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It adds value by specifying that output is structured compiler diagnostics rather than raw rustc text, which is a meaningful behavioral trait. However, it does not disclose potential side effects such as file system changes, network usage, or permission requirements, leaving notable gaps.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is two sentences long, with the first stating the action and the second clarifying the output format. Every sentence provides essential information, and there is no redundant or filler content.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The description adequately explains the tool's core purpose and output type. For a build tool with only two parameters and no output schema, it covers the essential usage context. Minor gaps exist (e.g., side effects or success behavior) but the tool is sufficiently described given its complexity.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema already provides full descriptions for both parameters (network enum/default and project_path with Cargo.toml context), achieving 100% coverage. The description does not add additional parameter semantics beyond mentioning the Stellar CLI, so it aligns with the baseline of 3 for fully covered schemas.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description uses the specific verb 'Builds' and identifies the resource as 'a Soroban smart contract project using the Stellar CLI.' It clearly distinguishes itself from sibling tools like deploy_contract or invoke_contract by focusing on the build stage. The note about returning structured diagnostics further clarifies its unique purpose.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description does not explicitly state when to use this tool versus its siblings. It implies its role as the build step (before deployment) but lacks direct guidance on prerequisites or exclusion criteria. Users must infer usage from the tool name and sibling context, making it decent yet not fully explicit.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

deploy_contractA

Deploys a compiled .wasm file to testnet or futurenet using the Stellar CLI. Returns the contract ID and transaction hash. Mainnet is intentionally not supported here.

ParametersJSON Schema
NameRequiredDescriptionDefault
networkNoTarget network (mainnet deployments are not supported by this tool for safety)testnet
wasm_pathYesPath to the compiled .wasm file to deploy
ignore_checksNoPass --ignore-checks to stellar contract deploy (skip safety warnings)
source_accountYesStellar account secret key or keyname from stellar-cli config to pay for deployment

TDQS

A4/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description adds some context by noting the returned values and mainnet unsupported, but it omits critical behavioral traits: deployment is a paid, state-changing transaction requiring a funded source account, and it may incur fees. The description does not disclose these side effects or prerequisites, leaving a significant transparency gap.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise, using only two sentences: the first states the primary action, and the second covers return values and an important network restriction. Every word earns its place, and it is front-loaded with the deploy action.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with 4 parameters and no output schema, the description covers the main action, returns, and network exclusion. However, it lacks explicit prerequisites like 'wasm must be compiled' and 'source account must be funded', which are important for correct invocation. The schema partially compensates, but the description itself is not fully complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema provides 100% parameter descriptions, so the description does not need to elaborate on parameters. The description's mention of 'using the Stellar CLI' and 'source account' is redundant with the schema, but the schema already covers each parameter's meaning, warranting the baseline score.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool deploys a compiled .wasm file to testnet or futurenet, using a specific verb and resource. It distinguishes itself from sibling tools like build_contract or invoke_contract, and also mentions the return values (contract ID and transaction hash).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description indicates the target networks and explicitly excludes mainnet, providing clear usage boundaries. It implies usage after building a wasm file, but does not explicitly name alternatives or when not to use this tool beyond the mainnet exclusion.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_account_infoA

Returns balance, sequence number, and signers for a Stellar account. Includes a testnet funding link if the account is not found.

ParametersJSON Schema
NameRequiredDescriptionDefault
networkNoNetwork to querytestnet
public_keyYesStellar account public key (starts with G)

TDQS

A4/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the burden of behavior disclosure. It adds a notable behavior (testnet funding link when account is not found) but omits other potential behaviors like rate limits, error formats, or permission requirements. For a read-only getter, this is adequate but not rich.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is two sentences with the primary purpose stated first and the special behavior second. Every word earns its place, making it highly concise and well-structured.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple account query tool with two parameters, the description covers the returned fields and the not-found behavior. Since there is no output schema, listing the return contents is helpful. Minor gaps exist (e.g., network-specific behavior details), but overall it is sufficient.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100% with clear explanations for both 'public_key' and 'network'. The tool description adds no new parameter semantics beyond what the schema already provides, resulting in the baseline score of 3.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description explicitly states what the tool returns: balance, sequence number, and signers for a Stellar account. The specific verb 'Returns' combined with the resource and result set clearly distinguishes it from sibling contract operations.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description clearly implies usage for retrieving Stellar account information, and the sibling tools are contract-related, so the context is clear. However, it does not explicitly mention alternatives or exclusions, so it stops short of a 5.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_contract_stateA

Reads and returns storage entries (persistent, instance, temporary) for a Soroban contract. Keys and values are decoded to human-readable strings where possible.

ParametersJSON Schema
NameRequiredDescriptionDefault
limitNoMaximum number of storage entries to return
networkNoNetwork to querytestnet
durabilityNoFilter storage entries by durability type (omit to return all)
contract_idYesContract ID (56-character string starting with C)

TDQS

A3.8/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It adds useful context by noting keys and values are decoded to human-readable strings where possible. However, it does not mention pagination behavior, network-specific nuances, or potential side effects, leaving gaps given the lack of annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is two sentences, front-loaded with the primary action and resource, and contains no unnecessary details. It is concise and well-structured for a read tool.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the simplicity of the tool and complete schema coverage for all parameters, the description adequately covers the tool's purpose and the key behavior of decoding values. It does not describe the return format in detail, but the phrase 'returns storage entries' is sufficient for a straightforward read operation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the parameters are fully described in the schema. The description adds no additional parameter-specific meaning beyond what is already in the schema, such as the meaning of limit or network.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool reads and returns storage entries for a Soroban contract, using a specific verb and resource. It distinguishes from sibling tools like invoke_contract or deploy_contract by focusing on reading state rather than executing or deploying.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies the tool is used to inspect contract storage, but it does not explicitly state when to use it versus alternatives or provide exclusions. No comparison is made with sibling tools such as get_account_info or invoke_contract.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

invoke_contractA

Simulates a Soroban contract function call via RPC. Returns the function result AND simulated resource cost (CPU instructions, memory, min fee). For read-only calls no signing is needed.

ParametersJSON Schema
NameRequiredDescriptionDefault
argsNoArguments to pass to the function. Supported types: number, string, boolean, or objects with {type: "address"|"bytes", value: string}
networkNoNetwork to invoke ontestnet
contract_idYesContract ID (56-character string starting with C)
function_nameYesName of the contract function to call
source_accountNoSource account public key for simulation (not required for read-only calls). Defaults to a zero-balance account for simulation.

TDQS

A4.2/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the transparency burden. It discloses key behaviors: simulation via RPC, return of function result and resource costs (CPU, memory, min fee), and signing only needed for non-read-only calls. This goes beyond a simple 'invokes a function' and addresses important operational aspects, though it does not explicitly rule out on-chain side effects or detail error handling.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is two sentences, front-loaded with the central purpose, and every clause earns its place. It efficiently communicates the simulation nature, return value composition, and a key usage condition without redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simulation tool with no output schema, the description sufficiently explains what the tool returns and the signing context. However, it omits prerequisites such as the contract being deployed or the need for a network connection, and it could clarify that simulation does not submit an on-chain transaction. These gaps prevent a perfect score.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the input schema fully documents each parameter. The description adds minimal parameter-specific meaning beyond mentioning signing in the context of read-only calls, which is also covered by the source_account parameter description. At the baseline for full schema coverage, this score is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description uses a specific verb ('Simulates') and resource ('Soroban contract function call via RPC'), making the tool's purpose immediately clear. It distinguishes from siblings like deploy_contract or get_contract_state by focusing on function invocation simulation, not deployment or direct state reads.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear context that this is a simulation, not actual execution, and notes the signing requirement for read-only calls. However, it offers no explicit comparison to alternatives (e.g., when to use get_contract_state instead) or exclusions, so it slightly misses the highest bar.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

run_testsA

Runs the Soroban contract test suite with cargo test. Returns a structured pass/fail report (test name, status, duration, failure message).

ParametersJSON Schema
NameRequiredDescriptionDefault
filterNoOptional test name filter — passed to `cargo test <filter>`
project_pathYesAbsolute or relative path to the Soroban contract project directory (contains Cargo.toml)

TDQS

A4.1/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

The description discloses the return format (pass/fail report with test name, status, duration, failure message), but it does not mention potential side effects like compilation, dependency resolution, or behavior on test failure. With no annotations, the description carries the full burden and leaves some gaps.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, front-loaded sentence that includes the command, purpose, and return value. Every word earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple test-runner tool with documented parameters and an explicit return format in the description, the definition is complete. No output schema is needed, and the tool's behavior is adequately scoped.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema fully describes both parameters, including the optional filter. The description adds no additional parameter semantics, so the baseline of 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool runs the Soroban contract test suite via `cargo test` and returns a structured report, distinguishing it from build, deploy, invoke, and get-state siblings.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear context that the tool is for running tests, but it does not explicitly mention when not to use it or name alternative tools. The purpose and sibling names imply the right usage.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

TDQS

A4.2/5.0
Disambiguation5/5

Each tool targets a distinct resource and action: building, testing, account info, contract state, deployment, and invocation. There is no overlap in purpose, and the descriptions make it easy for an agent to select the right tool.

Naming Consistency5/5

All tool names follow a consistent verb_noun pattern in snake_case (build_contract, run_tests, get_account_info, get_contract_state, deploy_contract, invoke_contract). This creates a predictable and uniform naming convention.

Tool Count5/5

Six tools is a well-scoped count for a Soroban smart contract development server. Each tool covers a core step in the contract lifecycle without being redundant or overwhelming.

Completeness5/5

The toolset covers the essential workflow: build, test, deploy, invoke, inspect state, and manage account access. While additional tools could be added (e.g., listing contracts), the existing set is sufficient for common development tasks and has no obvious dead ends.

Maintenance

ActivityMaintained
ResponsivenessSyncing

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    C
    maintenance
    Enables interaction with Stellar Classic and Soroban smart contracts, allowing users to manage accounts, process payments, and handle asset operations. It provides comprehensive tools for building, deploying, and retrieving the interfaces of smart contracts on the Stellar network.
    15
    18
    MIT
  • F
    license
    Not graded
    quality
    D
    maintenance
    Bridges the Linkdfund smart contract layer to MCP-compatible AI clients, exposing Soroban escrow management, milestone tracking, and cross-layer expenditure audit tools as callable XDR envelopes.

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/firstJOASH/soroban-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server