
mcpai
API vs MCP: Why MCP is Necessary
Why Opt for MCP Over Simply Exposing an OpenAPI Specification to an LLM for API Calls?
This is a frequently asked and nuanced question. While it might seem intuitive to provide an LLM with an OpenAPI spec and a generic API calling tool, MCP offers several compelling advantages:
- Enriched Context: The "C" in MCP stands for Context. MCP servers are designed to provide rich, explicit context for each tool and resource they expose, enabling the LLM to understand their purpose and usage with greater clarity. While some OpenAPI specs are well-documented, many lack the detailed, AI-optimized context that MCP inherently provides.
- Cost Efficiency: OpenAPI specifications, especially for comprehensive APIs, can be enormous. Passing an entire spec to an LLM with every request can quickly become a significant cost factor. For example, MCP Fabric's relatively compact OpenAPI spec is approximately 20,000 tokens. At a hypothetical rate of $3 per million tokens (e.g., for Claude 4), that's $0.06 just to include the spec in the context window. MCP's optimized structure for tool discovery can significantly reduce token consumption.
- Simplicity and Predictability: MCP enforces a unified and simplified structure for agents to interact with external tools. In contrast, APIs can be complex, with parameters scattered across paths, queries, headers, and bodies. This complexity can overwhelm an LLM, leading to inconsistent or less reliable tool invocations. MCP's standardized approach promotes deterministic and robust agent behavior.
- Bridging the "No Spec" Gap: Surprisingly, a considerable number of APIs in the wild lack a formal OpenAPI specification. MCP provides a viable pathway to expose functionalities from such APIs to agents, even without a pre-existing spec.
- Advanced Capabilities Beyond REST: While many current remote MCP servers act as wrappers around existing REST APIs, the official MCP specification supports far more advanced functionalities. This includes the ability for MCP resources to stream real-time updates (learn more about resource updates), enabling dynamic and responsive agent interactions that go beyond the request-response paradigm of typical APIs.
- Ubiquitous Integration Potential: MCP isn't confined to web APIs. It can be used to integrate with a vast array of systems, from shell commands and database queries to file system operations and direct operating system interactions. A prime example is Microsoft's recent announcement of native MCP support in Windows, enabling Windows applications to expose their functionalities directly to agents.
- Empowering Small Language Models (SLMs): Many foresee a future where every smart device is equipped with a Neural Processing Unit (NPU) running a Small Language Model (SLM). These SLMs could leverage MCP to interface directly with the device's hardware. Imagine a car's SLM using MCP to interact with its sensors and controls, enabling intelligent, context-aware vehicle operations.
- Simplified Authentication: Managing authentication for various APIs can be a complex hurdle for LLMs. MCP provides a standardized and streamlined approach to handle authentication, simplifying the agent's interaction with secured external services.