An MCP server for measuring and comparing a program’s CPU energy use and LLM token usage, then checking equivalence before refactoring. It uses host-specific power telemetry when available and a proxy-based token counter for real LLM calls.
From the registry: Measure a program's CPU energy and LLM tokens, then refactor it cheaper. Measure, never estimate.
$ pipx install green-mcp$ pip install "green-mcp[agent]"Please install the `green-mcp` MCP server into my current AI client (that's you).
Required prerequisites (do these first if not already done):
- **Install Python 3.10+** — Python 3.10 or newer is required to run the green-mcp command.
- **Install green-mcp with pipx** — Install the MCP server package so the green-mcp command is available on your system. Run: `pipx install green-mcp`
Optional prerequisites:
- Set up a host energy sensor backend if you want energy measurement tools — Energy tools require a supported local power-sensor backend. On Windows with AMD, install AMD uProf separately. On Linux, green-mcp reads /sys/class/powercap (RAPL), though some distros restrict access to energy_uj. On macOS, it uses the built-in powermetrics and requires root or passwordless sudo. Energy measurement generally does not work in Docker, CI, containers, or VMs without sensor passthrough.
- Ensure target programs expose LLM endpoints via environment variables for token measurement — To measure token usage, the target program must read its LLM endpoint from an environment variable such as OPENAI_BASE_URL or ANTHROPIC_BASE_URL so requests can be routed through the counting proxy. Real provider network access is required, and the target program's own API key will be billed normally.
- Install optional bundled agent dependencies if needed — If you want the optional bundled agent, install the extra dependencies and provide Anthropic credentials. This is not required for the MCP server itself. Run: `pip install "green-mcp[agent]"`
Canonical MCP server config (stdio transport):
- command: `green-mcp`
- args: []
Note: green-mcp is a local stdio MCP server, not a hosted web service. The MCP server itself requires no API key or cloud account. Energy measurement runs arbitrary local commands and should be used only in a trusted environment.
Add this MCP server to my current client's config in the correct format for you. If you need secrets or credentials I haven't provided, ASK me — do not invent values or leave raw placeholders. After adding it, tell me how to verify the server is connected.ANTHROPIC_BASE_URLrequiredUsed to route Anthropic API calls through the token-counting proxy for measurement.OPENAI_BASE_URLrequiredUsed to route OpenAI-compatible API calls through the token-counting proxy for measurement.AI orchestration with hive-mind swarms, neural networks, and 87 MCP tools for enterprise dev.
Persistent codebase knowledge graph. Survives session restarts and context compaction.
A powerful toolkit for coding, providing semantic retrieval and editing capabilities.