What is MCP (Model Context Protocol)?
Every day, we hear about AI, AI Agents, Agentic AI, LLM, FM, and RAG-based applications in recent years. In modernization, demand is increasing for AI in multiple sectors because customization is required in LLM (Large Language Models) by integrating with external resources (like RAG-based Systems) and tools (like Agent-Based systems or Agentic AI). This will enhance LLM’s existing capabilities by enabling autonomous task execution.
Let’s try to understand when and why it was discovered:
MCP, first introduced in November 2024 by Anthropic, has grown in popularity as it offers a more coherent and consistent way to connect LLMs with external tools and resources, making it a compelling alternative to building custom API integrations for each use case.
Now, MCP is a standardized, open-source protocol that provides a consistent interface that enables LLM to interact with various external tools and resources, hence allowing end users to MCP server that has been encapsulated with enhanced functionalities.
Benefits of MCP
Compared to current agentic system design patterns, MCP offers several key benefits:
- Increase the scalability and maintainability of the system through standardized integrations.
- Reduce duplicate development effort since a single MCP server implementation works with multiple MCP clients.
- Avoid vendor lock-in by providing flexibility to switch between LLM providers, since the LLM is no longer tightly coupled with the agentic system.
- Speed up the development process significantly by enabling rapid creation of workable products.
Essential components for the MCP server
This article aims to guide you through the fundamentals of Model Context Protocol and the essential components of building an MCP server. We will apply these concepts through a practical example of building an MCP server that allows LLMs to summarize and visualize GitHub codebases by simply providing a URL like the example below.
MCP architecture consists of three components:
![MCP architecture]()
- MCP Host
- MCP Server
- MCP Client
MCP server offers tools and resources, exposing functionalities that AI models can leverage through structured requests.
MCP host offers the runtime environment that manages communication between clients and servers, such as Claude Desktop or IDEs with MCP-supported extensions. If we continue with the same customer-restaurant analogy above, the MCP host can be considered as a restaurant management system that coordinates communications between customers (clients) and restaurants, handles order taking, and payment processing.
MCP client is typically built into the host application, allowing the users to interact with the server through an interface.
MCP HOST
This layer handles the clients and LLM providers that interact with the system via the MCP Protocol. Clients can be external systems, chat interfaces, user applications, and automated agents. The platform may host any of the LLM models like OpenAI, Azure AI, or custom/third-party models. The MCP clients utilize these LLMs to interpret prompts, generate text, or execute workflows. MCP Protocol ensures secure, structured messaging and task handling.
MCP Server Components
The MCP server supports incorporating three types of components, which align with three common LLM customization strategies.
- Resources are data, files, and documents that serve as the external knowledge base to enrich LLM’s existing knowledge. This is particularly useful in a RAG-based system.
- Tools are executable functions and integrations with other programs to enrich LLM’s action space, for example, perform Google Search, create a Figma prototype, etc, which can be leveraged in an Agent-based system.
- Prompts are pre-defined instruction templates to guide LLM’s output, e.g., a response in a professional or casual tone. This is useful in a system that benefits from prompt engineering techniques.
Summary
The article walks through the process of designing and implementing a custom MCP server that can automatically analyse source code from GitHub repositories and generate corresponding visual diagrams, such as class hierarchies, flowcharts, or architectural layouts. It highlights integration techniques, processing pipelines, and customization options that support efficient code-to-diagram transformation for enhanced code understanding and documentation.