This quick start guide shows how to run a Bitrefill MCP agent as a portable service in a Meshagent Room and connect a chatbot to it.

1. Environment Variables

Set the following environment variables for Bitrefill API authentication:

  • BITREFILL_API_ID: your_api_id_here
  • BITREFILL_API_SECRET: your_api_key_here

2. Install Meshagent

pip install "meshagent[all]"

3. Authenticate and Set Up

4. Start Bitrefill MCP Server in a Meshagent Room

meshagent service test \
  --room=test \
  --role=agent \
  --image=meshagent/mcp-bitrefill:latest \
  --env MESHAGENT_PORT=8001 \
  --env BITREFILL_API_ID=your_api_id_here \
  --env BITREFILL_API_SECRET=your_api_key_here \
  --port="num=8001 path=/webhook liveness=/ type=meshagent.callable" \
  --name=mcp-bitrefill-service

This command will start a Meshagent room with the Bitrefill MCP server available in the room. Rooms close if they go inactive.

5. Connect a Chatbot to the Bitrefill Toolkit

meshagent chatbot join \
  --room=test \
  --agent-name=sample \
  --name=sample \
  --toolkit=mcp-bitrefill
  • This joins a chatbot to the specified Meshagent room and makes the Bitrefill toolkit available to it.
  • Multiple toolkits can be loaded by the same agent in a room.
  • The room link will be displayed in your output; use it to interact live with the agent and tools!

Tools Available

A summary and details of all tools exposed by the Bitrefill MCP Server via the Meshagent Room:

ToolDescription
categoriesGet the full product type/categories map.
create_invoiceCreate a new invoice for purchasing products with various payment methods.
detailGet detailed information about a product.
get_account_balanceRetrieve your account balance.
get_invoiceRetrieve details for a specific invoice by ID.
get_invoicesRetrieve a list of invoices with optional filtering.
get_orderRetrieve details for a specific order by ID.
get_ordersRetrieve a list of orders with optional filtering.
pay_invoicePay an unpaid invoice (only works with ‘balance’ payment method).
pingCheck if the Bitrefill API is available.
searchSearch for gift cards, esims, mobile topups, and more.
unseal_orderReveal codes and PINs for a specific order by ID.

Tool Details

categories

Get the full product type/categories map. It’s suggested to use this tool to get the categories and then use the search tool to search for products in a specific category.

create_invoice

Create a new invoice for purchasing products with various payment methods

ParameterTypeDescription
payment_methodstringRequired payment method. Available: balance, lightning, bitcoin, eth_base, usdc_base
productsarrayArray of products to include in the invoice
auto_payboolean (optional)Automatically pay with balance
webhook_urlstring (optional)URL for webhook notifications

detail

Get detailed information about a product

ParameterTypeDescription
idstringUnique identifier of the product

get_account_balance

Retrieve your account balance

get_invoice

Retrieve details for a specific invoice by ID

ParameterTypeDescription
idstringUnique invoice identifier

get_invoices

Retrieve a list of invoices with optional filtering

ParameterTypeDescription
afterstring (optional)Start date for results (YYYY-MM-DD HH:MM:SS)
beforestring (optional)End date for results (YYYY-MM-DD HH:MM:SS)
limitinteger (optional)Maximum records (max/default: 50)
startinteger (optional)Start index (default: 0)

get_order

Retrieve details for a specific order by ID

ParameterTypeDescription
idstringUnique order identifier

get_orders

Retrieve a list of orders with optional filtering

ParameterTypeDescription
afterstring (optional)Start date for results (YYYY-MM-DD HH:MM:SS)
beforestring (optional)End date for results (YYYY-MM-DD HH:MM:SS)
limitinteger (optional)Maximum records (max/default: 50)
startinteger (optional)Start index (default: 0)

pay_invoice

Pay an unpaid invoice (only works with ‘balance’ payment method)

ParameterTypeDescription
idstringUnique invoice identifier

ping

Check if the Bitrefill API is available

Search for gift cards, esims, mobile topups and more. It’s suggested to use the categories tool before searching.

ParameterTypeDescription
querystringSearch query (e.g., ‘Amazon’, ‘Netflix’, ’*’ for all)
beta_flagsstring (optional)Beta feature flags
cartstring (optional)Cart identifier
categorystring (optional)Filter by category
colnumber (optional)Column layout parameter
countrystring (optional)Country code (e.g., ‘US’, ‘IT’, ‘GB’)
do_recommendnumber (optional)Enable recommendations
languagestring (optional)Language code for results (e.g., ‘en’)
limitnumber (optional)Max results
prefccnumber (optional)Preferred country code param
recnumber (optional)Recommendation parameter
secnumber (optional)Security parameter
skipnumber (optional)Pagination
srcstring (optional)Source of request

unseal_order

Reveal codes and PINs for a specific order by ID

ParameterTypeDescription
idstringUnique order identifier

Further Reading and Resources