Model Context Protocol (MCP) server for UgarAPI - enables AI agents to discover and use UgarAPI services with Bitcoin Lightning payments.
Exposes UgarAPI's services as MCP tools that AI systems (Claude, ChatGPT, etc.) can discover and use automatically:
- extract_web_data - Extract structured data from websites using CSS selectors
- timestamp_document - Create blockchain timestamp proofs for documents
- aggregate_api_call - Route requests through external APIs with failover
All payments are handled automatically via Bitcoin Lightning micropayments.
- Install via npm:
npm install -g ugarapi-mcp-server- Add to your MCP settings file:
Claude Desktop (macOS): ~/Library/Application Support/Claude/claude_desktop_config.json
Claude Desktop (Windows): %APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"ugarapi": {
"command": "ugarapi-mcp",
"env": {
"UGARAPI_BASE_URL": "https://ugarapi.com"
}
}
}
}-
Restart Claude Desktop
-
Claude can now use UgarAPI services automatically!
git clone https://github.com/yourusername/ugarapi-mcp-server
cd ugarapi-mcp-server
npm install
node ugarapi-mcp-server.jsOnce installed, AI agents can use your services naturally:
User: "Extract the title and price from https://example.com/product"
Claude: [calls extract_web_data tool]
- Creates Lightning invoice (1000 sats)
- Pays automatically
- Returns extracted data
User: "Timestamp this document hash: abc123..."
Claude: [calls timestamp_document tool]
- Creates Lightning invoice (5000 sats)
- Pays automatically
- Returns blockchain proof
User: "What's the weather in Tokyo?"
Claude: [calls aggregate_api_call tool]
- Creates Lightning invoice (200 sats)
- Pays automatically
- Returns weather data
- First Call: MCP server creates a Lightning invoice for the service
- Payment: Invoice is paid automatically (in production, you'd configure a Lightning wallet)
- Service Call: Once paid, the service executes
- Idempotency: Same requests won't be charged twice (cached for 24 hours)
Environment variables:
UGARAPI_BASE_URL- UgarAPI API endpoint (default: https://ugarapi.com)
For production use with real payments, you need:
- Lightning Wallet - Set up a wallet that can pay invoices programmatically
- Auto-Payment Logic - Configure the MCP server to pay invoices automatically
- Spending Limits - Set maximum spend per hour/day to prevent runaway costs
See docs/payment-setup.md for detailed instructions.
✅ Idempotency - Safe retries, no double charges
✅ Rate Limiting - Respects UgarAPI rate limits
✅ Error Handling - Clear error messages for agents
✅ Receipts - Full transaction history
✅ Audit Trail - All calls are logged
Run in development mode:
npm startTest with MCP Inspector:
npx @modelcontextprotocol/inspector node ugarapi-mcp-server.jsOnce tested:
- Publish to npm:
npm publish- Submit to MCP registry:
# Follow instructions at https://github.com/modelcontextprotocol/servers- AI systems can now discover UgarAPI automatically!
- Automatic Lightning payment integration
- Spending limit controls
- Multi-agent usage tracking
- Advanced caching strategies
- Support for more UgarAPI services as they launch
- UgarAPI Docs: https://ugarapi.com/docs
- Issues: https://github.com/yourusername/ugarapi-mcp-server/issues
- Email: support@ugarapi.com
MIT License - see LICENSE file for details