Demystifying Model Context Protocol (MCP)
Introduction
Let’s break down Model Context Protocol (MCP) with an everyday analogy. When you want to order food, you check your phone for food delivery apps, see what features they offer, and use them to place your order. The same pattern applies to other services—find the right app, see its features, and use it to get things done.
MCP works in a similar way: LLM checks for available tools, reviews their capabilities, and uses them to accomplish your task.
This article will discuss the technical aspects of this topic in detail, providing an overview of the various components involved.
The Problem MCP Solves
Initially, language models (LLMs) could only use information provided directly in their prompt. The arrival of Retrieval-Augmented Generation (RAG) expanded this by allowing LLMs to access trusted external data alongside the prompt, enriching their context. Later, function calling enabled developers to define structured functions that LLMs could invoke—transforming natural language requests into API calls.
Yet, this method did not scale well. Developers had to create custom logic for each tool, manage intricate and often fragile prompt chains, or depend on proprietary plugins. This resulted in a significant integration challenge: every new AI application needed a unique connection to every external tool, creating a complex M * N integration problem.
For instance, with three AI applications and three external tools, you would need to build nine separate integration modules—one for every possible pairing—because there was no shared standard.
MCP addresses this issue by introducing a universal interface layer. Instead of building a unique integration for each pair, you implement the MCP client once for each of your M applications, and the MCP server once for each of your N tools. This approach reduces the integration workload from M * N connections to simply M + N.
Now that we know the importance of MCP, let's examine its architecture and main components.
Architecture Overview
MCP relies on a client-server structure with the following key components:
Host: This is the AI application that users interact with directly. The host manages requests from users and coordinates the flow between the AI model and any external tools required to complete a task. Whenever the application needs a particular function, the host seeks out available MCP servers that offer the needed services or tools.
MCP Client: Serving as the bridge between the host and the MCP server, the MCP client manages all communication. Each server has a corresponding client on the host side, which exchanges messages using the MCP protocol. Think of the MCP client as the “driver” that ensures smooth conversations between your host application and the MCP server.
MCP Server: Provides the services or tools that the application can use, like functions or access to data. Any existing service can be made available by encapsulating it within an MCP server. The MCP server wraps these capabilities in a standardized format, making it easy for the MCP client to discover and use them.
This diagram illustrates a standard MCP architecture and a representation of how SQL Server MCP is implemented. We will examine the SQL Server MCP in action later in this article.
How MCP works
Let’s consider an example where you ask your AI application for the current weather in your city. Since this information isn't part of the LLM's built-in knowledge, it needs to access an external tool.
Here’s how MCP facilitates this process:
Key Benefits
Technical Deep Dive
Let’s now examine the technical details more closely:
The MCP server is an application that provides contextual data to AI host. Any existing service can also be made available by encapsulating it within an MCP server. It can operate either locally on the same machine using stdio transport mechanism, referred to as a “local” MCP server, or remotely using http/streamable transport mechanism, referred to as a “remote” MCP server.
MCP Capabilities
MCP servers offer a range of features/services known as capabilities. MCP uses the concept of Primitives to define what clients and servers can offer to each other, specifying the format of contextual information that can be exchanged.
Server Primitives
These are capabilities provided by MCP servers. For each primitive type, methods are available for discovery (*/list), retrieval (*/get), and, where applicable, execution (tools/call).
Client Primitives
These are capabilities made available by MCP clients, enabling MCP server authors to create richer interactions.
Recommended by LinkedIn
MCP Communication Protocol
MCP uses the JSON-RPC 2.0 protocol to define message structure and semantics. This ensures that all components and capabilities interact seamlessly, similar to how a USB connector standardizes device connectivity.
Transport Mechanism
The transport mechanism manages communication of JSON messages between the client and server, supporting two primary methods:
MCP in Action
We will explore how the preview version of MS SQL Server MCP can be used with GitHub Copilot for seamless access to databases. This makes tasks such as schema management and data manipulation easy through natural language. Users can describe requirements in plain English, and the system will generate and run the necessary SQL queries. This helps those domain experts without database expertise to build the system quickly.
The MSSQL MCP Server is available in .NET and Node.js versions. Here, we'll focus on integrating and using the .NET version.
Getting Started
Build MCP Server
Adding the MCP Server to VS Code
Using MCP Server with GitHub Copilot
To start using this MCP server, configure the tools and select the MCP server: mcp-mssql-server as shown below. Make sure you are using Agent Mode
Now, let’s use a conversation to create the database. Below is the initial chat where we explain the business scenario for the insurance claim management system.
GitHub Copilot interprets the user's request to set up a database. It identifies two tasks: designing the schema, which it performs autonomously, and setting up the database, for which it uses SQL Server MCP server and the Create Table tool to execute DDL on the connected database.
You’ll see the callout “Ran Create Table – mcp-mssql-server (MCP Server)” indicating the Create Table tool was called with the input and output that was exchanged between client and server for executing the command.
With the database structure in place, we can then ask it to add sample data.
The callout "Ran Insert Data – mcp-mssql-server (MCP Server)" shows that the Insert Data tool was triggered, displaying the insert statement as Input and the execution result as 3 rows affected as Output.
Next, we can query the data using natural language. For example, you could ask: “List of customers who have applied for claims along with service provider details.”
GitHub Copilot generated the SQL query (highlighted in a green box), executed it on the database using the Read Data tool, and returned the result as JSON output. This output was then converted into user-friendly statements (highlighted in a red box) by GitHub Copilot (Host), presenting the information in a conversational format for end users.
This demonstrates the power of MCP servers, allowing conversational AI to completely transform database interactions, making complex SQL operations as simple as giving a plain-language prompt.
A Quick Look at How This Works
To understand how this is possible, let’s look at the code for one of the tools, Create Table.
If you examine the code, you’ll notice that the CreateTable function is defined as a tool, with annotations providing metadata that describes its capabilities and input parameters. Annotations enable dynamic discovery of capabilities, allowing the language model to understand and accurately use the tool by supplying the correct input details. Tools can be upgraded independently without disturbing server integration.
Conclusion
MCP servers stand at the forefront as a powerful bridge between Gen AI and the broader external world. By providing a universal mechanism for AI systems to interface seamlessly with diverse tools and services, MCP unlocks new levels of automation, accessibility, and intelligence across industries. Its architecture not only simplifies interactions between humans and complex systems but also lays the groundwork for more adaptive and responsive solutions in the future. As the scope of AI continues to expand, the significance of MCP as an enabler of real-world applications will only grow, paving the way for a new generation of intelligent integrations that redefine how we connect, operate, and innovate.
To master MCP, explore the MCP documentation and get hands-on with the MCP for Beginners guide, your complete resource for learning its core concepts and strategies.
Nice one Avinash!
Nice One Avi
Nice article Avinash More! To make it safe for production scale systems, it would be always recommended to make it read only. Also for exploration step, we should also enrich it with Table schema description as field & Table names are cryptic and contextual which LLM may not always understand.
Thank you for this writeup. Wonderfully articulated!