Day 3: MCP vs REST API vs Function Calling
REST APIs connect software systems. Function calling lets an AI model request application-defined operations. MCP standardizes how AI applications discover and interact with capabilities exposed by servers. Understand the differences—and why these approaches often work together.
Learning Roadmap
1. Why compare MCP, REST APIs and function calling?
These terms often appear together in AI application discussions, but they solve different parts of an integration problem. A REST API defines how software clients interact with resources and operations over HTTP. Function calling is an AI interaction pattern in which a model produces a structured request for an application-defined function. MCP is an open protocol for communication between AI applications and servers that expose capabilities such as tools, resources and prompts.
They are not three competing versions of the same technology. Understanding their boundaries helps you choose the right abstraction instead of replacing a working API with MCP—or assuming that function calling alone provides a reusable server integration.
2. What does a REST API provide?
REST (Representational State Transfer) is an architectural style for distributed systems. A RESTful web API commonly exposes resources through URLs and uses HTTP methods to operate on those resources. Clients send HTTP requests; the server applies its rules and returns an HTTP response, often represented as JSON.
Typical HTTP operations
| Method | Common intent | Example |
|---|---|---|
GET | Retrieve a representation | GET /api/projects/42 |
POST | Create a resource or submit work | POST /api/tasks |
PUT | Replace a resource representation | PUT /api/tasks/18 |
PATCH | Apply a partial update | PATCH /api/tasks/18 |
DELETE | Delete a resource | DELETE /api/tasks/18 |
For example, an authenticated application client might request a project:
GET /api/projects/42 HTTP/1.1
Host: localhost:5001
Accept: application/json
Authorization: Bearer <access-token>The API validates the request, authenticates and authorizes the caller, executes application logic and returns an HTTP response. The route and response schema are part of the API contract.
3. What is AI function calling?
Function calling (also called tool calling in some AI platforms) allows an application to describe functions to a model. The description includes a name, purpose and input schema. When the model decides a function is relevant, it returns a structured call request. The application—not the model itself—executes the function, obtains the result and usually sends that result back to the model so it can produce a final answer.
Consider a function schema for looking up a project. This is an illustrative, provider-neutral shape; actual request formats differ between AI platforms.
{
"name": "get_project",
"description": "Retrieve a project the current user can access.",
"parameters": {
"type": "object",
"properties": {
"projectId": {
"type": "integer",
"description": "The project identifier"
}
},
"required": ["projectId"]
}
}The model may return a call similar to this:
{
"name": "get_project",
"arguments": {
"projectId": 42
}
}Your application must validate the arguments, check the user's permissions and execute the appropriate code. A model-generated function call is a request—not proof that the operation is authorized or has already happened.
4. What does MCP provide?
The Model Context Protocol standardizes communication between an AI application (the host, through an MCP client) and MCP servers. The protocol uses JSON-RPC message structures and defines how clients and servers exchange messages, negotiate capabilities and interact with supported server features.
MCP servers can expose three core capability types:
Tools
Actions that an AI application can discover and request the server to execute, subject to application policy and authorization.
Resources
Addressable context or data that a client can retrieve from a server, such as project information or documentation.
Prompts
Reusable prompt templates that a client can discover and retrieve for guided interactions.
For example, an MCP server for a developer workspace might expose a tool to create a task, a resource containing project context and a prompt template for summarizing project activity. The server owns the implementation and exposes those capabilities through the MCP contract.
5. MCP vs REST API vs function calling: side-by-side
| Dimension | REST API | Function calling | MCP |
|---|---|---|---|
| Primary purpose | Expose application resources and operations to software clients. | Let a model request an application-defined function or tool. | Standardize AI application ↔ server capability communication. |
| Main participants | HTTP client and API server. | AI model, host application and function implementation. | MCP host, MCP client and MCP server. |
| Contract | HTTP routes, methods, headers, status codes and payload schemas. | Provider-specific tool/function definitions and call/result format. | MCP protocol messages, capability definitions and lifecycle behavior. |
| Discovery | Usually API documentation or OpenAPI; not automatically an AI capability protocol. | Functions are supplied to the model by the application/provider integration. | Client can discover supported server capabilities through MCP methods. |
| Execution | API server executes the requested endpoint. | Host application executes the requested function and returns its result to the model. | MCP server handles protocol requests for its exposed capabilities. |
| Typical use | Frontend/backend and service-to-service integration. | Model-directed calls to application functions. | Reusable AI-facing integrations across compatible hosts and servers. |
| Relationship | Can be called by an MCP server or application function. | Can be used internally by an MCP host as part of orchestration. | Can expose capabilities backed by existing REST APIs and services. |
6. One developer task, three integration approaches
Suppose a developer asks: “Show me the open tasks for project 42.” The desired business result is the same, but the integration boundary changes.
Approach A: The client calls a REST API
A web client or another trusted application calls a known endpoint. The API applies authentication, authorization and business rules, then returns the task data.
GET /api/projects/42/tasks?status=Open HTTP/1.1
Accept: application/json
Authorization: Bearer <access-token>Approach B: The model requests a function call
The application provides the model with a function such as get_open_tasks. The model can return a structured call with projectId: 42. The host application validates and executes it—perhaps by calling the same application service or REST endpoint.
{
"projectId": 42,
"status": "Open"
}Approach C: The AI host uses an MCP server
The host's MCP client connects to a configured server, discovers the tools it exposes and can request the relevant tool. The MCP server validates the request and delegates to its application logic. The host receives the tool result and continues the AI interaction.
{
"jsonrpc": "2.0",
"id": 7,
"method": "tools/call",
"params": {
"name": "get_open_tasks",
"arguments": {
"projectId": 42
}
}
}This last snippet is a simplified protocol illustration to show the shape of a JSON-RPC request. The exact required metadata, negotiated protocol version, transport framing and response handling belong to the MCP specification and will be studied in later days—especially Day 4 on JSON-RPC 2.0, Day 5 on lifecycle and Day 6 on transports.
7. How these technologies work together
A practical .NET architecture can use all three approaches without duplicating business rules:
- ASP.NET Core REST API: serves the Angular application and other conventional API consumers.
- AI function calling: allows the AI host to select and request operations described to the model.
- MCP server: exposes reusable AI-facing capabilities through the MCP protocol.
- Application services: hold shared business rules and enforce permissions, regardless of whether an operation was reached through an API endpoint or an MCP tool.
The diagram communicates the architectural relationship, not a claim that every line has already been verified against the current repository snapshot. In this series, we will inspect the relevant project implementation in the appropriate lessons and distinguish actual wired behavior from target architecture or illustrative examples.
8. Where do they fit in our AI-Powered Developer Assistant?
Our reference application brings these ideas together:
- The Angular application uses the backend API for normal application workflows.
- The ASP.NET Core backend contains the AI host/orchestration path.
- The backend MCP client connects to configured MCP servers; it does not run in Angular.
- The independently deployable MCP server exposes its supported capabilities to compatible clients.
- Shared Application-layer services are the intended place for business rules used by both API and MCP operations.
That separation matters. We do not need to replace every existing endpoint with an MCP tool. A conventional frontend still benefits from a well-designed Web API, while AI-facing capabilities can be exposed through MCP where interoperability and capability discovery are useful.
9. When should you use each one?
Choose a REST API when…
- You are building a conventional frontend/backend or service-to-service contract.
- Clients need predictable HTTP resources, status codes, caching and standard API tooling.
- You need a stable API consumed by web, mobile or partner applications.
Use function calling when…
- You are integrating a model with functions owned by your application.
- The host application controls the tool definitions and execution loop.
- You need model-directed selection among a set of application functions, without requiring a shared external MCP server contract.
Use MCP when…
- You want AI applications to connect to capabilities through a standardized protocol.
- You want a server to expose discoverable tools, resources or prompts to compatible clients.
- You expect capabilities to be reused across compatible AI hosts or independently managed integrations.
10. Security: the model does not become the authorization layer
Regardless of whether an operation is reached through REST, function calling or MCP, the application must enforce access control. Never treat a model's choice of tool, a tool description, a hidden UI button or a generated argument as authorization.
- Authenticate the calling user or client at the appropriate boundary.
- Authorize access to the specific project and operation on the server side.
- Validate all input arguments and constrain data returned to the caller's permissions.
- Require confirmation or additional controls for sensitive or destructive operations where appropriate.
- Log and monitor meaningful operations without exposing secrets or unnecessary personal data.
The protocol can standardize how a capability is called; it does not remove the need for secure business logic.
11. Key takeaways
- REST APIs define resource-oriented HTTP interfaces for software clients.
- Function calling lets a model request a structured function execution from its host application.
- MCP standardizes communication between AI application clients and servers that expose capabilities.
- MCP, REST and function calling solve different integration concerns and can work together.
- Keep business rules and authorization in trusted application code, not in model instructions.
12. Conclusion
MCP, REST APIs and AI function calling solve different problems, but they can work together in a modern AI-powered application. REST APIs provide a standard way for clients to communicate with backend services, function calling allows an AI model to request specific operations through its host application, and MCP standardizes how AI applications discover and interact with external tools, resources and prompts.
In our AI-Powered Developer Assistant, Angular communicates with the ASP.NET Core API through HTTP/REST, the AI Host manages model interactions and function execution, and the MCP Client communicates with MCP Servers to discover and invoke available capabilities. These approaches complement one another rather than replace one another.