Smile news

What is the Model Context Protocol (MCP)?

  • Date de l’événement Apr. 07 2025
  • Temps de lecture min.

Discover the Model Context Protocol (MCP), explore its use cases, its technical architecture and how to implement it to enrich your AI applications.

The Model Context Protocol (MCP) is an open standard that enables artificial intelligence applications, including large language models (LLMs), to connect securely and bidirectionally to various external data sources and tools. By standardizing these interactions, the MCP facilitates integration and interoperability between AI models and existing systems. Think of MCP as the USB-C of AI applications.

 

Existing MCP Servers

Several MCP server implementations allow LLMs to interact with different platforms and services. Here are some notable examples:

  • Git : It allows LLMs to access Git repositories, read, search and manipulate files, thus facilitating tasks such as code analysis or documentation generation.
  • Postgresql: it allows you to inspect database schemas and execute read-only queries.
  • Redis : it interacts with in-memory databases, allowing LLMs to store and retrieve data quickly.
  • Slack : it integrates LLM into Slack 's communication channels , enabling real-time interactions, such as replying to messages or providing summaries of conversations.
  • Sentry : It allows LLMs to access error reports and logs, helping to diagnose and resolve software problems.

These servers demonstrate the versatility and extensibility of MCP, illustrating how it can be used to give LLMs secure and controlled access to various tools and data sources.

 

Technical details of the MCP protocol

MCP follows a client-server architecture similar to the Language Server Protocol (LSP). Here are the main technical aspects:

  • Architecture : The client is typically an AI application or development environment, while the server is a program that provides access to specific data or tools.
  • Communication : Requests and responses are encoded according to the JSON-RPC 2.0 specification. Communication between the client and the server is via (stdin/stdout) or HTTP with Server-Sent Events transports.
  • Specification : The official MCP specification is available and defines the authoritative protocol requirements, based on the TypeScript schema.
  • SDKs : Official software development kits (SDKs) for MCP are available in Python, TypeScript, Java , or Kotlin, making it easy to create MCP servers and clients.

     

Use Case

Querying a PostgreSQL database via MCP from a business chat.

 

Objective

Allowing a business user (sales, HR, logistics, etc.) to ask a question in natural language in a chat and get an answer based on real-time data from a PostgreSQL database , thanks to the Model Context Protocol (MCP) .

 

Process Steps

Steps in the process

Advantages of this approach

  • Responses based on real-time data: No need to retrain the model.
  • Cost optimization: Less context to inject into prompts.
  • Security: PostgreSQL protects sensitive data with permissions.
  • Scalability: MCP allows for the easy addition of other databases or APIs.
Unified system advantages

How to implement an MCP server?

To implement an MCP server, here are the steps:

  1. Language selection : Choose a programming language that suits your environment and needs. SDKs are available for Python and TypeScript.
  2. SDK Usage : Use the corresponding MCP SDK to facilitate development. These SDKs provide tools and libraries for managing the communications and data structures required by MCP.
  3. Defining capabilities : Identify the features your MCP server will offer. For example, a Git server might allow operations like reading files, searching for commits, etc.
  4. Implementation of methods : Develop the necessary methods for each defined capability, following the specifications of the MCP protocol.
  5. Communication management : Ensure that your server can handle requests and responses in JSON-RPC 2.0 format, and that it supports the required transports (Stdio or HTTP).
  6. Testing and deployment : Test your MCP server to ensure it is working correctly and deploy it in your target environment. JSON-RPC 2.0

As you will have understood, an MCP server will allow you to connect your data sources, whether it be an application or a database, to your LLM. Today, several third-party servers exist, such as Grafana, which allows you to search dashboards and query data sources, or MotherDuck, which allows you to query and analyze data from the powerful DuckDB .

To learn more, we recommend our white paper " Building an open source AI application ".

 

Resources