Skip to main content
Glama

AiAgentWalletMCP

An MCP (Model Context Protocol) server that enables AI agents to call paid tools from a marketplace with automatic Stellar blockchain payment handling.

What This Server Does

The Stellar Market MCP Server bridges AI agents with a marketplace of paid tools, managing:

  • Automatic Payment Processing: Automatically handles Stellar blockchain payments for tool usage using a persistent server wallet

  • Tool Marketplace Integration: Connects to a local marketplace backend to discover and call available paid tools

  • Wallet Management: Creates and manages a secure Stellar wallet stored locally, with automatic funding on Testnet

  • Payment Authorization: Implements the X-402 payment protocol for seamless tool access without manual payment coordination

This allows AI agents to call specialized tools (like weather data, data analysis, APIs) by simply requesting them through the MCP interface, with payments handled transparently.

Prerequisites

  • Node.js 18+ and npm

  • A running marketplace backend at http://localhost:3000

  • Internet connection (for Stellar Testnet funding and blockchain operations)

Local Setup

1. Clone Github Repo

git clone https://github.com/anuragsinghbhandari/AiAgentWalletMCP.git cd AiAgentWalletMCP

2. Install Dependencies

npm install

3. Build the Project

npm run build

This compiles TypeScript to JavaScript and creates an executable with proper permissions.

4. Configure Marketplace URL (Optional)

The server defaults to connecting to http://localhost:3000. To use a different marketplace:

Edit src/index.ts and update the MARKETPLACE_URL constant:

const MARKETPLACE_URL = "http://your-marketplace-url:3000";

Then rebuild with npm run build.

5. Run the Server

node build/index.js

The server will:

  • Create a Stellar wallet if one doesn't exist.

  • Automatically fund the wallet with test credits on Stellar Testnet

  • Start listening for MCP connections

6. Use in Your MCP Client

Configure your MCP client to connect to the server's stdio transport. The server provides a call_paid_tool tool that accepts:

  • tool: Name of the tool to call

  • category: Tool category

  • args: Arguments to pass to the tool

MCP Client Configuration

Add the following to your MCP client configuration file (e.g., Claude Desktop config):

{ "mcpServers": { "marketstellarmcp": { "command": "node", "args": [ "path/to/AiAgentWalletMCP/build/index.js" ] } } }

Update the path to match your installation location. After adding this configuration, restart your MCP client to enable the connection.

Project Structure

  • src/index.ts - Main server implementation

  • build/index.js - Compiled server (generated after build)

  • package.json - Dependencies and build configuration

How It Works

  1. Wallet Creation: On first run, generates a Stellar keypair and stores it securely

  2. Testnet Funding: Requests test credits from Stellar's Friendbot

  3. Payment Wrapper: Uses X-402 payment protocol to handle payments for marketplace tools

  4. Tool Calls: Routes tool requests to the marketplace backend, automatically paying the required amount

-
security - not tested
A
license - permissive license
-
quality - not tested

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/anuragsinghbhandari/AiAgentWalletMCP'

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