ai-credits-mcp
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@ai-credits-mcphow many AI credits has my tenant used this month?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
ai-credits-mcp
MCP server that exposes AI credit usage data from OpenMeter to the TAIS AI chat service. Queries are automatically scoped to the calling tenant and restricted to admin users.
Tools
All tools require the caller to be in the Administrators group. Each tool returns a markdown table (for the LLM to summarise) and a [Download Excel](url) link pointing to a temporary .xlsx file served at /download/<token>. The link expires after 10 minutes. They are automatically scoped to the calling user's tenant — no tenant parameter is exposed.
If the request exceeds 50 rows in the text preview, the table is truncated with a note to see the Excel file for the full dataset.
get_credit_usage_by_tenant
Returns total credits consumed by the tenant as a single aggregated number.
Parameter | Type | Required | Description |
| string | No | ISO 8601 start, e.g. |
| string | No | ISO 8601 end (defaults to now) |
Output columns: tenant, credits
Example prompts:
"How many AI credits has my tenant used?"
"What's our total credit spend this month?"
get_credit_usage_summary
Returns credits broken down by user, module, product, and skill — useful for identifying who or what is consuming the most credits.
Parameter | Type | Required | Description |
| string | No | ISO 8601 start |
| string | No | ISO 8601 end (defaults to now) |
Output columns: user, module, product, tenant, skill, credits
Example prompts:
"Show me credit usage broken down by user."
"Which product or skill is using the most credits?"
"Give me a credit usage summary for Q1 2026."
get_credit_events
Returns individual raw credit events — the lowest level of detail, one row per event.
Parameter | Type | Required | Description |
| string | No | ISO 8601 start |
| string | No | ISO 8601 end (defaults to now) |
Output columns: time, user, module, product, tenant, credits
Example prompts:
"Show me all credit events from last week."
"What happened on January 15th in terms of AI usage?"
How the AI decides which tool to call
When you ask about credit usage in the AI chat, the model picks the appropriate tool automatically:
Totals / "how much overall" →
get_credit_usage_by_tenantBreakdowns by user / module / skill →
get_credit_usage_summaryIndividual events / audit trail →
get_credit_events
If no date range is specified, the last 7 days are used by default. To change the range, phrase your question naturally: "...for January 2026" or "...since last month" — the model will translate this to ISO 8601 parameters.
Related MCP server: cloudscope-mcp
Security
Invariant | Enforcement |
Admin-only access |
|
Tenant-scoped |
|
Tenant header absent | Returns an error — no data is exposed |
| Only used inside |
The TAIS chatbot-agent-service forwards both headers automatically on every MCP connection.
Running locally
Prerequisites: Python 3.11+, uv
cd ai-credits-mcp
uv sync # install dependencies
cp .env.example .env # add your OPENMETER_API_KEY
uv run main.py
# Server starts at http://localhost:8765Health check:
curl http://localhost:8765/health
# {"status": "ok"}AI chat integration
Use the registration script to register the tool and wire it to a TAIS session:
bash scripts/register.shThe script reads TAIS_JWT from .env, decodes the tenant and user automatically, registers the tool against the local TAIS API, and PATCHes the session. If TAIS_SESSION_ID is not set in .env it will prompt you interactively.
Note: registered tools expire after ~1 hour. Re-run the script when the tool stops responding.
To wire to a session manually:
PATCH http://localhost:5001/api/v2/sessions-service/{sessionId}
Authorization: Bearer <token>
Content-Type: application/json
{"toolIds": ["<tool-id-from-registration>"]}Environment variables
Variable | Required | Description |
| Yes | OpenMeter API key |
| No | Port to listen on (default: |
| No | JWT for |
| No | Session to wire the tool to; script prompts if absent |
| No | Dev only — overrides |
| No | Dev only — overrides |
Project structure
ai-credits-mcp/
├── server.py # FastMCP server, tools, middleware, download endpoint
├── main.py # uvicorn entry point
├── scripts/
│ └── register.sh # registers tool with TAIS and wires it to a session
├── pyproject.toml # dependencies (mcp, uvicorn, openpyxl, python-dotenv)
└── .env.example # environment variable templateserver.py imports query_credits from the sibling ai-credit-usage/ directory, which handles all OpenMeter API calls.
Aspire registration
Registered in apphost.cs as:
var aiCreditsMcp = builder.AddPythonApp("ai-credits-mcp", "/Users/a.demers/dev/ai-credits-mcp", "main.py")
.WithUv()
.WithEnvironment("PYTHONPATH", ".")
.WithHttpEndpoint(port: 8765, env: "MCP_PORT", isProxied: false)
.WithHttpHealthCheck("/health")
.WithEnvironment("OPENMETER_API_KEY", Environment.GetEnvironmentVariable("OPENMETER_API_KEY") ?? "");Add OPENMETER_API_KEY=<your-key> to the workspace-root .env file.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/ADemers-tricentis/ai-credits-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server