Skip to main content

Getting started

Install the MintMCP Terraform provider, authenticate, and apply your first Global Rules configuration.

info

Configuration as Code is available for enterprise organizations. Reach out to enterprise@mintmcp.com to have it enabled for your org.

Prerequisites

  • Terraform v1.5 or later
  • A MintMCP account with admin access to your organization
  • Your MintMCP organization ID (find it in Settings > General in the MintMCP dashboard)

Step 1: Authenticate

The recommended way to authenticate is with terraform login:

terraform login app.mintmcp.com

This opens your browser, authenticates via MintMCP, and stores a token locally. The token is user-scoped, so all changes made via Terraform are attributed to your account.

Step 2: Configure the provider

Create a main.tf file:

terraform {
required_providers {
mintmcp = {
source = "registry.terraform.io/mintmcp/mintmcp"
}
}
}

provider "mintmcp" {
organization_id = "org_XXXXXXXXXXXXXXXXXXXX"
}

Replace org_XXXXXXXXXXXXXXXXXXXX with your organization ID. You can also set this via the MINTMCP_ORGANIZATION_ID environment variable.

Step 3: Initialize Terraform

terraform init

This downloads the MintMCP provider plugin.

Step 4: Import your existing configuration

If your organization already has Global Rules configured in the MintMCP dashboard, import them so Terraform manages the existing state rather than creating a blank slate.

First, add an import block to your main.tf (do not add a resource block yet):

import {
to = mintmcp_global_rules.main
id = "org_XXXXXXXXXXXXXXXXXXXX"
}

Then use Terraform's config generation to create the matching HCL automatically:

terraform plan -generate-config-out=global_rules.tf

Terraform reads the existing rules from MintMCP and writes a global_rules.tf file that matches them exactly. Verify with a second plan:

terraform plan

This should show no changes — the generated config matches the live state. Then apply to record the import in Terraform state:

terraform apply

From here you can edit global_rules.tf to make changes and use the normal plan / apply workflow.

If you are starting fresh (no existing rules configured), skip the import block and define your rules directly in a resource block.

Step 5: Define your Global Rules

Here is a minimal example that enables a secret-detection rule and sends a Slack alert when it triggers:

resource "mintmcp_global_rules" "main" {
rule_configs = {
"prxgrule_XXXXXXXXXXXXXXXXXXXX" = {
is_enabled = true
}
}

actions = [
{
enabled = true
category = "secret"
send_slack_message_global = {
channel = "#security-alerts"
short_text = "Secret detected in LLM traffic"
body_markdown = "The \"{{rule.name}}\" rule was triggered."
}
}
]
}

To find your rule IDs, open the Monitor > Rules page in the MintMCP dashboard. Each built-in rule shows its ID (prefixed with prxgrule_).

Step 6: Preview and apply

Preview the changes:

terraform plan

The plan output shows exactly what will be created, modified, or removed. Review it carefully, then apply:

terraform apply

Terraform validates your configuration (including Liquid template syntax in Slack message bodies) before applying. If validation fails, no changes are made.

Provider reference

SettingProvider attributeEnvironment variableDefault
Organization IDorganization_idMINTMCP_ORGANIZATION_ID(required)

Next steps