home / mcp / service usage api mcp server

Service Usage API MCP Server

Provides an MCP interface for Google Service Usage APIs via an OpenAPI-based server with stdio transport.

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "ag2-mcp-servers-service-usage-api": {
      "command": "python",
      "args": [
        "mcp_server/main.py",
        "stdio"
      ],
      "env": {
        "CONFIG": "<JSON-config-string>",
        "SECURITY": "<security-parameters>",
        "CONFIG_PATH": "<path-to-config>.json"
      }
    }
  }
}

You deploy an MCP server that exposes a Model Context Protocol interface for a defined API spec. This server lets clients interact with the Google Cloud Service Usage OpenAPI-based surface through MCP transports, enabling efficient context-driven requests, testing, and integration with other MCP-enabled tools.

How to use

You start the server and connect via the MCP transport modes it supports. The HTTP URL provides a remote MCP endpoint you can target from a client, while the local stdio mode lets you run the server as a process that communicates directly with a client inside the same environment. Typical usage patterns include launching the local server for development and pointing your MCP client at either the remote URL or the local process as needed. You can also supply runtime configuration through environment variables to tailor security, paths, and startup behavior.

How to install

Prerequisites include Python 3.9 or newer, and the uv worker. You also use pip to install dependencies and, optionally, uv for direct command execution. Use the following steps to set up and run the server.

pip install -e ".[dev]"

# Alternatively, install with uv as the command runner
uv pip install --editable ".[dev]"

Additional setup and running notes

You can configure startup behavior and security through environment variables. The configuration path can be provided as a JSON file, or you can pass the configuration directly as a JSON string. The key environment variables are CONFIG_PATH, CONFIG, and SECURITY. These let you point to a config file, embed a JSON configuration, and set security-related parameters such as API keys.

To run in stdio mode and start serving MCP requests locally, use the following command.

python mcp_server/main.py stdio

Troubleshooting and tips

If you encounter startup issues, verify Python 3.9+ is active, the dependencies installed correctly, and the script path mcp_server/main.py is accessible. Check that CONFIG_PATH or CONFIG provides a valid JSON MCP configuration and that SECURITY contains any required keys or tokens.