Skip to main content

MCP tools

OpsCode natively supports the Model Context Protocol (MCP), allowing you to connect external tool servers—such as Kubernetes cluster inspectors, Terraform and Helm registries, ArgoCD controllers, and Prometheus query engines—directly into the agent runtime.

Configure an MCP server​

Define MCP servers in .mcp.json at the root of your repository or globally in ~/.opscode/.mcp.json:

.mcp.json
{
"mcpServers": {
"helm": {
"command": "docker",
"args": ["run", "-i", "--rm", "talkops/helm-mcp:latest"]
},
"terraform": {
"command": "docker",
"args": ["run", "-i", "--rm", "talkops/terraform-mcp:latest"],
"env": {
"AWS_REGION": "us-east-1"
}
}
}
}
FieldTypeDescription
commandstringExecutable used to start the MCP server (docker, npx, uvx, python)
argslist[string]Command-line arguments passed to the server binary
envobjectEnvironment variables injected into the MCP server process

Configuration resolution order​

OpsCode searches for MCP configurations in the following order (first match wins, or pass --mcp-config to override):

  1. Explicit CLI flag: ops --mcp-config path/to/mcp.json
  2. Project-level: .mcp.json, mcp.json, .opscode/.mcp.json, or .opscode/mcp.json
  3. User-level: ~/.opscode/.mcp.json

Tool naming and inspection​

At startup, OpsCode connects to each configured MCP server, discovers its tool schemas, and registers each tool under a namespaced identifier:

mcp__<server-name>__<tool-name>

For example, the list_releases tool on the helm server is exposed as mcp__helm__list_releases.

Inspect connected MCP servers from the CLI or inside an interactive session:

ops mcp list           # List configured MCP servers
ops mcp tools # List all discovered tools across servers
ops mcp test helm # Test connectivity to a specific server

In the TUI, run /mcp to browse active servers and tool schemas.

Trust and headless safety​

Project MCP trust​

Because project-level .mcp.json files are committed to Git and specify arbitrary process commands, OpsCode prompts you to trust a project's MCP configuration the first time you open it.

For non-interactive CI/CD pipelines, explicitly grant trust or disable MCP loading:

# Trust project-level .mcp.json in headless CI/CD runs
ops -n "Verify Helm release status" --trust-project-mcp

# Disable all MCP servers for an isolated run
ops -n "Lint local Terraform files" --no-mcp

Headless security tiers​

When running unattended (-n), OpsCode classifies every MCP tool into four security tiers and blocks unsafe mutations:

Security tierHeadless behaviorExample tools
Read-onlyAllowed automaticallymcp__helm__list_releases, mcp__prometheus__execute_query
Mutating-safeRequires -y or explicit allowlistmcp__argocd__sync_application, mcp__helm__upgrade_release
Mutating-destructiveBlocked unless explicitly allowlistedmcp__helm__uninstall_release, mcp__argocd__delete_application
PrivilegedBlocked in headless modeCluster RBAC or IAM privilege escalation operations