Skip to main content

Installing Infrahub MCP

This guide provides step-by-step instructions for installing and configuring different MCP clients to connect to the Infrahub MCP server.

Prerequisites

  • Ensure you have access to an Infrahub MCP server endpoint
  • Each client may have additional prerequisites listed in their respective sections

Install & run the Infrahub MCP server

  1. Clone the repository
git clone https://github.com/opsmill/infrahub-mcp-server.git
cd infrahub-mcp-server
  1. Install dependencies
  • Python 3.13+
  • fastmcp
  • infrahub_sdk
uv sync
  1. Run the server
uv run fastmcp run src/infrahub_mcp/server.py:mcp

Configuration

Set the following environment variables as needed:

VariableDescriptionDefault
INFRAHUB_ADDRESSURL of your Infrahub instancehttp://localhost:8000
INFRAHUB_API_TOKENAPI token for Infrahubplaceholder UUID
MCP_HOSTHost for the web server0.0.0.0
MCP_PORTPort for the web server8001

Add to your MCP client

Manual steps

  • Go to Settings > Cursor Settings > Tools & Integrations
  • Under MCP tools, click Add Custom MCP
  • Paste the configuration below into mcp.json
  • MCP tools, click Add Custom MCP
  • Save the file to apply the configuration
  • Restart Cursor if prompted

Configuration

{
"mcpServers": {
"infrahub_mcp": {
"command": "uv",
"args": [
"run",
"fastmcp",
"run",
"src/infrahub_mcp/server.py:mcp"
],
"env": {
"PYENV_VERSION": "3.13.3",
"INFRAHUB_ADDRESS": "http://localhost:8000",
"INFRAHUB_API_TOKEN": "06438eb2-8019-4776-878c-0941b1f1d1ec",
}
}
}
}