Skip to main content
Glama
README.md
# MCP Money

![MCP Money](https://ei.marketwatch.com/Multimedia/2018/02/13/Photos/ZG/MW-GD647_skynet_20180213113524_ZG.jpg?uuid=e41f2218-10db-11e8-b127-9c8e992d421e)

An MCP (Model Context Protocol) money implementation for Nostr using NDK (Nostr Development Kit) with Cashu ecash functionality.

## Features

- **Cashu Wallet Integration**: Full support for Cashu ecash mints and tokens
- **Lightning Network**: Deposit via Lightning invoices and pay Lightning invoices
- **Nostr Zaps**: Send zaps to users using npub or NIP-05 identifiers
- **Multi-mint Support**: Manage multiple Cashu mints simultaneously
- **Persistent Storage**: Wallet state saved to local file with mint info caching
- **MCP Server**: Expose wallet functionality through Model Context Protocol
- **CLI Interface**: Direct command-line usage for all wallet operations

## Installation

```bash
npm install mcp-money
```

## Usage

### MCP Server Mode (Default)

Run without arguments to start the MCP server:

```bash
npx mcp-money
```

### CLI Mode

Use specific commands for direct wallet operations:

```bash
# Get total balance
npx mcp-money get_balance

# Get balance per mint
npx mcp-money get_mint_balances

# Create deposit invoice
npx mcp-money deposit 1000 https://testnut.cashu.space

# Pay lightning invoice
npx mcp-money pay lnbc1...

# Send a zap
npx mcp-money zap npub1... 100 "Great post!"

# Add a new mint
npx mcp-money add_mint https://mint.example.com
```

### Authentication

The wallet supports multiple ways to provide your Nostr private key:

1. **Command line**: `--nsec nsec1...`
2. **Environment variable**: `NSEC=nsec1...`
3. **Config file**: Automatically saved to `.wallet.json`
4. **Auto-generate**: Creates new key if none provided

## MCP Tools

When running as an MCP server, the following tools are available:

- `get_balance`: Get the total wallet balance
- `get_mint_balances`: Get balance breakdown per mint
- `deposit`: Create a deposit invoice for specified amount and mint
- `pay`: Pay a Lightning invoice
- `zap`: Send a zap to a user
- `add_mint`: Add a mint to the wallet

## Integration with AI Assistants

### Claude Code Integration

To use this wallet with [Claude Code](https://claude.ai/code), add it to your project's MCP configuration:

```json
{
  "mcpServers": {
    "mcp-money": {
      "command": "npx",
      "args": ["mcp-money"]
    }
  }
}
```

Or install globally and reference the binary directly:

```bash
npm install -g mcp-money
```

```json
{
  "mcpServers": {
    "mcp-money": {
      "command": "mcp-money"
    }
  }
}
```

### Goose Integration

To use this wallet with [Goose](https://github.com/square/goose), add it to your `~/.config/goose/config.yaml`:

If you have an nsec you want to use, you can set it by passing it as `--nsec nsec1...`.

```yaml
extensions:
  money:
    args:
    - -y
    - mcp-money
    bundled: null
    cmd: npx
    description: Money for agents
    enabled: true
    env_keys: []
    envs: {}
    name: money
    timeout: 300
    type: stdio
```

After adding the configuration, restart your AI assistant to begin using the wallet tools.

## Configuration

The wallet automatically creates a `.wallet.json` file to store:

- Private key (nsec)
- Public key (npub)
- Configured relays
- Configured mints
- Cached mint information

## Architecture

Built on top of:

- **NDK**: Nostr Development Kit for Nostr protocol interactions
- **NDK Wallet**: Cashu wallet implementation
- **Nostr Tools**: Low-level Nostr utilities
- **Bun**: Fast JavaScript runtime and package manager

## Security

- Private keys are stored locally in `.wallet.json`
- Mint information is cached for performance
- All Nostr communications use standard NIP protocols
- Lightning payments require explicit confirmation

## License

MIT

## Contributing

1. Fork the repository
2. Create a feature branch
3. Make your changes
4. Add tests if applicable
5. Submit a pull request

## Support

For issues and questions, please open an issue on the GitHub repository.

TDQS

B3.4/5.0

Scored across 6 tools

Disambiguation4/5

Most tools have distinct purposes, with 'deposit' for creating invoices, 'pay' for paying invoices, and 'zap' for sending zaps. However, 'get_balance' and 'get_mint_balances' could be slightly confusing as both relate to balance retrieval, though their descriptions clarify one is total and the other per-mint.

Naming Consistency5/5

All tool names follow a consistent verb_noun pattern (e.g., add_mint, deposit, get_balance, get_mint_balances, pay, zap), with clear and readable conventions throughout the set.

Tool Count5/5

With 6 tools, the server is well-scoped for a wallet and Lightning payment system, covering key operations like mint management, deposits, payments, and balance queries without being overly sparse or bloated.

Completeness4/5

The tool set covers core wallet and Lightning operations, including mint management, deposits, payments, and balance checks. A minor gap exists in lacking explicit tools for invoice status checks or transaction history, but agents can likely work around this for basic workflows.

Maintenance

ActivityInactive
ResponsivenessNo issues