Building Custom MCP Tools to Connect Claude Code to Production Systems

Fazm Team··2 min read

Building Custom MCP Tools to Connect Claude Code to Production Systems

Claude Code out of the box can read files, run shell commands, and search code. But real workflow automation means connecting it to your actual systems - your database, your deployment pipeline, your monitoring stack. That is where custom MCP tools come in.

What MCP Tools Actually Do

MCP (Model Context Protocol) tools are small servers that expose functions Claude Code can call. Instead of telling Claude "run this psql command to check the database," you build a tool called query_production_db that handles connection pooling, read-only access, and result formatting. Claude calls the tool by name and gets structured data back.

server.tool("query_production_db", {
  description: "Run a read-only query against the production database",
  parameters: { query: { type: "string" } }
}, async ({ query }) => {
  const result = await pool.query(query);
  return { rows: result.rows, rowCount: result.rowCount };
});

Tools Worth Building First

Start with the tools that eliminate the most copy-paste in your daily work:

  • Deployment status - check what is deployed where without opening three dashboards
  • Log search - query structured logs with natural language instead of writing Datadog queries
  • Feature flag management - toggle flags without navigating LaunchDarkly
  • Database queries - read-only access to production data for debugging
  • Incident creation - file PagerDuty incidents with proper severity and routing

Safety Boundaries

The critical design choice is what the tool can and cannot do. Read-only database access is safe. Write access to production needs approval flows. Your MCP tool should enforce these boundaries at the server level - do not rely on the LLM to decide what is safe.

The Payoff

Once your MCP tools are wired up, Claude Code becomes a natural language interface to your entire infrastructure. "How many users signed up today?" becomes a direct query instead of a five-step process of opening dashboards, selecting date ranges, and reading charts. The automation compounds fast.

Fazm is an open source macOS AI agent. Open source on GitHub.

More on This Topic

Related Posts