An API is any interface that lets software communicate with other software. MCP (Model Context Protocol) is a specific open protocol, introduced by Anthropic in November 2024, that standardises how AI applications connect to tools and data sources. MCP does not replace APIs; it usually wraps existing APIs so AI models can discover and use them consistently. APIs (in general) - Designed for developers and programs. Each API has its own endpoints, authentication, request formats and documentation (for example a REST API for orders: GET /orders/42). - Integrating an AI application with ten services traditionally means writing ten custom integrations, each with different conventions. MCP - A client-server protocol based on JSON-RPC 2.0, with transports such as stdio (local processes) and Streamable HTTP (remote servers, with OAuth-based authorization). - Roles: - Host: the AI application (an IDE assistant, a chat app or an agent). - Client: the connector inside the host that talks to one MCP server. - Server: exposes capabilities to the AI. - An MCP server exposes three main kinds of capabilities: - Tools: functions the model can call, each with a name, description and JSON Schema for its inputs (for example get_order_status). - Resources: data the application can read into context (files, records, documents). - Prompts: reusable prompt templates. - Capability discovery: the client asks the server which tools exist (tools/list), so the model learns what it can do at runtime. How they work together - An MCP server for an order system might implement its get_order_status tool by calling the existing REST API. The REST API still does the real work; MCP is the standard adapter that makes it usable by any MCP-compatible AI application. Key differences - Audience: APIs are consumed by programs written by developers; MCP is designed for AI models and agents to discover and use capabilities. - Standardisation: every API is different; MCP provides one consistent protocol for tools, resources and prompts across many services and AI applications. - Discovery: APIs are documented separately (OpenAPI helps); MCP servers describe their tools at runtime with natural-language descriptions and schemas for the model. - Interaction: APIs are request/response endpoints; MCP sessions involve capability negotiation and can include notifications and other protocol features. - Scope: an API exposes a service's functionality; MCP connects an AI host to many services in a uniform way ("USB-C for AI tools"). Security considerations specific to MCP - Tools can perform real actions, so servers need authentication, least privilege and user approval for sensitive operations. - Prompt injection: data returned by tools may contain malicious instructions; hosts must treat tool output as untrusted data. - Validate tool inputs as you would any API input. Example: a developer asks an AI assistant in their IDE, "Create a ticket for this bug." The assistant uses the issue tracker's MCP server, which calls the tracker's REST API to create the ticket. Interview summary: "An API is a general interface for software; MCP is a standard protocol that lets AI applications discover and call tools and data in a consistent way — usually built on top of existing APIs."
Ravindra Wadile · · 0 likes