Skip to main content

Billing Service MCP Server

A Model Context Protocol (MCP) server that exposes billing information from your StackBill API.

Setup

Prerequisites

  • Python 3.14+
  • uv package manager (or pip)

Installation

# Install dependencies
uv pip install -r requirements.txt

Or if using pip directly:

pip install fastmcp httpx

Running the Server (stdio transport)

This project now runs as an MCP stdio server (MCP messages over stdin/stdout). Start the server with:

python -m app.main

The server communicates over standard input/output and is intended to be launched by an MCP-capable client (for example, a desktop assistant or a tool runner that spawns the process and talks MCP over stdio). If you previously used mcp-inspector or other HTTP-based tools, note that those expect an HTTP endpoint; for stdio you should configure your MCP client to execute the command above.

For Claude Desktop or a similar client that accepts a command, use the configuration example in the "Configuration" section below to point the client at this process.

4. Query Billing Information

In the mcp-inspector interface, call the get_billing_summary tool with your parameters:

Example 1: Get current month billing

{
  "domain_uuid": "4ca-d-823",
  "zone_uuid": "e5b0-50b-ff-8e2-f2817"
}

Example 2: Get billing for specific date range

{
  "domain_uuid": "4ca-d-823",
  "zone_uuid": "e5b0-50b-ff-8e2-f2817",
  "from_date": "03-11-2025 00:00",
  "to_date": "20-11-2025 00:00",
  "lang": "en"
}

Tool Reference

get_billing_summary

Fetch billing summary for a specified date range.

Parameters:

  • domain_uuid (required): Your domain UUID (e.g., "4ca-d-823")
  • zone_uuid (required): Your zone UUID (e.g., "e5b0-50b-ff-8e2-f2817")
  • from_date (optional): Start date in format DD-MM-YYYY HH:MM. Defaults to 1st of current month
  • to_date (optional): End date in format DD-MM-YYYY HH:MM. Defaults to today
  • lang (optional): Language code (default: "en")
  • auth_token (optional): Bearer token or API key for authentication. Can be raw token or "Bearer "

Returns:

{
  "status": "success",
  "data": { /* billing data from API */ },
  "date_range": {
    "from": "03-11-2025 00:00",
    "to": "20-11-2025 00:00"
  }
}

get_usage_cost_details

Fetch usage cost details for a specific zone.

Parameters:

  • zone_id (required): Zone ID (e.g., "1")
  • lang (optional): Language code (default: "en")
  • auth_token (optional): Bearer token or API key for authentication. Can be raw token or "Bearer "

Returns:

{
  "status": "success",
  "data": { /* usage cost details from API */ },
  "zone_id": "1"
}

Example in mcp-inspector:

{
  "zone_id": "1",
  "lang": "en",
  "auth_token": "your-api-token-here"
}

How It Works

  1. You ask via mcp-inspector: "What is my billing for this month?"
  2. mcp-inspector calls: get_billing_summary() with your domain and zone UUIDs
  3. The tool:
    • Sets default date range to current month if not specified
    • Constructs the API request to: http://demo.example.com/apidocs/api/usage/offeringusagereport/summaryreport
    • Passes parameters: fromDate, toDate, domainUuid, zoneUuid, type, lang
    • Returns the billing summary response

Integration with Claude/Other AI Assistants

Once this MCP server is configured in your AI assistant (Claude, etc.), you can ask questions like:

  • "What is my billing for this month?"
  • "Show me the usage charges from Nov 3 to Nov 20, 2025"
  • "What's my current bill for domain 4ca-d-823?"
  • "What are the usage cost details for zone 1?"
  • "Show me the cost breakdown for my zones"

The assistant will automatically use this MCP tool to fetch the data.

Configuration

To configure this with Claude Desktop, add to claude_desktop_config.json:

{
  "mcpServers": {
    "billing": {
      "command": "python",
      "args": ["/path/to/main.py"]
    }
  }
}

Error Handling

The tool returns a structured response:

  • Success: Returns billing data with status "success"
  • Error: Returns error details with status "error"

401 Unauthorized Error

If you receive a 401 error, the API requires authentication. Use the auth_token parameter:

{
  "zone_id": "1",
  "auth_token": "your-api-token"
}

The token will be sent as a Bearer token in the Authorization header. You can provide:

  • Just the token: "your-token" → becomes Authorization: Bearer your-token
  • Or pre-formatted: "Bearer your-token" → sent as-is

Testing

You can test the endpoint directly:

curl "http://demo.example.com/apidocs/api/usage/offeringusagereport/summaryreport?fromDate=03-11-2025%2000:00&toDate=20-11-2025%2000:00&domainUuid=4ca-d-823&zoneUuid=e5b0-50b-ff-8e2-f2817&type=json&lang=en"

Metadata

Release files for mcp-server-stdio 0.1.10

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mcp-server-stdio 0.1.10
File Size Uploaded Provenance
mcp_server_stdio-0.1.10.tar.gz 48.3 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for mcp-server-stdio 0.1.10
File Interpreter ABI Platform
mcp_server_stdio-0.1.10-py3-none-any.whl Python 3 none any Details

Total release size: 58.3 kB

Release files / mcp_server_stdio-0.1.10.tar.gz

Download URL mcp_server_stdio-0.1.10.tar.gz
Size 48.3 kB
Tags Source
SHA-256 checksum
How to use checksums
d73c893469f51e751c528c40bae5d6373d10878221f53d45cb3cf21b707d434f
BLAKE2b-256 checksum
How to use checksums
f6cd1677abdabda865e974b0150746b7a6194b044a2db62a26e711dd2db422b1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.2

Release files / mcp_server_stdio-0.1.10-py3-none-any.whl

Download URL mcp_server_stdio-0.1.10-py3-none-any.whl
Size 10.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0e184c7e55a6fc15d10aec492ce5f316a49b9ad41fe820f7e8c0b640d0874ec7
BLAKE2b-256 checksum
How to use checksums
a7f2e9a4836a7539dd835457f05a03f6ac2f606639222cdf77df8a5d068b0480
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.2

Security for mcp-server-stdio 0.1.10

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page