Skip to main content

MCP Server for Claude / Stdio transport

Project description

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"

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mcp_server_stdio-0.1.9.tar.gz (48.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mcp_server_stdio-0.1.9-py3-none-any.whl (10.0 kB view details)

Uploaded Python 3

File details

Details for the file mcp_server_stdio-0.1.9.tar.gz.

File metadata

  • Download URL: mcp_server_stdio-0.1.9.tar.gz
  • Upload date:
  • Size: 48.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.2

File hashes

Hashes for mcp_server_stdio-0.1.9.tar.gz
Algorithm Hash digest
SHA256 536e73561f7d51d6fa45f013196a67069f268c632a5f4844ec56df3a6d306e7b
MD5 a257a79fd90f44f39c56ed6bf9de20b8
BLAKE2b-256 c0543476516efaa21c491e32ce23119a0521df3ef26743cda26701670b3b5020

See more details on using hashes here.

File details

Details for the file mcp_server_stdio-0.1.9-py3-none-any.whl.

File metadata

File hashes

Hashes for mcp_server_stdio-0.1.9-py3-none-any.whl
Algorithm Hash digest
SHA256 bc8328e562886110367851ddad76e2b5fbea8601e6a69ecf232e292e8729c5d0
MD5 9f65fe57f5a494809461cbf0556b6c8e
BLAKE2b-256 8f6c1016ab23200d81b51e37419bb6998264f6dbd10eb6feae3b090cedce80b8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page