Back to Docs
Documentation

MCP Integration Guide

Connect MetricRegistry as a tool in Claude Desktop, or any MCP-compatible AI agent.

What is MCP?

The Model Context Protocol (MCP) is an open standard that lets AI assistants connect to external tools and data sources. By configuring MetricRegistry as an MCP server, your AI agent can look up metric definitions, validate SQL, and search across industries — all without leaving the conversation.

Configure Claude Desktop

Add the following to your Claude Desktop configuration file (claude_desktop_config.json):

claude_desktop_config.json
{
  "mcpServers": {
    "metricregistry": {
      "command": "npx",
      "args": [
        "-y",
        "@anthropic/mcp-metricregistry"
      ],
      "env": {
        "METRICREGISTRY_API_KEY": "mr_live_YOUR_KEY_HERE"
      }
    }
  }
}

Available Tools

get_metric

Retrieve a single metric by its full ID

get_metric("uk.banking.capital.cet1_ratio")

search_metrics

Search metrics by keyword across all fields

search_metrics("liquidity ratio")

list_industry_metrics

List all metrics for a given industry

list_industry_metrics("healthcare")

validate_sql

Validate a SQL implementation against the canonical formula

validate_sql("uk.banking.capital.cet1_ratio", "SELECT ...")

Example Conversation

What is the CET1 ratio formula and what are the regulatory minimums?
I'll look that up in the MetricRegistry.

The CET1 Ratio (uk.banking.capital.cet1_ratio) is defined as:

SELECT ${cet1_capital} / nullif(${rwa}, 0) AS cet1_ratio FROM ${capital}

Regulatory minimum: 4.5% (CRR Article 92(1)(a))
Source: CRR Article 92(2)(a), Basel 3.1 PS1/26
Can you validate my implementation? SELECT t1_capital / rwa AS cet1 FROM capital_table
I'll validate that against the registry definition.

Warning: Your implementation does not include nullif() protection against division by zero. The canonical formula uses nullif(${rwa}, 0) to prevent errors when RWA is zero.

Template Variable Substitution

MetricRegistry formulas use ${variable} template variables instead of hardcoded table/column names. This means the same metric definition works regardless of your schema.

${table_name}Substitute with your actual table name
${column_name}Substitute with your actual column name

Troubleshooting

Server not connecting

Ensure your API key is set in the env block. Restart Claude Desktop after editing the config.

Authentication errors

Check that your API key starts with mr_live_ and has not expired. Generate a new key at /signup.

Tool not found errors

Update to the latest version of the MCP package: npx -y @anthropic/mcp-metricregistry@latest