MCP Servers in Production: Connecting AI Agents to Your Real Tools

MCP Servers in Production: Connecting AI Agents to Your Real Tools

What the Model Context Protocol (MCP) is, when to build an MCP server instead of plain tool calling, and a production checklist — auth, permissions, idempotency, timeouts, logging and evals.

Sandeep Prajapati

Full Stack, Python & AI Developer

5 min read

Key takeaways

  • The Model Context Protocol (MCP) is an open standard, introduced by Anthropic, for connecting AI apps to tools and data through one interface.
  • Build an MCP server when the same tools must work across several AI clients or agents; plain function calling is fine for one app.
  • Design tools around user intents (reschedule_appointment), not raw endpoints (PATCH /appointments/:id).
  • Treat every tool call as untrusted input: validate with a schema, scope permissions per user, and require confirmation for destructive actions.
  • Production MCP needs the boring parts: auth, rate limits, idempotency keys, timeouts, structured logs and an eval suite.

The Integration Problem MCP Solves

Every serious AI product hits the same wall. The model is smart, but it can't do anything until you connect it to your CRM, database, calendar, ticketing system and internal APIs.

The old way: write custom glue for each model and each app. Ten tools × three AI clients = thirty integrations to maintain.

The Model Context Protocol (MCP) — an open standard introduced by Anthropic in late 2024 and since adopted widely — fixes that. You expose your tools once, through an MCP server, and any MCP-compatible client can use them.


MCP in One Diagram

┌──────────────┐     MCP      ┌──────────────────┐      ┌──────────────┐
│  AI client   │ ◄──────────► │   Your MCP       │ ───► │  CRM / DB /  │
│ (agent, IDE, │  tools,      │   server         │      │  internal    │
│  chat app)   │  resources,  │ (auth, schemas,  │      │  APIs        │
└──────────────┘  prompts     │  permissions)    │      └──────────────┘
                              └──────────────────┘

An MCP server exposes three kinds of things:

  • Tools — actions the model can take (create_invoice, search_leads)
  • Resources — data the client can read (a document, a record, a schema)
  • Prompts — reusable templates the user can invoke

MCP vs Plain Tool Calling

You don't always need MCP.

SituationUse
One app, one model, a handful of toolsPlain function/tool calling in your backend
Same tools needed in several agents or clientsMCP server
You want customers to plug your product into their AI toolsMCP server (this is the big one)
Internal tools for a team using AI IDEs or desktop assistantsMCP server

If you're a SaaS company in 2026, shipping an MCP server is becoming what shipping a public API was in 2015: the way other software — now including AI agents — integrates with you.


A Minimal TypeScript MCP Server

Using the official TypeScript SDK, a tool is a name, a schema and a handler:

import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
import { z } from "zod";

const server = new McpServer({ name: "clinic-tools", version: "1.0.0" });

server.tool(
  "find_open_slots",
  "Find open appointment slots for a doctor on a given date.",
  { doctorId: z.string(), date: z.string().regex(/^\d{4}-\d{2}-\d{2}$/) },
  async ({ doctorId, date }) => {
    const slots = await db.slots.findOpen({ doctorId, date });
    return {
      content: [{ type: "text", text: JSON.stringify(slots) }],
    };
  }
);

await server.connect(new StdioServerTransport());

Check the SDK docs for the exact API of the version you install — it evolves quickly. For remote servers, use the HTTP transport behind your normal auth layer instead of stdio.


Production Checklist

This is where most demos stop and real systems start.

1. Design tools around intents

Models choose tools by name and description. reschedule_appointment(appointmentId, newSlotId) beats exposing PATCH /appointments/:id with fifteen optional fields. Fewer, clearer tools → fewer wrong calls.

2. Write descriptions like documentation

Say when to use the tool, when not to, and what the output means. "Use only after the user has confirmed the new time" prevents a lot of accidents.

3. Validate everything

The model can and will send malformed arguments. Validate with Zod (or Pydantic in Python) and return a clear, structured error the model can recover from.

4. Scope permissions to the user

The MCP server should act as the signed-in user, with exactly their permissions — never as a superuser. Use OAuth for remote servers and map every call to a real identity.

5. Confirm destructive actions

Anything that sends, deletes, pays or publishes should require an explicit confirmation step from the human. Make it a two-step tool (prepare_refund → confirm_refund) if your client doesn't support confirmations natively.

6. Defend against prompt injection

Text returned by a tool — an email body, a web page, a support ticket — can contain instructions aimed at the model. Treat it as data, keep tool output clearly delimited, and never let a tool result alone trigger a high-risk action.

7. Idempotency and timeouts

Agents retry. Give write tools an idempotency key so a retried create_invoice doesn't bill twice. Put hard timeouts on every downstream call and return partial results rather than hanging.

8. Log and evaluate

Log every tool call with arguments, result size, latency and the user. Then build a small eval set — 30–100 realistic requests with expected tool sequences — and run it whenever you change tool names, descriptions or the model.


Where MCP Pays Off

  • Clinic operations — front-desk staff ask an assistant "who's next in Dr. Shah's queue and is the 4pm slot free?" and it reads live data through scoped tools.
  • Sales ops — agents search leads, log calls and draft follow-ups across a CRM without custom code per AI client.
  • Engineering teams — AI IDEs get read-only access to internal docs, feature flags and error dashboards.

The Bottom Line

MCP turns "AI that talks" into "AI that works with your systems" — and does it in a way you build once. The protocol is the easy part; auth, permissions, validation and evals are what make it safe for production.

I build MCP servers and production AI agents on OpenAI, Claude and Gemini for teams in India, the USA, the UK and worldwide. Let's talk about yours.

Frequently asked questions

What is an MCP server?+

An MCP server is a small service that exposes tools (actions), resources (readable data) and prompts to AI clients using the Model Context Protocol. Any MCP-compatible client — such as Claude apps, IDE agents or your own agent — can discover and call those tools without custom integration code.

Is MCP only for Claude?+

No. MCP is an open protocol and has been adopted across the industry, including by other model providers, IDEs and agent frameworks. You write the server once and many clients can use it.

Is MCP secure?+

MCP itself is a transport and schema. Security depends on your server: authenticate every client, scope tools to the signed-in user's permissions, validate inputs, never expose secrets in tool output, and treat content returned from tools as untrusted data that could contain prompt injection.

Sandeep Prajapati

Written by

Sandeep Prajapati

Full Stack & AI agent developer. I also run SEO/GEO/AEO, Meta Ads and social campaigns. Building production systems from Ahmedabad for clients in India, the USA, the UK and worldwide.

Related reading