MCP: Model Context ProtocolBeginnerModule 01 — Understanding the need for MCP
How did AI applications connect to external systems before MCP?
Question 6 of 43 · Updated
On this page
- Short answer
- 1. The fundamental problem: a language model is not a business system
- 2. Direct API integrations
- 3. Direct database access and data retrieval
- 4. Service SDKs and custom adapters
- A locally tested traditional adapter
- 5. Model-provider function calling
- 6. Framework-specific tools and plugins
- 7. Retrieval-augmented generation and external knowledge
- 8. How the traditional approaches fit together
- 9. What changes when MCP is introduced?
- 10. Common beginner misconceptions
- Interview-ready answer
Short answer#
Before the Model Context Protocol (MCP), AI applications connected to external systems using ordinary software integration techniques: REST APIs, database drivers, service SDKs, custom adapter functions, plugin systems, framework-specific tools, and model-provider function calling. The application developer defined how to obtain data, validate inputs, execute requests, handle errors, and return results to the model. Retrieval-augmented generation (RAG) pipelines were another common way to supply external knowledge.
These approaches were already useful and remain useful today. MCP introduced a common protocol boundary for discovering and consuming external capabilities across compatible AI hosts. It did not invent external API access, function calling, retrieval, or tool execution, and it does not replace them.
In Q5, we examined the many-to-many integration problem. This lesson takes a step back and shows what the individual integrations looked like before a common MCP boundary was available. The next lesson examines why maintaining those integrations becomes difficult as applications and services grow.
Verification note: This article uses established software engineering knowledge under the authorized offline research exception. The historical MCP 2025-06-18 specification is a reference baseline, not a statement about the latest release. Official links were not checked live. The Python 3.13.5 example was executed locally: eight adapter checks and two parameterized SQLite query checks passed, and syntax compilation succeeded. The HTTP service is simulated by an injected fixture; no live API, LLM, MCP SDK or LangChain SDK was invoked. Mermaid diagrams use standard fenced syntax and were reviewed structurally, but no Mermaid parser or live website renderer was available.
1. The fundamental problem: a language model is not a business system#
Suppose a customer asks an AI assistant, “How many A12 products are available?”
A language model can understand the question, but its learned parameters do not automatically contain the current inventory count. A real answer requires the application to obtain the current value from an authorized business system.
A developer could solve this long before MCP existed. The application could call an inventory API, query a database, retrieve a relevant document or invoke a local function. It could then provide the result as context to the model.
In this deterministic design, the application decides when to retrieve data, rather than asking the model to decide whether a tool is required. It is still an AI application, even without an autonomous agent or MCP.
The developer is responsible for preserving the distinction between model-generated text and verified external facts. The model should not invent an inventory count when the application cannot retrieve it.
2. Direct API integrations#
A straightforward approach is to call a business service using HTTP. For example, an inventory service may expose an endpoint such as:
HTTPGET /inventory/A12
A fictional successful API response might be:
JSON{ "sku": "A12", "quantity": 7 }
The application sends the request using a trusted service endpoint and appropriate credentials. It checks the HTTP status and response structure, extracts the inventory count, and supplies the relevant data to the model.
The service URL, authentication headers, retry rules, request parameters and response mapping are application integration details. None of these operations requires MCP.
APIs can expose many kinds of capabilities: order lookup, shipment tracking, document search, calendar events or payments. REST-style HTTP APIs are only one possibility; services may also use GraphQL, gRPC or other protocols. Different application frameworks can call the same underlying service.
A deterministic inventory lookup is often the simplest solution if a workflow always needs the same data. The application can fetch inventory before asking the model to explain it. This avoids a model tool-selection round trip but requires application logic to determine the lookup inputs.
The limitations of direct integrations are not that APIs are inherently incompatible. A well-designed API, OpenAPI description and shared client library can already be reusable. The challenge is that the AI-specific layer for capability discovery, model tool schemas and result handling may still vary from host to host.
3. Direct database access and data retrieval#
Another approach is to connect the backend to an authorized database with a database driver. For example, a stock lookup might use a parameterized SQL statement:
SQLSELECT quantity FROM inventory WHERE sku = ?;
The question mark is the parameter style used by Python's SQLite driver. Other drivers use different placeholders. The application passes the SKU separately as a bound parameter rather than building SQL by concatenating model-generated strings.
A production backend should expose a narrowly scoped operation and independently enforce the authenticated user's access to the relevant tenant or record. Parameterized queries reduce SQL injection risk, but do not by themselves provide authorization. Avoid giving a model unrestricted access to a production database.
The same pattern applies to external storage and files: use an approved file or storage API, select the relevant content and pass only permitted information to the model. Filesystem access, resource ownership and privacy are enforced outside model reasoning.
4. Service SDKs and custom adapters#
Service providers often supply SDKs that encapsulate authentication, request construction, response parsing and error handling for their APIs. An AI application could call those SDKs from its own backend functions.
A custom adapter adds an application-facing interface around the provider-specific integration. For example, a developer might implement a function named stock that accepts a SKU and returns a predictable business result, even though the underlying service uses a field named quantity.
The adapter can:
- Validate model or user input before making requests.
- Choose a fixed approved endpoint rather than allowing the model to supply arbitrary URLs.
- Translate a service-specific response into a stable application-facing contract.
- Distinguish a valid zero-stock result from a missing record or unavailable service.
- Apply authentication, authorization, deadlines and safe error handling.
Adapters can be shared among applications using ordinary packages or internal services. The problem is not that reuse was impossible before MCP; rather, the interface and discovery mechanisms were often specific to the application, framework or integration platform.
A locally tested traditional adapter#
The following runnable Python example implements a small inventory adapter without MCP or external libraries. The fetch callable is an injected dependency; in a real application it would make an authenticated request to a configured service with appropriate timeouts and response-size limits. Here it is a deterministic fake API so the behavior can be tested without internet access.
Save as legacy_inventory.py.
PYTHONimport re import sqlite3 from urllib.parse import quote def get_stock(sku, fetch): if type(sku) is not str or not re.fullmatch(r'[A-Z0-9]{1,16}', sku): raise ValueError('Invalid SKU') status, data = fetch('/inventory/' + quote(sku, safe='')) if status == 404: raise LookupError('Unknown SKU') if status != 200: raise RuntimeError('Inventory unavailable') if not isinstance(data, dict) or type(data.get('quantity')) is not int or data['quantity'] < 0: raise ValueError('Invalid inventory response') return {'sku': sku, 'available_units': data['quantity']} def dispatch(call, fetch): if not isinstance(call, dict) or call.get('name') != 'stock': raise PermissionError('Unknown tool') args = call.get('arguments') if not isinstance(args, dict) or set(args) != {'sku'}: raise ValueError('Invalid arguments') return get_stock(args['sku'], fetch) def fake_fetch(path): return {'/inventory/A12': (200, {'quantity': 7}), '/inventory/B34': (200, {'quantity': 0}), '/inventory/C56': (503, {}), '/inventory/D78': (200, {'quantity': True})}.get(path, (404, {})) if __name__ == '__main__': for sku, units in [('A12', 7), ('B34', 0)]: assert dispatch({'name': 'stock', 'arguments': {'sku': sku}}, fake_fetch) == {'sku': sku, 'available_units': units} bad = [({'name': 'delete', 'arguments': {'sku': 'A12'}}, PermissionError), ({'name': 'stock', 'arguments': {'sku': 'A12', 'url': 'example'}}, ValueError), ({'name': 'stock', 'arguments': {'sku': '../A12'}}, ValueError), ({'name': 'stock', 'arguments': {'sku': 'Z99'}}, LookupError), ({'name': 'stock', 'arguments': {'sku': 'C56'}}, RuntimeError), ({'name': 'stock', 'arguments': {'sku': 'D78'}}, ValueError)] for call, error in bad: try: dispatch(call, fake_fetch) except error: pass else: raise AssertionError('Expected rejection') print('8 adapter checks passed (2 successful, 6 rejected)') with sqlite3.connect(':memory:') as db: db.execute('CREATE TABLE inventory (sku TEXT PRIMARY KEY, quantity INTEGER)') db.execute('INSERT INTO inventory VALUES (?, ?)', ('A12', 7)) assert db.execute('SELECT quantity FROM inventory WHERE sku = ?', ('A12',)).fetchone() == (7,) assert db.execute('SELECT quantity FROM inventory WHERE sku = ?', ('missing',)).fetchone() is None print('2 parameterized SQL checks passed')
Run python legacy_inventory.py. Actual local execution using Python 3.13.5 produced:
8 adapter checks passed (2 successful, 6 rejected)
2 parameterized SQL checks passedThe two successful adapter cases include positive stock and zero stock. Six negative cases distinguish unknown operations, unexpected arguments, invalid SKU format, a missing product, a service failure and a malformed quantity. Python booleans are deliberately rejected as inventory counts even though bool is a subclass of int. The two SQLite checks demonstrate bound parameters for an existing and missing record.
The exercise tests local behavior only. The dispatch dictionary is an illustrative normalized internal representation, not an actual model-provider tool call or MCP message. The SKU format is an invented application policy, not a universal inventory standard. The adapter does not implement user authentication, resource authorization, a real HTTP client, rate limiting, retries or audit logging. These controls must be supplied by a production system. In particular, an allowlisted tool name is not permission for a user to access all inventory records.
5. Model-provider function calling#
A major development in AI applications was giving a language model descriptions of functions or tools and allowing it to propose structured invocations. This enabled the model to decide that a stock lookup was useful rather than requiring the application to preselect every action.
A developer-defined input contract might be represented as:
JSON{ "type": "object", "properties": { "sku": { "type": "string", "description": "Product stock-keeping identifier" } }, "required": ["sku"], "additionalProperties": false }
This is a generic illustrative JSON Schema, not a complete request in any particular model-provider API. Actual function-declaration envelopes, supported schema subsets and response fields vary across APIs and versions.
The application includes a function declaration when requesting model output. The model can produce a structured tool call containing the function name and arguments. The application receives that proposal, validates it, checks authorization and invokes its own adapter. It then sends the result back in the appropriate tool-result representation, correlated with the original call.
The model does not necessarily execute the function merely because it produces a function call. In this application-managed example, the host executes it. Some platforms also provide managed tools that run on the provider's infrastructure, but the same distinction between requesting and actually performing an operation remains important.
Function calling and MCP are complementary layers. Function calling helps represent model-facing tool requests; MCP provides an interoperable host-to-server capability interface. A host can use provider function calling while implementing the selected tool through an MCP client. A host can also use direct function calling without MCP, and a deterministic application can invoke MCP tools without an LLM.
MachinoAI already has a dedicated AI Agents lesson comparing function calling with MCP. The scope here is deliberately limited to the pre-MCP integration workflow rather than repeating that detailed comparison.
6. Framework-specific tools and plugins#
Agent frameworks made integrations easier by providing abstractions for tools, prompt construction, execution loops and result handling. LangChain, for example, allows developers to represent callable operations as tools with names, descriptions and argument contracts.
A developer could wrap the inventory adapter as a LangChain tool and bind it to an agent. Other frameworks supplied their own tool representations, registries and execution mechanisms. Toolkits and community integrations could reduce the amount of custom code within a framework's ecosystem.
Plugins offered another integration approach: a platform could support external capabilities through a platform-defined manifest, API schema, registration or connector mechanism. These could support discovery and reusable integrations within that platform. The exact meaning of plugin depends on the platform and period; there was no single universal plugin interface.
Frameworks and plugin systems were not superseded simply because MCP appeared. They solve host orchestration, distribution, application development and other problems that a communication protocol does not necessarily address. A modern LangChain application can consume native framework tools, MCP-backed tools and deterministic application functions together.
7. Retrieval-augmented generation and external knowledge#
Not all external integration requires executing an action. An AI assistant may simply need relevant information from documents or a knowledge base.
RAG retrieves relevant records or document passages at request time and includes them in the model context. A typical implementation uses keyword search, dense embeddings or a combination, followed by filtering and optional reranking. Retrieval may use a search engine, vector database, document API or another storage service.
For an inventory help assistant, RAG could retrieve the product return policy before the model answers a policy question. That is different from fetching the live quantity of a product through an inventory operation.
A RAG pipeline can run deterministically before model inference or be exposed as a callable retrieval tool. MCP can provide a protocol boundary around retrieval or resource access, but it does not itself perform embedding generation, vector search, ranking or answer grounding. Those responsibilities remain in the retrieval system.
8. How the traditional approaches fit together#
| Approach | Integration surface | Who executes the operation? | Example |
|---|---|---|---|
| Direct REST API | HTTP endpoint and service contract | Application backend | Inventory lookup |
| Database driver | Parameterized database query | Authorized application service | Fetch stock record |
| Service SDK | Provider-specific client functions | Application runtime | Retrieve delivery status |
| Custom adapter | Application-defined function | Application runtime | Normalize inventory response |
| Function calling | Model-facing structured tool proposal | Host or configured execution environment | Choose stock lookup |
| Framework tools | Framework-specific tool abstraction | Framework-managed or custom runtime | LangChain inventory tool |
| Plugin | Platform-defined integration interface | Platform or external service | Registered calendar connector |
| RAG | Retrieval and context pipeline | Retrieval service and host | Search policy documents |
| MCP | Common capability communication interface | MCP server or its downstream service | Invoke reusable inventory capability |
These approaches are not mutually exclusive. A single application could use an agent framework, provider function calling, a custom adapter, a REST API and a RAG pipeline simultaneously. MCP can be added to the external capability boundary without replacing the whole architecture.
9. What changes when MCP is introduced?#
Consider the traditional stock function above. Its input validation, business logic and result normalization are useful regardless of whether MCP is present. To expose the same capability through MCP, a service team can register a suitable tool on an MCP server. A compatible host discovers the advertised contract and routes approved requests through an MCP client.
The second architecture preserves the business integration but moves its externally consumable interface behind a common protocol. The host still owns model-facing tool selection, user consent and trusted routing. The service still owns data access and authorization. There is no requirement to rebuild a working database or REST API simply to expose MCP capabilities.
MCP standardizes parts of discovery, communication and capability invocation; the exact behavior depends on the protocol revision, negotiated capabilities and implementation. It does not eliminate custom domain adapters. In fact, an MCP server is often itself an adapter around existing services.
For a small deterministic workflow, direct integration can remain a reasonable choice. For reusable capabilities consumed by several compatible hosts, a shared MCP boundary can make the integration more portable. That choice depends on requirements, security, compatibility and maintenance, rather than on the assumption that newer technology is always better.
10. Common beginner misconceptions#
Did AI applications lack access to current information before MCP? No. They could retrieve authorized current information using APIs, databases, search and retrieval systems.
Was function calling invented by MCP? No. Model-provider tool calling and application-level function execution are separate concepts that existed independently.
Did developers have to build every integration from scratch? No. SDKs, OpenAPI tooling, shared packages, framework integrations and plugins already offered substantial reuse.
Is an API response automatically a trustworthy model instruction? No. External results are data and may contain untrusted or adversarial content. The host must enforce policy independently of text returned from an external system.
Does MCP make existing adapters unnecessary? No. Server implementations still need business logic, downstream connections, validation and access control. MCP provides a standard interface around these capabilities.
Interview-ready answer#
Before MCP, AI applications accessed external systems through ordinary APIs, SDKs, database drivers, retrieval pipelines, custom function adapters and framework-specific tools. An application either retrieved information deterministically or provided tool descriptions to a model and dispatched the model's structured call through trusted application code. Developers implemented validation, authorization, response normalization, errors and orchestration themselves or used framework libraries. MCP adds a common client-server capability interface that can sit on top of those existing integrations, enabling compatible hosts to discover and invoke reusable capabilities. It complements rather than replaces APIs, function calling, agent frameworks and RAG.
References
- 1.MCP specification (2025-06-18)modelcontextprotocol.io
- 2.MCP tools specificationmodelcontextprotocol.io
- 3.OpenAPI Specification 3.1.0spec.openapis.org
- 4.Python sqlite3 documentationdocs.python.org
- 5.JSON Schema documentationjson-schema.org
- 6.OpenAI function calling documentationplatform.openai.com
- 7.LangChain tools documentationdocs.langchain.com
- 8.
Related questions
Explore other topics:Forward Deployed EngineeringAI AgentsLarge Language ModelsRetrieval-Augmented Generation