Model Context Protocol (MCP) — connecting AI to the real world

Back in April, my friend Bjoern Hirtenjohann gave a talk at the Bletchley AI User Group about the Model Context Protocol (MCP). I found it educational at the time but, having recently started to explore my own use of MCP, I went back for another look.

Much of what follows draws on Bjoern’s presentation (Model Context Protocol (MCP) — An Overview Session), supplemented by some of my own experiences.

A universal remote control for AI

Bjoern started his presentation with a photograph of five remote controls. It’s a familiar problem for anyone with a collection of audio-visual equipment — each device has its own way of interacting with it, even though many of the functions are broadly similar.

There’s a parallel with artificial intelligence. Large language models (LLMs) are incredibly capable but, in isolation, they have no direct access to the systems we use in our everyday lives. Connecting AI applications to external systems through bespoke integrations creates duplicated engineering effort, maintenance overhead and security challenges.

The Model Context Protocol provides an alternative. It’s an open standard for connecting AI applications to external data sources and tools — or, as Bjoern described it, a universal remote control for AI tools.

How does MCP work?

There are three principal components in the MCP architecture:

  • MCP host: the AI application with which we interact, such as a conversational AI assistant or an AI-enabled development environment.
  • MCP client: a component within the host that manages communication with an MCP server.
  • MCP server: a software component that exposes capabilities from an underlying system in a standardised way.

A host may have multiple MCP clients, each connected to a different server.

When we ask an AI assistant a question that requires information from an external system, the application can use the capabilities exposed by an appropriate MCP server. The results are made available to the language model to inform its response.

MCP servers can run locally, elsewhere on a private network or as remotely hosted services. Where a cloud-hosted AI application needs to communicate with a privately hosted MCP server, a tunnel may provide connectivity without opening inbound ports on the private network.

What can MCP provide?

Bjoern identified three types of capability that MCP servers can expose:

  • Tools: functions that can be invoked to perform operations, such as querying a database, sending a message or creating a support ticket.
  • Resources: information that can provide additional context, such as documents, database schemas or application records.
  • Prompts: reusable templates for structuring interactions with an AI application.

Another important feature is dynamic tool discovery. An AI application can discover the tools exposed by a connected MCP server, together with descriptions of their purpose and the parameters they require.

This allows us to extend the capabilities of an AI application without necessarily having to modify the application itself.

Why does MCP matter?

In his presentation, Bjoern highlighted several advantages of MCP, including reusable integrations, interoperability, faster development and reduced maintenance overhead.

The introduction of a standard interface between AI applications and external systems potentially reduces the dependencies between them. Rather than developing integrations for a specific AI application, developers can expose capabilities through MCP for use by multiple compatible applications.

That doesn’t guarantee universal interoperability, but it provides a common foundation on which to build.

Putting MCP to work

Over the last few weeks, I’ve been using my home IT infrastructure as something of a proving ground.

I’ve connected ChatGPT to my Home Assistant installation using an MCP server and a tunnel. Now, when I query about issues with lights (for example), rather than offering a generic response about potential causes, ChatGPT can examine the system and identify possible explanations based on actual data.

I’ve also connected ChatGPT to GitHub, where I’m maintaining architectural documentation and configuration standards for my home IT infrastructure.

The combination is particularly useful. ChatGPT can examine the live environment, help me troubleshoot an issue and, once we’ve resolved it, update the relevant documentation in GitHub.

Historically, maintaining that level of documentation for my home IT would have been an administrative overhead that I’d probably never have found the time for (or I might have written a blog post to share with others). Now, it’s becoming a natural by-product of the work that I’m doing. I even have a backlog of issues to fix.

From intelligence to usefulness

Bjoern concluded his presentation with a simple observation:

LLMs are smart. MCP helps them become useful.

I might take issue with the idea that LLMs are smart, but let’s park that for another discussion. Even so, having started to explore MCP for myself, I can certainly see what he meant. There’s a significant difference between asking an AI assistant a question about how something might work and asking it to investigate how something is actually working.

Of course, connecting AI to our systems also raises some interesting questions about trust and how much authority we’re prepared to delegate. That’s a topic I’ll return to in another post – in fact, the whole purpose of describing MCP in this post was to prepare the ground for my next subject.

In the meantime, thanks to Bjoern for his original talk. For anyone interested in exploring the subject further, there’s plenty of additional information in the official Model Context Protocol documentation.