A TypeScript-based MCP server that provides access to Bitrefill services, allowing you to search for gift cards, mobile topups, and more. This server implements the Model Context Protocol to expose Bitrefill functionality to AI assistants.
How It Works
The server operates using the Model Context Protocol (MCP) to communicate with Claude and similar AI assistants. It:
Runs as a standalone process using stdio for communication
Registers resources and tools for accessing Bitrefill services
Interfaces with the Bitrefill API to provide product search and details
Returns structured JSON responses that can be processed by AI assistants
Architecture
The app server follows this architecture:
Features
Resources
`bitrefill://product-types` - List of available product types on Bitrefill
`bitrefill://categories/{type}` - List of available categories for a specific product type (e.g., `bitrefill://categories/gift-cards`)
Tools
`search` - Search for gift cards, esims, mobile topups and more
- Required: `query` (e.g., 'Amazon', 'Netflix', 'AT&T' or '*' for all)
- Optional: `country`, `language`, `limit`, `skip`, `category`
`detail` - Get detailed information about a product
- Required: `id` (product identifier)
`categories` - Get the full product type/categories map
- No required parameters
`create_invoice` - Create a new invoice for purchasing products (requires API key)
- Required: `products` (array of products to include in the invoice)
- Each product requires: `product_id`
- Optional product fields: `quantity`, `value`, `package_id`, `phone_number`, `email`, `send_email`, `send_sms`
- Required: `payment_method` (one of: "balance", "bitcoin", "lightning")
- Optional: `webhook_url`, `auto_pay`
`get_invoices` - Retrieve a list of invoices with optional filtering
- Optional: `start`, `limit`, `after`, `before`
`get_invoice` - Retrieve details for a specific invoice by ID
- Required: `id` (invoice identifier)
`pay_invoice` - Pay an unpaid invoice (only works with 'balance' payment method)
- Required: `id` (invoice identifier)
`get_orders` - Retrieve a list of orders with optional filtering
- Optional: `start`, `limit`, `after`, `before`
`get_order` - Retrieve details for a specific order by ID
- Required: `id` (order identifier)
`unseal_order` - Reveal codes and PINs for a specific order by ID
- Required: `id` (order identifier)
`get_account_balance` - Retrieve your account balance
- No required parameters
`ping` - Check if the Bitrefill API is available
- No required parameters
Configuration
API Key Setup
To use the all the tools that rely on the Bitrefill API except for `search`, `categories` and `detail`, you need to set up Bitrefill API credentials:
Create a Bitrefill account
Ask for a developer API key by filing a request on [this form](https://bitrefill.typeform.com/to/BDmIVEsH?typeform-source=www.github.com)
Create a `.env` file in the root directory (you can copy from `.env.example`)
Add your Bitrefill API credentials:
```
BITREFILL_API_SECRET=your_api_key_here
BITREFILL_API_ID=your_api_id_here
```
The `create_invoice` tool will only be available if the API credentials are set. If the API credentials are not set, the tool will not be registered and won't appear in the list of available tools.
Development
Install dependencies:
Build the server:
For development with auto-rebuild:
Debugging
Since MCP servers communicate over stdio, debugging can be challenging. We recommend using the [MCP Inspector](https://github.com/modelcontextprotocol/inspector), which is available as a package script:
The Inspector will provide a URL to access debugging tools in your browser.
Installation
Installing via Smithery
To install Bitrefill for Claude Desktop automatically via [Smithery](https://smithery.ai/server/@bitrefill/bitrefill-mcp-server):