trackmcp
Back to directory
codeChap

mcp-server-grok-management

View on GitHub

MCP server for the xAI Management API — API keys, ACLs, audit logs, and billing

0 stars RustOthers Updated Aug 26, 2026

Documentation

mcp-server-grok-management

MCP server for the xAI Management API (`management-api.x.ai`) — team API keys

and billing, over stdio. Pure Rust binary.

Auth uses a management key (not an inference API key) from

console.x.aiSettings → Management Keys.

For day-to-day spend questions, start with `billing_overview`.

Tools (23)

Billing (primary)

ToolAccessNotes
`billing_overview`readDashboard: period spend, headroom, limits, prepaid, PMs, contact
`get_invoice_preview`readThis month’s postpaid spend + product breakdown
`get_spending_limits`readSoft/hard limits in USD
`set_spending_limit`writeSoft limit in cents; `confirm="YES-WRITE"`
`get_prepaid_balance`readCredit ledger
`top_up`writeCharge default PM; `confirm="TOP-UP"`
`list_payment_methods`readCards / Stripe Link (add cards in console)
`set_default_payment_method`write`confirm="YES-WRITE"`
`get_billing_info`readName / email / address
`set_billing_info`write`confirm="YES-WRITE"`
`list_invoices`readOptional year/month/since/invoice_ids filters
`get_invoice`readOne invoice + line items
`get_usage`readAnalytics (usd sum, group_by, timezone)

API keys

`validate_key`, `list_api_keys`, `create_api_key`, `update_api_key`,

`delete_api_key` (`DELETE`), `rotate_api_key` (`ROTATE`), `check_propagation`,

`list_models`, `list_endpoints`

Audit

`list_audit_events`

Safety gates

ToolRequired `confirm`
`delete_api_key``"DELETE"`
`rotate_api_key``"ROTATE"`
`set_spending_limit``"YES-WRITE"`
`set_billing_info``"YES-WRITE"`
`set_default_payment_method``"YES-WRITE"`
`top_up``"TOP-UP"` (charges card)

Money fields are USD cents (e.g. `10000` = $100.00).

Write billing tools need BillingWrite (or full access) on the management key.

`validate_key` reports whether BillingWrite is listed on the key’s ACLs.

Configuration

`~/.config/mcp-server-grok-management/config.toml` (`chmod 600`):

toml
management_key = "xai-..."   # console.x.ai → Settings → Management Keys
# team_id = "uuid"           # optional — auto from validate
# base_url = "https://management-api.x.ai"

Build

bash
cargo build --release   # target/release/mcp-server-grok-management
cargo test
./tests/test-stdio.sh

Architecture

No god modules: api/ (HTTP by domain), format/ (pure text), params/ (schemas),

tools/ (MCP handlers composed with `router_keys + router_billing + router_audit`).

See `CLAUDE.md`.

MCP clients

Already wired for Grok (`~/.grok/config.toml`) and Claude Code

(`claude mcp add -s user …`). Restart the client session if tools don’t appear.

Scope notes

  • Creating management keys themselves is console-only.
  • Adding payment methods is console-only; this server lists them and can set default.
  • Collections / Computer Use / Conversations / Files resources are not in the public Management REST surface (only appear as management-key ACL labels).

Docs

Frequently asked questions

What is mcp-server-grok-management?

mcp-server-grok-management is MCP server for the xAI Management API — API keys, ACLs, audit logs, and billing

How do I install mcp-server-grok-management?

Open the GitHub repository and follow its README. Most MCP servers are added to your client's MCP config, then called by your agent.

Is mcp-server-grok-management open source?

Yes — it is hosted on GitHub at https://github.com/codeChap/mcp-server-grok-management.

Related MCP tools

Run your own MCP server? See who uses it and what to fix.

Measure it with TrackMCP