Back to Blog
AI & Agents

Model Context Protocol (MCP): Building Universal Tool Integrations for AI Agents

A practical guide to MCP — the open standard letting any AI agent talk to any tool, database, or service through a single protocol.

Amit ShrivastavaMay 4, 20269 min read

A code snippet from this post was tested

Node.js v22.22.2 · Verified May 18, 2026

Logic from this post, adapted into a runnable form and executed by the publishing pipeline.

node verify.mjs

Snippet

const toolCall = {
  toolName: "OrderManagementSystem",
  functionName: "getOrderDetails",
  parameters: {
    orderId: "ORD-12345"
  }
};

const mockOrderDetailsResponse = {
  orderId: "ORD-12345",
  customerName: "Alice Smith",
  status: "PROCESSING",
  items: [
    { productId: "PROD-A", quantity: 1 },
    { productId: "PROD-B", quantity: 2 }
  ],
  totalAmount: 129.99
};

// Simulate the MCP runtime wrapping the response
const toolResult = {
  toolName: "OrderManagementSystem",
  functionName: "getOrderDetails",
  parameters: {
    orderId: "ORD-12345"
  },
  result: mockOrderDetailsResponse,
  status: "success"
};

console.log("Original ToolCall:");
console.log(JSON.stringify(toolCall, null, 2));

console.log("\nSimulated ToolResult received by AI Agent:");
console.log(JSON.stringify(toolResult, null, 2));

const toolCall2 = {
  toolName: "OrderManagementSystem",
  functionName: "updateOrderStatus",
  parameters: {
    orderId: "ORD-54321",
    newStatus: "SHIPPED"
  }
};

const mockUpdateStatusResponse = {
  success: true,
  message: "Order status updated to SHIPPED."
};

const toolResult2 = {
  toolName: "OrderManagementSystem",
  functionName: "updateOrderStatus",
  parameters: {
    orderId: "ORD-54321",
    newStatus: "SHIPPED"
  },
  result: mockUpdateStatusResponse,
  status: "success"
};

console.log("\nAnother ToolCall example:");
console.log(JSON.stringify(toolCall2, null, 2));
console.log("\nResult for updateOrderStatus:");
console.log(JSON.stringify(toolResult2, null, 2));

Captured output

Original ToolCall:
{
  "toolName": "OrderManagementSystem",
  "functionName": "getOrderDetails",
  "parameters": {
    "orderId": "ORD-12345"
  }
}

Simulated ToolResult received by AI Agent:
{
  "toolName": "OrderManagementSystem",
  "functionName": "getOrderDetails",
  "parameters": {
    "orderId": "ORD-12345"
  },
  "result": {
    "orderId": "ORD-12345",
    "customerName": "Alice Smith",
    "status": "PROCESSING",
    "items": [
      {
        "productId": "PROD-A",
        "quantity": 1
      },
      {
        "productId": "PROD-B",
        "quantity": 2
      }
    ],
    "totalAmount": 129.99
  },
  "status": "success"
}

Another ToolCall example:
{
  "toolName": "OrderManagementSystem",
  "functionName": "updateOrderStatus",
  "parameters": {
    "orderId": "ORD-54321",
    "newStatus": "SHIPPED"
  }
}

Result for updateOrderStatus:
{
  "toolName": "OrderManagementSystem",
  "functionName": "updateOrderStatus",
  "parameters": {
    "orderId": "ORD-54321",
    "newStatus": "SHIPPED"
  },
  "result": {
    "success": true,
    "message": "Order status updated to SHIPPED."
  },
  "status": "success"
}

Model Context Protocol (MCP): Building Universal Tool Integrations for AI Agents

As a software engineer with over a decade in the trenches—from perfecting frontend UIs to diving deep into Web3 and now navigating the exciting, sometimes chaotic, world of AI—I’ve seen my share of integration challenges. We build amazing AI models, but getting them to actually do things in the real world, interacting with our existing tools, databases, and services, is often where the rubber meets the road. And let me tell you, that road is currently full of potholes and detours.

We've got agents, intelligent and capable, but each needs a bespoke integration for every tool. A different API wrapper, a new data schema to learn, a unique authentication flow. It's a Wild West of tool connectivity, and it's holding back the true potential of AI agents.

This is precisely the problem the Model Context Protocol (MCP) aims to solve. I’m incredibly excited about MCP because it represents a shift from bespoke, N-to-N integrations to a standardized, N-to-1 approach. It’s an open standard designed to allow any AI agent to talk to any tool, database, or service through a single, unified protocol. Think of it as the HTTP for AI tool communication.

The Problem: A Fragmented Tool Ecosystem for AI Agents

Imagine you're building an AI agent designed to manage complex customer service requests. This agent needs to:

  • Query a CRM (e.g., Salesforce, HubSpot)
  • Access a knowledge base (e.g., Confluence, internal docs)
  • Communicate with a ticketing system (e.g., Jira, Zendesk)
  • Send emails via an email service (e.g., SendGrid, Gmail API)
  • Update a database for order tracking (e.g., PostgreSQL, MongoDB)

Without a unified protocol, for each new agent or each new tool, you're looking at:

  1. Custom API Wrappers: Writing specific code to interact with each tool's unique API.
  2. Schema Mismatches: Translating data formats between the agent's understanding and the tool's expected input/output.
  3. Authentication Headaches: Managing different auth schemes (OAuth, API keys, basic auth) for each service.
  4. Semantic Gaps: Bridging the differing terminology and concepts across various domains.

This results in slow development, brittle systems, increased maintenance, and a massive barrier to entry for new tools and agents. It's an integration nightmare, and I've lived through enough of those to know we need a better way.

Introducing the Model Context Protocol (MCP)

MCP seeks to standardize the communication between AI agents and external tools by defining a clear, unambiguous language and structure for tool descriptions, invocation, and response interpretation. It’s not just about REST APIs; it’s about making any external capability discoverable and usable by an AI agent in a consistent manner.

At its core, MCP revolves around three key concepts:

  1. Standardized Tool Description: A universal way to describe what a tool does and what inputs/outputs it expects, using a structured format.
  2. Unified Invocation: A standard mechanism for an AI agent to call a tool, no matter its underlying technology.
  3. Consistent Response Handling: A clear way for tools to respond to agent requests, allowing for structured data, errors, and progress updates.

How Does MCP Work in Practice?

Let’s get practical. How would an agent actually use a tool with MCP?

1. Tool Description: The ToolManifest

The first step is for a tool to describe itself in an MCP-compliant ToolManifest. This manifest acts as a structured contract, specifying the tool's name, description, available functions, their parameters, and expected return types. Think of it as an OpenAPI specification, but specifically tailored for AI agent interaction, often with additional semantic information.

Here’s a simplified example of a ToolManifest for a hypothetical "Order Management" tool, described in a JSON-like format:

{
  "protocolVersion": "mcp/1.0",
  "toolName": "OrderManagementSystem",
  "displayName": "Order Management System",
  "description": "Manages customer orders, including retrieval, updating status, and creating new orders.",
  "authentication": {
    "type": "OAuth2",
    "authorizationUrl": "https://api.orders.com/oauth/authorize",
    "tokenUrl": "https://api.orders.com/oauth/token",
    "scopes": [
      "orders:read",
      "orders:write"
    ]
  },
  "endpoints": [
    {
      "name": "getOrderDetails",
      "description": "Retrieves the full details for a specific customer order.",
      "inputSchema": {
        "type": "object",
        "properties": {
          "orderId": {
            "type": "string",
            "description": "The unique identifier of the order."
          }
        },
        "required": ["orderId"]
      },
      "outputSchema": {
        "type": "object",
        "properties": {
          "orderId": { "type": "string" },
          "customerName": { "type": "string" },
          "status": { "type": "string", "enum": ["PENDING", "PROCESSING", "SHIPPED", "DELIVERED", "CANCELLED"] },
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "productId": { "type": "string" },
                "quantity": { "type": "integer" }
              }
            }
          },
          "totalAmount": { "type": "number" }
        }
      },
      "url": "https://api.orders.com/v1/orders/{orderId}",
      "method": "GET"
    },
    {
      "name": "updateOrderStatus",
      "description": "Updates the status of an existing order.",
      "inputSchema": {
        "type": "object",
        "properties": {
          "orderId": { "type": "string" },
          "newStatus": { "type": "string", "enum": ["PENDING", "PROCESSING", "SHIPPED", "DELIVERED", "CANCELLED"] }
        },
        "required": ["orderId", "newStatus"]
      },
      "outputSchema": {
        "type": "object",
        "properties": {
          "success": { "type": "boolean" },
          "message": { "type": "string" }
        }
      },
      "url": "https://api.orders.com/v1/orders/{orderId}/status",
      "method": "PUT"
    }
  ]
}

This manifest provides all the necessary information for an AI agent to understand:

  • What functions are available (getOrderDetails, updateOrderStatus).
  • What inputs each function requires (orderId, newStatus).
  • What outputs to expect.
  • How to authenticate.
  • The actual HTTP endpoints and methods to call.

2. Agent Invocation: The ToolCall

Once an AI agent (or the agent runtime environment) has access to this ToolManifest, it can intelligently decide when and how to call a tool. When an agent determines that a tool function is needed, it generates a ToolCall object.

Let's say the agent needs to find the status of order "ORD-12345". It would generate a ToolCall like this:

// Assuming the agent's internal reasoning leads to this call
const toolCall: ToolCall = {
  toolName: "OrderManagementSystem",
  functionName: "getOrderDetails",
  parameters: {
    orderId: "ORD-12345"
  }
};

// This toolCall object would be passed via the MCP runtime
// to the actual OrderManagementSystem adapter.

The beauty here is that the agent doesn't need to know the raw URL, the HTTP method, or how to construct the query parameters. It just specifies the tool and function by name, and the parameters it wants to pass. The MCP runtime (an intermediary layer) handles the translation from this abstract ToolCall to the concrete HTTP request defined in the ToolManifest.

3. Tool Response: The ToolResult

After the MCP runtime executes the underlying HTTP request (or whatever mechanism the tool uses) and receives a response, it normalizes this response into a ToolResult object, which is then passed back to the AI agent.

Continuing our example, the OrderManagementSystem might respond with:

{
  "orderId": "ORD-12345",
  "customerName": "Alice Smith",
  "status": "PROCESSING",
  "items": [
    { "productId": "PROD-A", "quantity": 1 },
    { "productId": "PROD-B", "quantity": 2 }
  ],
  "totalAmount": 129.99
}

The MCP runtime would wrap this into a ToolResult structure:

const toolResult: ToolResult = {
  toolName: "OrderManagementSystem",
  functionName: "getOrderDetails",
  parameters: {
    orderId: "ORD-12345"
  },
  result: {
    orderId: "ORD-12345",
    customerName: "Alice Smith",
    status: "PROCESSING",
    items: [
      { productId: "PROD-A", quantity: 1 },
      { productId: "PROD-B", quantity: 2 }
    ],
    totalAmount: 129.99
  },
  status: "success" // Or "error" with an errorMessage field
};

// The AI agent receives this structured result directly.

The agent now has a clean, structured ToolResult that it can parse, understand, and use to inform its next actions, without dealing with raw HTTP status codes, headers, or potentially inconsistent error formats from various APIs.

The Benefits of Adopting MCP

From my perspective, as someone who's spent years wrestling with system integrations, MCP offers compelling advantages:

  • Universal Interoperability: Any MCP-compliant agent can use any MCP-compliant tool. This is a game-changer for ecosystem growth.
  • Reduced Development Overhead: Developers build tool adapters once using the MCP standard, rather than N times for N different agents. Agent developers simply provide the manifest and call the abstract functions.
  • Improved Agent Capability: Agents gain broader access to real-world functionality, making them far more powerful and useful.
  • Enhanced Reliability and Maintainability: Standardized interfaces reduce the chance of integration bugs and make updates easier.
  • Easier Tool Discovery: A central registry of MCP manifests for tools could simplify discovery and integration.
  • Future-Proofing: As AI agent architectures evolve, the underlying tool communication layer remains stable.

The Road Ahead: My Vision for MCP

My vision for MCP is a future where integrating a new external tool into an AI agent's capabilities is as straightforward as importing a library. I see a vibrant ecosystem where tool developers provide MCP manifests alongside their API documentation, and agent frameworks natively support parsing and using these manifests to unlock new functionalities.

It’s not just about simple CRUD operations. MCP needs to evolve to handle streaming data, long-running operations with callbacks, human-in-the-loop interactions, and complex domain-specific data types. The beauty of a protocol is its extensibility.

We also need robust tooling:

  • Manifest Validators: To ensure compliance and catch errors early.
  • Code Generators: To automatically create client-side code for frameworks directly from manifests.
  • Runtime Environments: Open-source implementations of MCP runtimes that can bridge ToolCalls to various underlying technologies (HTTP, gRPC, databases, message queues, etc.).

This is an emerging field, and there's a lot of exciting work to be done. If you're building AI agents, designing tools for them, or simply passionate about creating more seamless and powerful AI systems, I encourage you to look deeper into community efforts around standardizing agent-tool communication. The Model Context Protocol is a strong contender to lead this charge.


I’m always eager to connect with fellow engineers, AI practitioners, and anyone interested in the future of AI agents. Feel free to reach out and share your thoughts on MCP or anything AI-related!

Connect with me on LinkedIn or X. Let's build the future of AI together!

MCP
AI Agents
Integrations
Anthropic