Model Context Protocol (MCP) server for Revenium API monitoring, analytics, and AI spending management
pip install revenium-mcp==0.7.0 Copy PIP instructions
Connect AI agents to Revenium for cost tracking, alerting, and usage-based billing
Once you've connected your AI applications to Revenium using any of the supported middleware libraries or via direct API integration, this MCP server allows agents to directly interact with your Revenium account. Connect Claude, OpenAI, or any MCP-compatible AI assistant to Revenium to configure AI cost alerts & tracking as well as usage-based billing for AI products.
If or when you're ready to turn AI costs into AI revenue, the Revenium MCP will be there to help quickly make the transition.
The MCP provides the appropriate tools for each use case depending on your chosen startup profile:
Revenium hosts the MCP server at https://mcp.revenium.ai/mcp. Authentication is an OAuth sign-in in your browser — no API key to copy and no local process to manage.
claude mcp add --transport http revenium https://mcp.revenium.ai/mcp Then run /mcp inside Claude Code and choose Authenticate to complete the browser sign-in.
claude.ai (web & desktop): Settings → Connectors → Add custom connector → paste https://mcp.revenium.ai/mcp.
Cursor and other MCP clients with remote-server support:
{ "mcpServers": { "revenium": { "url": "https://mcp.revenium.ai/mcp" } } } Some clients declare the transport explicitly — if yours does, set its type/transport field to HTTP (for example "type": "http" in VS Code).
Clients that only speak stdio can bridge with mcp-remote:
npx mcp-remote https://mcp.revenium.ai/mcp Prefer to run the server yourself? Use any of the local options below.
claude mcp add revenium \ -e REVENIUM_API_KEY=hak_your_api_key_here \ -- uvx revenium-mcp Done! Claude Code will manage the configuration.
cat > .env << EOF REVENIUM_API_KEY=hak_your_api_key_here TOOL_PROFILE=starter EOF Run the server:
uvx revenium-mcp See Installation for Cursor, Augment, and other integrations.
Build and run the MCP server in a container. Useful for hosted HTTP deployments and CI integration. Clone this repository first, then from the repo root:
docker build -t revenium-mcp . docker run -d --name revenium-mcp \ -p 8000:8000 \ -e AUTH_MODE=api_key \ -e REVENIUM_BASE_URL=https://api.revenium.ai \ -e MCP_SERVER_BASE_URL=https://mcp.your-domain.com \ revenium-mcp In api_key mode there is no server-wide REVENIUM_API_KEY — each caller authenticates with their own Revenium key (rev_sk_ write or rev_rk_ read), sent as an Authorization: Bearer header and validated per request against the platform.
The container runs as a non-root user (mcp, UID 1000). Health probes:
Local multi-tenant deployment with Caddy doing TLS termination.
cp .env.example .env # Edit .env — set AUTH_MODE=api_key, REVENIUM_BASE_URL=https://api.revenium.ai, # and MCP_SERVER_BASE_URL=https://localhost:8443 docker compose up --build Endpoints:
First-time TLS: Caddy generates a self-signed cert via its internal CA. Browsers will warn "untrusted certificate". The cert is cryptographically valid — accept the warning for local dev. If you need the cert trusted system-wide, extract the root CA from the caddy_data volume and add it to your OS trust store using the OS-specific procedure (out of scope for this README).
The cert persists in the caddy_data volume between runs.
docker compose down To wipe state (including the cert):
docker compose down -v Connecting a client to the local compose stack Once the compose stack is running, point any MCP client that supports remote HTTP servers at the endpoint and send your Revenium key as a bearer token (for a hosted deployment, replace https://localhost:8443 with your server's public URL):
{ "mcpServers": { "revenium": { "url": "https://localhost:8443/mcp", "headers": { "Authorization": "Bearer rev_sk_your_key_here" } } } } Clients that only speak stdio can use the mcp-remote shim.
TLS note for Node-based clients (including mcp-remote): Caddy signs localhost with its internal CA, which Node.js does not trust by default. Export the root CA from the caddy_data volume and pass it via NODE_EXTRA_CA_CERTS=/path/to/caddy-root.crt, or — for a quick local-only workaround, never in production — set NODE_TLS_REJECT_UNAUTHORIZED=0. See the "First-time TLS" note above for the browser equivalent.
Implements Model Context Protocol revision 2026-07-28 — the LATEST_PROTOCOL_VERSION of the pinned mcp SDK, which is what the server negotiates. Earlier revisions (including 2025-11-25 and 2025-06-18) are still served to older clients.
When you use this MCP server, the following data flows between your AI assistant and Revenium:
The MCP server uses environment variables for configuration. The method you use depends on your setup:
Important: Don't mix methods. Choose the one that matches your use case:
No install needed for most users: the hosted server at https://mcp.revenium.ai/mcp works with any remote-capable MCP client — see Connect to the Hosted Server. The steps below are for running the server locally.
Option 1: Installation with uvx (Recommended for local testing)
# Install uv if you don't have it pip install uv # Create .env file cat > .env << EOF REVENIUM_API_KEY=hak_your_api_key_here TOOL_PROFILE=starter EOF # Run the server (automatically loads .env) uvx revenium-mcp Option 2: Package Installation in Virtual Environment
# Create and activate virtual environment python -m venv revenium-mcp-env source revenium-mcp-env/bin/activate # On Windows: revenium-mcp-env\Scripts\activate # Install package pip install revenium-mcp # Create .env file for configuration cat > .env << EOF REVENIUM_API_KEY=hak_your_api_key_here TOOL_PROFILE=starter EOF # Run the server (automatically loads .env from current directory) python -m revenium_mcp_server Note: The .env file should be in the directory where you run the server. Never commit .env to version control.
The MCP server supports two profiles to match your use case:
The server uses the Starter profile by default. To use the Business profile, set the TOOL_PROFILE environment variable:
# Starter Profile (7 tools) - Cost monitoring, alerts, AI metering integration (default) cat > .env .env << EOF REVENIUM_API_KEY=hak_your_api_key_here TOOL_PROFILE=business EOF uvx revenium-mcp For Claude Code Choose one of the following integration methods. Both use the Starter profile by default. To use the Business profile, add -e TOOL_PROFILE=business to the command:
{ "mcpServers": { "revenium": { "command": "uvx", "args": ["revenium-mcp"], "env": { "REVENIUM_API_KEY": "hak_your_api_key_here" } } } } Basic Usage After installation, the MCP server provides tools to your AI assistant. Simply ask natural language questions:
"Summarize my AI costs for the last month" "Show me a breakdown of costs by provider" "Alert me when monthly costs for Anthropic exceed $500" "Why did my costs spike yesterday?" Slack Integration Examples "Set up Slack notifications for cost alerts" "Send all cost alerts to #ai-spending channel" "Create a spike detection alert that notifies my team on Slack" Analytics Examples "Analyze cost anomalies in the last 7 days" "Find API key anomalies using aggressive sensitivity" "Show me cost trends for the last month" "Detect what caused my cost increase yesterday" AI Metering Integration "Get Python integration guide for AI transaction metering" "Help me integrate this Python AI function with Revenium" "Generate test transaction data and verify it's processing correctly" See AI Cost Analytics & Alerting Tools for complete tool descriptions.
The MCP server provides different tool sets based on your selected profile:
Set up intelligent monitoring for costs, usage, and performance metrics.
Detect percentage-based cost changes over configurable time periods. Use RELATIVE_CHANGE alerts with INCREASES_BY or DECREASES_BY operators to catch trends before they become problems.
"Alert me if weekly AI costs increase by more than 25%" "Create a relative change alert that triggers when monthly spend decreases by 15%" "Set up a daily trend alert — notify me on Slack if costs increase by 10% day over day" Slack Integration Example: "Set up a Slack notification channel for Revenium alerts" Example: "Add a new slack channel for all customer spending alerts" Example: "Send all product spending anomalies to the Slack channel #product-spend-alerts." AI Business Analytics Analyze costs, usage patterns, and performance.
"Detect small but significant anomalies to identify early changes in behavior before they become large issues"
Track AI usage, token consumption, and transaction data with comprehensive integration guidance.
Get assistance creating a new custom integration from your AI agents to Revenium
Get comprehensive implementation guidance with working code examples for Python and JavaScript
Submit AI transaction data and verify successful processing
Example: "Get Python integration guide with working code examples for AI transaction metering"
Example: "Get JavaScript integration guide with Revenium documentation"
Example: "Check the status of transaction tx_12345"
Example: "Help me integrate this python AI function with Revenium's AI metering API"
Example: "Generate test transaction data from our application and ensure all metadata is properly mapped in Revenium."
Track AI agent job execution, measure ROI, and report business outcomes. Jobs represent units of AI agent work; outcomes capture the business value delivered.
Note: When referencing jobs, use the agenticJobId field as the job_id parameter.
"List all AI agent jobs from the last 7 days" "Show me the ROI for job aj_abc123" "Report a successful outcome for job aj_xyz789 with revenue of $150" "Show the conversion funnel for jobs this month" Usage-Based Billing Tools (Business Profile Only) Product Management Create and manage your AI products, pricing tiers, and billing models.
Handle customer relationships, organizations, and user hierarchies.
Manage customer or internal organizations used for cost attribution
Create & manage subscribers (internal or external)
Example: "List all organizations and their subscription status"
Control customer subscriptions, billing cycles, and plan changes.
Register, manage, and analyze AI tools in the Revenium Tool Registry with pricing tiers, event metering, and analytics.
"Register a new tool called 'sentiment-analyzer' with per_call pricing at $0.02 per call" "Create a tool 'doc-summarizer' with tiered pricing — free up to 100 calls, then $0.01 each" "List all registered tools in the tool registry" "Show me tool analytics for the last 30 days" "Search for tools related to 'translation'" Configuration Options Required Configuration Variable Required Description Example REVENIUM_API_KEY ✅ Your account API key from the API Keys page in Revenium hak_1234567890abcdef Automatically Loaded Values These values are loaded from your account and can be overridden if needed:
You can override the automatically loaded values if needed:
The system loads configuration values in this priority order:
Use the system_diagnostics tool to see exactly which values are being used from each source.
Issue: MCP server not appearing in AI assistant Solution: Verify installation with uvx revenium-mcp --version and check MCP client configuration
Issue: Authentication errors Solution: Verify API key based on your setup:
# Check if .env exists and contains your key cat .env | grep REVENIUM_API_KEY # Verify the server can load it (run from project directory) python -c "import os; from dotenv import load_dotenv; load_dotenv(); print('API Key:', os.getenv('REVENIUM_API_KEY', 'NOT FOUND')[:20] + '...')" For Claude Code:
claude mcp list # Verify configuration includes API key For Cursor/Augment: Check your MCP JSON config file includes REVENIUM_API_KEY in the env section.
For any setup: Use the system_diagnostics tool to see exactly which configuration values are being used.
Issue: Tools not working as expected Solution: Check you're using the correct profile (Starter vs Business) for your use case
For detailed documentation, visit docs.revenium.io
We welcome contributions! Please see CONTRIBUTING.md for guidelines on:
This project adheres to a Code of Conduct to ensure a welcoming and inclusive community. See CODE_OF_CONDUCT.md for details.
Security is a top priority. For security concerns, please see SECURITY.md for:
This project is licensed under the MIT License. See LICENSE for full details.
# Clone repository git clone https://github.com/revenium/revenium-mcp.git cd revenium-mcp # Create virtual environment python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate # Install dependencies (including dev dependencies) pip install -e ".[dev]" # Create .env file for development cat > .env << EOF REVENIUM_API_KEY=hak_your_api_key_here REVENIUM_TEAM_ID=your_team_id LOG_LEVEL=DEBUG EOF # Verify .env is loaded python -c "import os; from dotenv import load_dotenv; load_dotenv(); print(f'API Key loaded: {os.getenv(\"REVENIUM_API_KEY\", \"NOT FOUND\")[:20]}...')" # Run tests pytest # Run linters black . isort . mypy . flake8 Important: Never commit your .env file. The repository includes .env.example as a template.
# Run all tests pytest # Run with coverage pytest --cov=revenium_mcp_server --cov-report=html # Run specific test file pytest tests/test_auth.py Contributing See CONTRIBUTING.md for detailed development guidelines including:
Built by the Revenium team with contributions from the community.
mcp revenium api ai assistant cli server model-context-protocol anthropic claude
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.




