The Climatiq MCP server integrates with the Climatiq API to enable AI assistants to perform real-time carbon emission calculations and provide climate impact insights. It offers tools for calculating emissions from electricity, travel, cloud computing, and more, making climate data accessible through the Model Context Protocol.
This project uses uv
for virtual environment and dependency management.
# Clone the repository
git clone https://github.com/your-org/climatiq-mcp-server.git
cd climatiq-mcp-server
# Create a virtual environment
uv venv
# Activate the virtual environment
# On macOS/Linux:
source .venv/bin/activate
# On Windows:
.venv\Scripts\activate
# Install dependencies with development extras
uv sync --dev --extra all
uv pip install climatiq-mcp-server
The server requires a Climatiq API key to function properly. You can provide it in several ways:
Environment Variable:
export CLIMATIQ_API_KEY=your_climatiq_api_key
Configuration During Installation:
CLIMATIQ_API_KEY=your_climatiq_api_key uv pip install climatiq-mcp-server
Configuration File: Create a .env
file in the project directory:
CLIMATIQ_API_KEY=your_climatiq_api_key
Set API Key Tool: Use the set-api-key
tool during runtime within the AI assistant
To get a Climatiq API key:
Start the server with the following command:
climatiq-mcp-server
Add the server configuration to your Claude configuration file:
~/Library/Application\ Support/Claude/claude_desktop_config.json
%APPDATA%/Claude/claude_desktop_config.json
Configuration example:
"mcpServers": {
"climatiq-mcp-server": {
"command": "climatiq-mcp-server",
"env": {
"CLIMATIQ_API_KEY": "your_climatiq_api_key"
}
}
}
The MCP server provides several tools for carbon calculations:
Test all tools, prompts, and resources using:
python utils/test_client.py
Access Climatiq functionality directly from the command line:
# For electricity emissions
python utils/climatiq_cli.py electricity --energy 1000 --unit kWh --region US
# For travel emissions
python utils/climatiq_cli.py travel --mode car --distance 100 --unit km --region US
Use the provided script to run the server directly:
python utils/run_mcp_server.py
Activity IDs group similar emission factors together in the Climatiq database. Examples include:
electricity-supply_grid-source_residual_mix
(for electricity)passenger_vehicle-vehicle_type_car
(for car travel)The server supports multiple calculation approaches:
If you encounter API key issues:
CLIMATIQ_API_KEY
is set correctlyexamples/simple_test.py
to test your API keyFor more information about Climatiq, visit climatiq.io.
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"cursor-rules-mcp": {
"command": "npx",
"args": [
"-y",
"cursor-rules-mcp"
]
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.