gcp-billing-mcp-server
v0.1.4
Published
MCP server for querying Google Cloud pricing data from memory
Downloads
76
Readme
GCP Billing MCP Server (In-Memory)
A Model Context Protocol (MCP) server for querying Google Cloud Platform (GCP) pricing data.
This server loads a pre-generated data file () into memory upon startup and exposes tools to search and filter this information via the MCP protocol.
Prerequisites
- Node.js: Version 18 or higher.
- Data File: You need to generate the file (NOT the version!). To do this, use the script from the original project (or your equivalent).
- Ensure dependencies are installed ( in the original project).
- Create a file with your .
- Run (this can take hours). **Verify this script saves **.
- Copy the resulting file into the folder of this project ().
Installation
# Install globally (optional)
npm install -g @your-scope/gcp-billing-mcp-server
# Or clone the repo and install locally
git clone https://your-repo-url.com.git
cd gcp-billing-mcp-server
npm install
npm run buildConfiguration
The server looks for the JSON data file using the environment variable . If not specified, it defaults to .
You can define this when running the server:
GCP_PRICING_DATA_JSON_PATH="/path/to/your/gcp_structured_pricing_data.json" gcp-billing-mcp-serverOr create a file in the directory where you run the server:
# .env
GCP_PRICING_DATA_JSON_PATH=/path/to/your/gcp_structured_pricing_data.jsonRunning the Server
If installed globally:
gcp-billing-mcp-serverIf cloned locally:
npm start
# Or for development with auto-rebuild:
npm run devThe server will load the JSON file into memory on startup (this might take a moment depending on file size and system memory) and then listen for MCP connections via stdio.
Usage with MCP Clients
Configure your MCP client (like Claude Desktop, VS Code Copilot Chat, etc.) to use this server.
Example for Claude Desktop ():
{
"mcpServers": {
"gcp-billing": {
"command": "gcp-billing-mcp-server", // Or the path to the executable if not global
"env": {
// Optional: Specify the path if not using the default location
// "GCP_PRICING_DATA_JSON_PATH": "/path/to/your/data.json"
}
}
}
}Example for VS Code (settings.json or .vscode/mcp.json):
{
"mcp": {
"servers": {
"gcp-billing": {
"command": "gcp-billing-mcp-server", // Or the path to the executable
"env": {
// "GCP_PRICING_DATA_JSON_PATH": "/path/to/your/data.json"
}
}
}
}
}Exposed Tools
search_gcp_pricing
Searches the in-memory GCP pricing data based on specified criteria.
Description: Performs a filtered search on the loaded GCP pricing data. Requires a region and at least one search criterion (keywords in OR in ). Returns all matching SKUs. Warning: The response can be very large.
Input Schema:
{
"type": "object",
"properties": {
"region": {
"type": "string",
"description": "GCP region to filter by (mandatory, case-insensitive, e.g., us-central1, europe-west1, global)"
},
"displayNameKeywords": {
"type": "array",
"items": { "type": "string" },
"description": "Array of keywords to search in 'displayName' (AND logic, case-insensitive). Provide this OR taxonomyKeywords."
},
"taxonomyKeywords": {
"type": "array",
"items": { "type": "string" },
"description": "Array of keywords to search in 'taxonomy_categories' (AND logic, partial match, case-insensitive). Provide this OR displayNameKeywords."
}
// Limit parameter removed
},
"required": ["region"]
}Response: An array of JSON objects, each representing an SKU matching the criteria.
Model Recommendation: Due to the potentially very large size of the response (all matching SKUs are returned) and the need for subsequent calculation or summarization, it is highly recommended to use a powerful LLM with a large context window, such as Gemini 1.5 Pro, when interacting with this tool. Simpler models might struggle to process the full output.
Example Usage (in an MCP Client):
// Search for N1 VMs in us-central1
{
"name": "search_gcp_pricing",
"arguments": {
"region": "us-central1",
"displayNameKeywords": ["n1", "vm", "instance"]
}
}
// Search for preemptible GPUs in europe-west4
{
"name": "search_gcp_pricing",
"arguments": {
"region": "europe-west4",
"taxonomyKeywords": ["gpu", "preemptible"]
}
}Development
npm install
npm run build
npm run dev # Runs in watch modeLicense
MIT
