Magma MCP
This server lets you purchase inbound Lightning Network liquidity for a Lightning node via Amboss Magma.
Buy Lightning liquidity for a node using a connection URI (pubkey or pubkey@host:port)
Specify purchase amount in USD cents (minimum $5.00 / 500 cents)
Optionally create a private channel
Optionally source liquidity only from Rails cluster nodes
Optionally provide a redirect URL after payment
Returns a Lightning invoice to pay and complete the purchase
Helps increase your node's receiving capacity and accept Lightning payments
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Magma MCPBuy $10 of Lightning liquidity for my node 024ae5a5...@12.34.56.78:9735"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Magma MCP
Node.js client library and Model Context Protocol (MCP) server for buying Lightning Network liquidity via Amboss Magma.
Overview
This package provides two ways to interact with the Amboss Magma API:
Node.js Client Library: Programmatically buy Lightning liquidity from your Node.js applications
MCP Server: Enable AI assistants like Claude to purchase inbound Lightning Network liquidity for your node
Both interfaces provide a seamless way to increase your node's receiving capacity through the Amboss Magma API.
Related MCP server: MCP Money
Features
Buy Lightning Liquidity: Purchase inbound liquidity for your Lightning node
Anonymous Access: Works without an API key - the Magma API creates temporary accounts automatically
Optional Authentication: Use your Amboss account API key for personalized access
Input Validation: Comprehensive validation of all parameters
Error Handling: Clear, user-friendly error messages
Retry Logic: Automatic retry for transient network failures
Prerequisites
Node.js >= 18.0.0
pnpm (or npm/yarn)
A Lightning Network node with accessible connection URI
(Optional) Amboss Magma API key (Get one here)
Installation
From npm (Recommended)
npm install -g @ambosstech/magma-mcpOr with pnpm:
pnpm add -g @ambosstech/magma-mcpFrom source
git clone https://github.com/AmbossTech/magma-mcp.git
cd magma-mcp
pnpm install
pnpm buildConfigure environment variables (Optional)
The Magma API supports anonymous access - you can use the server without an API key! The API will automatically create temporary accounts with session keys.
If you want to use your existing Amboss account, create a .env file:
cp .env.example .envEdit .env and add your Magma API key:
MAGMA_API_KEY=your_api_key_hereConfiguration
Environment Variables
Variable | Required | Default | Description |
| No | - | Your Amboss Magma API key (optional - supports anonymous access) |
| No |
| Magma GraphQL endpoint |
| No |
| Logging level (debug, info, warn, error) |
Claude Desktop Integration
Add the following configuration to your Claude Desktop config file:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
Option 1: Using npm package (anonymous access)
{
"mcpServers": {
"magma": {
"command": "npx",
"args": ["-y", "@ambosstech/magma-mcp"]
}
}
}Option 2: Using npm package (with API key)
{
"mcpServers": {
"magma": {
"command": "npx",
"args": ["-y", "@ambosstech/magma-mcp"],
"env": {
"MAGMA_API_KEY": "your_api_key_here"
}
}
}
}Option 3: From source (development)
{
"mcpServers": {
"magma": {
"command": "node",
"args": ["/absolute/path/to/magma-mcp/dist/server.js"],
"env": {
"MAGMA_API_KEY": "your_api_key_here"
}
}
}
}After adding the configuration:
Save the file
Restart Claude Desktop
The Magma MCP server will be available
Usage
Once configured, you can use natural language with Claude to buy Lightning liquidity:
Example Prompts
Basic purchase:
Buy $10 of Lightning liquidity for my node at 024ae5a5f0b0185...@12.34.56.78:9735With options:
Buy $50 of Lightning liquidity for 024ae5a5f0b0185...@12.34.56.78:9735
using only Rails cluster nodesPrivate channel:
Buy $25 of private channel liquidity for my node 024ae5a5f0b0185...@12.34.56.78:9735Tool: buy_lightning_liquidity
Parameters:
connection_uri(required): Your node's connection string (either just pubkey or pubkey@host:port)Just pubkey:
024ae5a5f0b01850983009489ca89c85...With socket:
024ae5a5f0b01850983009489ca89c85...@12.34.56.78:9735
usd_cents(required): Dollar amount in cents (minimum 500 = $5.00)redirect_url(optional): URL to redirect after paymentprivate_channel(optional): Create private channel (default: false)rails_cluster_only(optional): Source only from Rails cluster (default: false)
Returns:
{
"success": true,
"lightning_invoice": "lnbc10m1p3j8z9xpp5qqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqypq..."
}The Lightning invoice can be paid using any Lightning wallet to complete the liquidity purchase.
Using as a Node.js Library
In addition to the MCP server, this package can be used as a Node.js client library to programmatically interact with the Amboss Magma API.
Installation
npm install @ambosstech/magma-mcpQuick Start
import { MagmaClient } from '@ambosstech/magma-mcp';
// Create client (anonymous access)
const client = new MagmaClient();
// Or with API key
const client = new MagmaClient({
apiKey: process.env.MAGMA_API_KEY
});
// Buy liquidity
const invoice = await client.buyLiquidity({
connectionUri: '024ae5a5f0b01850983009489ca89c85...@12.34.56.78:9735',
usdCents: 1000 // $10.00
});
console.log('Pay this Lightning invoice:', invoice);API Reference
MagmaClient
Constructor:
new MagmaClient(config?: MagmaClientConfig)Config options:
apiKey?: string- Your Amboss Magma API key (optional, supports anonymous access)endpoint?: string- GraphQL endpoint (default:https://magma.amboss.tech/graphql)logLevel?: 'debug' | 'info' | 'error'- Logging level (default:error)
Methods:
buyLiquidity(options: BuyLiquidityOptions): Promise<string>
Purchase inbound Lightning Network liquidity for a node.
Options:
connectionUri: string- Node connection string (pubkey or pubkey@host:port)usdCents: number- Amount in cents (minimum 500 = $5.00)redirectUrl?: string- Optional post-payment redirect URLprivateChannel?: boolean- Create private channel (default: false)railsClusterOnly?: boolean- Source only from Rails cluster (default: false)
Returns: Lightning invoice string to complete the payment
Throws: MagmaClientError on API or network errors
Examples
Basic purchase:
import { MagmaClient } from '@ambosstech/magma-mcp';
const client = new MagmaClient();
const invoice = await client.buyLiquidity({
connectionUri: '024ae5a5f0b01850983009489ca89c85...',
usdCents: 500 // $5.00 minimum
});
console.log('Invoice:', invoice);With all options:
const invoice = await client.buyLiquidity({
connectionUri: '024ae5a5f0b01850983009489ca89c85...@12.34.56.78:9735',
usdCents: 5000, // $50.00
redirectUrl: 'https://myapp.com/payment-complete',
privateChannel: true,
railsClusterOnly: true
});Error handling:
import { MagmaClient, ErrorCategory } from '@ambosstech/magma-mcp';
const client = new MagmaClient();
try {
const invoice = await client.buyLiquidity({
connectionUri: '024ae5a5f0b01850983009489ca89c85...',
usdCents: 1000
});
console.log('Success:', invoice);
} catch (error) {
if (error.category === ErrorCategory.NETWORK_ERROR) {
console.error('Network issue, please retry');
} else if (error.category === ErrorCategory.CLIENT_ERROR) {
console.error('Invalid request:', error.message);
} else {
console.error('Unexpected error:', error);
}
}TypeScript types:
import type {
MagmaClientConfig,
BuyLiquidityOptions,
LiquidityOrderInput,
BuyLiquidityResponse
} from '@ambosstech/magma-mcp';Advanced Usage
For advanced use cases, you can access the low-level GraphQL client:
import { MagmaGraphQLClient } from '@ambosstech/magma-mcp';
const client = new MagmaGraphQLClient({
magmaApiKey: 'your-api-key',
magmaEndpoint: 'https://magma.amboss.tech/graphql',
logLevel: 'debug'
});
const response = await client.buyLiquidity({
connection_uri: '024ae5a5f0b01850983009489ca89c85...',
usd_cents: '1000',
options: {
private: true
}
});
// Full response structure
console.log(response.liquidity.buy.payment.lightning_invoice);Development
Run in development mode
pnpm devBuild
pnpm buildType checking
pnpm typecheckTest with MCP Inspector
The MCP Inspector is a great tool for testing your server:
pnpm inspectorThis will open a web interface where you can:
View available tools
Test tool execution
Inspect requests and responses
Debug errors
Testing
Manual Testing with Claude Desktop
Configure Claude Desktop with the MCP server
Restart Claude Desktop
Ask Claude to buy Lightning liquidity
Verify the response includes a Lightning invoice
Example Test Conversation
You: Can you buy $5 of Lightning liquidity for my node?
Claude: I'll help you buy Lightning liquidity. I need your node's connection URI in the format pubkey@host:port.
You: 024ae5a5f0b01850983009489ca89c85...@12.34.56.78:9735
Claude: [Executes buy_lightning_liquidity tool]
Claude: Successfully created liquidity order! Transaction ID: abc123...
Here's your Lightning invoice: lnbc...Troubleshooting
Server won't start
Check environment variables:
node -e "require('dotenv').config(); console.log(process.env.MAGMA_API_KEY)"Check build output:
ls -la dist/Authentication errors
Error: Authentication failed. Please check your MAGMA_API_KEY.
Solution:
If using an API key, verify it at https://account.amboss.tech/settings/api-keys
Ensure the key is correctly set in your
.envfile or Claude configCheck for extra spaces or quotes around the API key
Alternatively, remove the API key to use anonymous access (the API will create a temporary account automatically)
Connection URI validation errors
Error: Connection URI must be either a 66-character pubkey or pubkey@host:port format
Solution:
Ensure pubkey is exactly 66 hexadecimal characters
Accepted formats:
Just pubkey:
024ae5a5f0b01850983009489ca89c85...(no spaces)With socket:
pubkey@host:port(e.g.,024ae5...@12.34.56.78:9735)
If using socket format, port must be between 1-65535
Minimum purchase amount error
Error: Minimum purchase amount is $5.00 (500 cents)
Solution: Use at least 500 cents ($5.00) for the usd_cents parameter.
Project Structure
magma-mcp/
├── src/
│ ├── index.ts # Main MCP server entry point
│ ├── config.ts # Configuration with validation
│ ├── lib/
│ │ ├── graphql-client.ts # Magma API client
│ │ ├── tools/
│ │ │ └── buy-liquidity.ts # Buy liquidity tool handler
│ │ └── schemas/
│ │ ├── common-schemas.ts # Shared validation schemas
│ │ └── buy-liquidity-schema.ts # Buy tool schema
│ └── types/
│ └── magma.ts # TypeScript types
├── dist/ # Compiled JavaScript (generated)
├── package.json
├── tsconfig.json
└── README.mdSecurity
API keys are never logged - All logging goes to stderr and keys are sanitized
Environment-based configuration - API keys stored in
.envor MCP configInput validation - All inputs are validated before processing
Error sanitization - Errors never expose sensitive information
Contributing
Contributions are welcome! Please:
Fork the repository
Create a feature branch
Make your changes
Add tests if applicable
Submit a pull request
License
MIT License - see LICENSE file for details.
Links
Support
Issues: GitHub Issues
Documentation: Amboss Docs
Made with ⚡ by Amboss Technologies
Available Tools
1 toolbuy_lightning_liquidityA
Purchase inbound Lightning Network liquidity for a node via Amboss Magma.
This tool opens a channel TO your node, giving you receiving capacity. The liquidity purchase requires a minimum of $5.00 (500 cents).
Use this when you need to:
Increase your node's inbound liquidity
Accept Lightning payments
Open channels to your node
Parameters:
connection_uri: Your node's connection string (either just pubkey or pubkey@host:port) Examples:
024ae5a5f0b01850983009489ca89c85... (just pubkey)
024ae5a5f0b01850983009489ca89c85...@12.34.56.78:9735 (with socket)
usd_cents: Dollar amount in cents (minimum 500 = $5.00)
redirect_url: Optional URL to redirect after payment
private_channel: Optional boolean to create a private channel (default: false)
rails_cluster_only: Optional boolean to source only from Rails cluster (default: false)
Returns:
lightning_invoice: Lightning invoice to complete payment
| Name | Required | Description | Default |
|---|---|---|---|
| connection_uri | Yes | Node connection string: either just pubkey or pubkey@host:port | |
| usd_cents | Yes | Dollar amount in cents (minimum 500 = $5.00) | |
| redirect_url | No | Optional post-payment redirect URL | |
| private_channel | No | Create private channel (default: false) | |
| rails_cluster_only | No | Source liquidity only from Rails cluster nodes (default: false) |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations provided, but the description discloses key behaviors: it opens a channel, requires a minimum $5 payment, and returns a Lightning invoice. It does not detail failure modes or timeouts, but core behavioral traits are well-covered.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is well-structured with a header, bullet points for usage, a clear parameter list with examples, and a return section. Every sentence is informative with no fluff.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Despite no output schema, the description explains the return value. It covers all parameters, usage scenarios, and the tool's purpose comprehensively. No gaps for a purchase tool.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100% with descriptions. The description adds value with examples for connection_uri, clarifies minimum for usd_cents, and explains optional parameters with defaults. Exceeds baseline 3.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool purchases inbound Lightning Network liquidity via Amboss Magma, opening a channel to the node. It uses specific verbs and resources, distinguishing it from any potential siblings (none listed).
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description explicitly lists use cases: increase inbound liquidity, accept Lightning payments, open channels. While it doesn't mention when not to use it or alternatives, the context is clear and sufficient given no sibling tools.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.
1 tool update
v0.0.2- First observed
buy_lightning_liquidity
TDQS
With only one tool, there is no possibility of confusion between tools. The tool's purpose is clearly defined.
The single tool name 'buy_lightning_liquidity' is descriptive and follows a clear verb_noun pattern, consistent internally.
The tool count of 1 is on the low end for a server that likely requires additional operations (e.g., status checks). However, for a narrowly scoped single-action server, it is borderline acceptable.
The server covers only the purchase action. Missing lifecycle operations like listing pending purchases, checking status, or canceling orders leave significant gaps for an agent managing Lightning liquidity.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
Free Lightning faucet MCP — agents register, get an inbound channel, bootstrap an LDK node.
MCP server for Gainium — manage trading bots, deals, and balances via AI assistants
MCP server connecting AI agents to non-custodial staking data across 130+ networks.
HiveCapital MCP Server — autonomous investment layer for AI agents
Related MCP Servers
- AlicenseNot gradedqualityFmaintenanceEnables AI models to interact with the Lightning Network by providing an MCP-compliant API to pay invoices.206MIT
- AlicenseBqualityDmaintenanceAn MCP server to provide AI agents money functionalities via Nostr and Cashu.67717MIT
- AlicenseAqualityBmaintenanceMCP server that enables AI agents to make autonomous Bitcoin Lightning Network payments using the L402 protocol. Agents can pay for API access, purchase resources, and complete transactions without human intervention — invoice comes in, sats go out, done.179MIT
- AlicenseNot gradedqualityFmaintenanceMCP server that gives AI agents Lightning payments, L402 API access, trust verification, and service discovery.10MIT
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/AmbossTech/magma-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server