Model Context Protocol (MCP) is a way for LLMs to interact with external
tools and services. There are times you may want to instruct or ask an LLM like
ChatGPT about something that is not in its training data. MCPs act as a bridge
between the LLM and the external tool or service greatly increasing the
capabilities of the LLM.
The MCP standard was created by Anthropic in November 2024, the
company behind Claude. It is now an open standard and maintained by many LLM
providers such as Google Deepmind and OpenAI.
Prompts Examples With MCPs
Example
Create a new branch and add the feature described in JIRA issue
WEB-123 and create a PR on GitHub.
Update the documentation pages in Notion for the changes to our
MailChimp email template. Include the new Figma designs. Then ping my manager
Myles on Slack once the changes are live.
Clean up my tasks in Jira under WEB. Add a note to each overdue
task that says 'This task is overdue due to Sprint 2 delayed.' Assign to
Jules Winfield on the WEB team.
First, AI technology enabled us to have a conversation with a computer through
text input or through voice input. Cool, but what's next? Now we want to use AI
to perform tasks. But like a new employee at a company, we need to give them
tools to work with.
Existing infrastructure such as the ubiquitous REST API is not enough.
Traditional REST APIs are designed for structured input and outputs. Here is an
example of a REST API request and response in Python:
🐍
Python3
1import requests
23# Send a POST request to JSONPlaceholder API.4user_data ={5"title":"My New Post",6"body":"This is the content of my post",7"userId":18}910# Returns placeholder text data.11response = requests.post(12"https://jsonplaceholder.typicode.com/posts",13 json=user_data,# Input parameters for API.14)15new_post = response.json()1617print(new_post)18# {19# 'title': 'My New Post',20# 'body': 'This is the content of my post',21# 'userId': 1,22# 'id': 10123# }24
First problem is LLMs themselves cannot execute code. They can only generate
text. So a layer must be built to handle operations, handle errors, and clean
the response.
Second, the inputs for the API call or user_data is strict where it must
follow a certain pattern the receiving API expects.
In my experience, you can tell the LLM to output a structured
JSON object reinforced with examples and field names. But in practice, the
outputs have a high chance of error.
You want to use MCP versions of a service as opposed to LLM-native versions when
you productionize your service. This will provide a standardized way for a
specific action like searching the internet.
Overlapping Capabilities
At this point, you may have thought, But ChatGPT can reference the internet and
current events, so why do I need MCP?
Built-In Capabilities
With products like ChatGPT and Gemini, OpenAI and Google respectively, put the
LLM behind a layer which interacts with APIs such as NewsAPIs, Wikipedia, and
Search Engine APIs. But if you want to use the LLM to perform tasks as YOU on
YOUR accounts, those products are not authorized. Refer back to our example:
Update the documentation page for the app deployment process in Notion called
'How to deploy the app' with changes in the Github Actions. How does ChatGPT or
any other LLM know to use YOUR Github and Notion accounts?
Execution Through The Command Line
Without MCPs, products like Claude Code or Cursor can actually perform the tasks
like Create a new branch and add the feature described in Github Issue #2517 in
my repo called 'hello-world'.
This is because Claude Code or Cursor can access the command line terminal which
opens up access to any tool installed on the terminal such as git and gh
which can run commands to accomplish the tasks. The problem for this method is
not all tools and providers have command line interfaces. Originally command
line tools are meant for human developers not for automated programs like LLMs
to insert commands.
Potentially allowing LLMs to run commands could be a security risk. If an end
user tricks the LLM to run rm -rf / or git push --force, which could be
disastrous and irreversible to the underlying system.
Never let an LLM run commands like `rm -rf /` or `git push --force`,
or any other destructive commands.
When Not to Use MCP
MCPs are powerful but not always the right solution. Here are scenarios where
you might want to consider alternatives:
Simple One-Off Tasks
For quick, manual tasks that you'll only do once, setting up an MCP server might
be overkill. Sometimes it is faster to just do it yourself.
Real-Time Interactive Tasks
MCPs work through discrete tool calls, which may not be ideal for tasks
requiring real-time feedback or continuous interaction, like live debugging or
interactive design work.
Security-Critical Operations
While MCPs can be secured, for highly sensitive operations (like financial
transactions or critical system changes), you might want human oversight at
every step rather than automated execution.
Remember that MCP servers run as separate processes. The LLM only
sees what the server chooses to return, not the full system context.
MCP Clients
Just like your favorite web browser, there are MCP clients that you can use to
connect to MCP servers.
At the moment, most clients are chatbot interfaces like ChatGPT and code editing
tools like Cursor.
If you think of an app or service which you use, there is a good chance that
it has an MCP server and you can offload work to the LLM by connecting your
favorite LLM client to the MCP server.