Showing posts with label api. Show all posts
Showing posts with label api. Show all posts

Tuesday, August 18, 2026

MCP vs API: The Complete Comparison

 

Introduction

If you've spent any time around AI tools recently, you've probably heard both terms thrown around: API and MCP (Model Context Protocol). They sound like competitors, and a lot of content online treats them that way — but that framing is misleading.

APIs are the foundation. MCP is a standardized way of using them.

This piece walks through the comparison in three layers — a holistic overview, a beginner-friendly breakdown, and an expert-level technical dive — so it works whether your audience is brand new to the topic or already building with it.

Part 1: The Holistic Picture

Before diving into detail, here's the core shift in one sentence:

APIs let two systems talk. MCP lets an AI model discover and use any number of systems without custom code for each one.

The Old World vs. The New World

Diagram 1 — Traditional API integrations (the N×M problem):



Every application that wants to talk to Slack, GitHub, Google Drive, a database, and Stripe needs five separate, custom-built integrations. Add a second application, and you're maintaining ten. This is the classic N×M integration problem — N applications × M services = a combinatorial mess of glue code.

Diagram 2 — The MCP architecture (standardized layer):



MCP inserts a common protocol layer in the middle. Any MCP-compatible application can talk to any MCP server, and any MCP server can expose its tool to any compatible application. The N×M problem becomes an N+M problem.

Quick Comparison Table

Aspect API (Traditional) MCP
What it is A contract for two systems to exchange data A standardized protocol for AI models to discover and use tools/data
Integration effort Custom code per API, per app Build once, reuse across any MCP-compatible app
Designed for General software-to-software communication AI models and agents specifically
Discovery Manual — you read docs to know what's available Dynamic — the AI can query what tools/resources exist at runtime
Authentication Varies wildly per provider (keys, OAuth, tokens) Still uses underlying auth, but exposed through one consistent interface
Maintenance Breaks independently per integration Centralized — update the server, all clients benefit
Best fit Two known systems with a fixed, stable relationship AI agents that need flexible, on-demand access to many tools

Part 2: For Beginners — Start Here

What is an API, really?

Think of an API (Application Programming Interface) like a restaurant menu. You (the app) don't walk into the kitchen (the other system) and cook the food yourself. You order from the menu, the kitchen prepares it, and a waiter (the API) brings it back. It's a defined, limited set of things you're allowed to ask for.

Example: A weather app calls a weather API. It sends "give me the forecast for Bengaluru," and gets back structured data — temperature, humidity, forecast. Nothing more, nothing less.

What is MCP, really?

MCP is like giving your AI assistant a universal adapter plug instead of needing a different plug shape for every country you visit. Instead of the AI needing custom wiring for Slack, custom wiring for GitHub, and custom wiring for your database, it plugs into one standard socket — and any tool that supports that socket just works.

Example: An AI assistant connected via MCP to your Google Drive, calendar, and Slack can look at all three, decide what it needs, and pull it — without a developer having written custom code specifically wiring the AI to each of those three services.

The Simplest Way to Remember It

  • API = a specific doorway into one specific building.
  • MCP = a master key system where the AI can be handed the right key to any building that supports the same lock.

MCP is actually built on top of APIs — an MCP server usually calls real APIs behind the scenes. So beginners shouldn't think "MCP replaces APIs." Think: "MCP standardizes how AI reaches APIs."

Part 3: Intermediate — How They Actually Work Together

At this level, it helps to see the layers:

  1. The Service (e.g., GitHub) exposes an API — the raw functionality (create issue, list repos, merge PR).
  2. The MCP Server wraps that API in a standard format: it declares "tools" (actions), "resources" (data), and "prompts" (reusable templates) that any MCP client can understand.
  3. The MCP Client (built into the AI application) talks to that server using the same protocol regardless of which service is on the other end.
  4. The AI Model decides, based on the user's request, which tool to call and with what parameters — it doesn't need to know GitHub's specific API shape, just MCP's shape.

Where the real value shows up

Scenario With Raw APIs With MCP
Add a new tool (e.g., Notion) to your AI assistant A developer writes new integration code Point the assistant at Notion's existing MCP server — often zero new code
AI needs to decide which tool to use for a task Developer must hard-code logic/routing The model sees all available tools' descriptions and chooses dynamically
Switching AI providers (e.g., Claude to another model) Integration code may need to be rewritten per model's API-calling style MCP servers stay the same; only the client changes
Debugging a broken connection Have to check that one specific API's docs, auth, and rate limits Consistent protocol errors and structure across all servers

Part 4: Expert — The Technical Details

Protocol Mechanics

MCP is a JSON-RPC 2.0-based protocol, typically transported over stdio (local processes) or HTTP/SSE (remote servers). It defines three primitives on the server side:

  • Tools — model-callable functions with a defined input schema (the model can invoke actions, like create_issue(title, body)).
  • Resources — addressable, read-only data the client can fetch (like a file, a database row, a document).
  • Prompts — reusable, parameterized prompt templates the server can expose to guide how a client uses it.

Compare that to a typical REST API, which just defines endpoints, verbs, and response schemas — with zero built-in concept of "this is meant for an autonomous agent to reason about."

Where APIs still win

  • Performance-critical, fixed integrations. If you're building a payment pipeline with Stripe and the relationship will never change, a direct API integration is leaner — no protocol overhead, no extra abstraction layer.
  • Fine-grained control. Raw API access lets you handle retries, pagination, and rate-limiting exactly how you want. MCP servers add a layer you don't always control.
  • Non-agentic software. If there's no AI model deciding what to call and when, MCP provides no benefit — it exists specifically to help models reason about and select tools.

Where MCP wins decisively

  • Multi-tool agentic systems. Any system where an AI is expected to autonomously choose between many tools across many services.
  • Ecosystem reuse. Once someone builds an MCP server for a service, every compatible AI application can use it — this is the same leverage that made USB or HTTP powerful as standards.
  • Governance and auditability. Because tool calls flow through a consistent protocol, it's easier to log, permission, and sandbox what an AI is allowed to touch — critical for enterprise deployments.

Architectural Note

MCP does not eliminate APIs — it sits as an abstraction layer on top of them. An MCP server for Salesforce still ultimately calls Salesforce's API underneath. The skill shift for engineers isn't "learn MCP instead of APIs" — it's "learn to expose your existing APIs through an MCP server so agentic systems can use them safely and dynamically."

Summary Table: The Full Spectrum

Level Core Idea
Beginner API = a menu you order from. MCP = a universal plug so AI can order from many menus without custom wiring.
Intermediate MCP standardizes how AI clients discover and call tools; it's built on top of existing APIs, not a replacement for them.
Expert MCP is a JSON-RPC protocol exposing tools/resources/prompts specifically designed for model-driven tool selection; APIs remain better for fixed, high-performance, non-agentic integrations.

A good way to land this for viewers: "Don't ask whether to use MCP or an API — ask whether you're building for a human-defined fixed workflow (use an API directly) or an AI agent that needs to flexibly choose between many tools (wrap those APIs in MCP)."

Saturday, May 16, 2020

servicenow integration with salesforce

What is ServiceNow?

ServiceNow is a business service management platform that offers you IT support services, whether you are an IT business or handling the IT services. For reducing the work effort, getting work done with ease, enhancing resolution speed and minimizing cost, 

ServiceNow and Salesforce integration benefits

ServiceNow and Salesforce both are the major CRM systems, ServiceNow integration with Salesforce offers any business to run smoothly. It eases the work by providing access to multiple apps and synchronizing the data faster. Here are some benefits 

A step-by-step guide to integrate ServiceNow with Salesforce

Let’s start with Obtaining a Personal Developer Instance
1.      Log in to the ServiceNow developer site.
2.      Open the ‘Manage’ menu and click the ‘Instance’ menu item.
3.      Click the ‘Request Instance’ button.
  1. Select a ServiceNow version for the instance.
  2. When the instance is assigned, the screen updates to display the instance URL and the admin credentials. Copy the admin password to the clipboard. 
6. Click on the URL as shown in the attachment above it redirects to the login page use the Username and Password shown in the attachment above.
Here is the Apex Callout Code for the Case Insertion on the ServiceNow from the Salesforce.
 The trigger for the Case insertion:
trigger ServiceNow on Case (after insert) {
 for(Case c : Trigger.New){
 nameofyourcalloutclass.servicenowPost(c.CaseNumber); }
 } 
Above is the trigger which fires when the new Case is generated from the Salesforce organization. Class is called from the trigger which contains the whole functionality. 
Apex Class for the Callout.
public class InsertCase{
@future(callout = true)
public static void servicenowPost(String incidentCase){
Http http = new Http();
 HttpRequest req = new HttpRequest();
 HttpResponse res = new HttpResponse();
String username = ‘admin’;
String password = ‘$Test12345’;
Blob headerValue = Blob.valueOf (username + ‘:’ + password);
String authorizationHeader = ‘BASIC ‘+ EncodingUtil.base64Encode(headerValue); req.setHeader(‘Authorization’, authorizationHeader); req.setEndpoint(‘https://dev1111.service-now.com/api/now/v1/table/incident);
 req.setMethod(‘POST’); req.setHeader(‘Content-Type’, ‘application/json’); JSONGenerator gen = JSON.createGenerator(true); gen.writeStartObject();
//you can add as many mappings as you want gen.writeStringField (‘servicenowField’, incidentCase);
gen.writeEndObject();
 //you can now use String pretty as your body
String pretty = gen.getAsString();
 req.setBody(pretty);
 HttpResponse res = http.send(req); system.debug(res.getBody());
 }
} 
After creating Trigger and class, create a Case in your Salesforce organization and login to the ServiceNow instance. Search the Incident in the search menu and open the incident. Find the incident with the same case number on the ServiceNow instance.
Now the ServiceNow and Salesforce integration completed successfully, the features and functionalities of both the CRM systems can be used from one system.

Sunday, April 26, 2020

Difference between api, track and wire in Lightning Web Component



Below are the decorators used In LWC:-

@api

To expose a public property, decorate it with @api.

Public properties define the API for a component. An owner component that uses the component in its markup can access the component’s public properties. Public properties are reactive. If the value of reactive property changes, the component’s template rerenders any content that references the property.

To expose a public method, decorate it with @api. Public methods are part of a component’s API. You can use a JavaScript method to communicate down the containment hierarchy. For example, an owner calls a method on a child component that it contains.

@track

To track a private property’s value and re-render a component when it changes, decorate the property with @track. Tracked properties are also called private reactive properties.

@wire

To read Salesforce data, Lightning web components use a reactive wire service. When the wire service provisions data, the component rerenders. Components use @wire in their JavaScript class to specify a wire adaptor or an Apex method.