Transcript for:
Understanding Model Contact Protocol (mCP)

by now you probably have heard about all the hype around mcps or model contact protocol in this video I want to break it down exactly what an mCP or model context protocol is how it differs from normal tool call or function calls and why all of a sudden there is so much hype around it so just to give you a sense mCP is from anthropic but Sam Alman the CEO of openi tweeted this people love mCP and we are excited to add support across our products available today in the agents SDK and support for chat GPD desktop plus responses API coming soon and even Google is taking notes of this so Sandra pasai the CEO of Google posted this to mCP or not to mCP that's the question let me know in comments interestingly enough it's nothing new this was announced and released back in November 20124 so we talking about almost 4 months ago so here's the original blog post from anthropic and introducing the model context protocol and this is supposed to be a new standard for connecting AI assistants to the systems where data lives including content repositories so one of the biggest problem with LMS is that their knowledge are is limited to the cut off of their training data now the question is how do you enable a knowledge beyond that cut off date well there are techniques like rag or tool calls or function callings that will extend the capabilities of an llm however there is one big issue how these tool calls or function calls are implemented so let's say if you want to give access to the llm to your calendar email app or certain database you actually need to implement a custom API integration for each one of them and each one of these custom integration will become a tool that the llm can use to interact with this external API or or external database so this is one simple solution that enables agents or llms to interact with external word however there are two main issues first if the list of tools or the number of tools increases the llm could hallucinate in deciding which tool to use the second is for each one of the tools you are going to have a custom integration that you need to implement there's no standard if the underlying API implementation change is you'll need to update your tool or the custom integration that you have this is where the model context protocol or mCP comes into play so the idea is that you want to standardize the interaction between your tools and the llm we put another custom layer or standardization layer in the middle between your AI application which could be an ADM or an agent and the actual tool implementation now irresp if you update your tool the mCP standard or this standardization layer is going to remain the same and whenever you're designing your implementations of your external tools you need to follow the standard defined by mCP let's understand what exactly is a is this under the hood so it's a open-source protocol introduced by anthropic that uses Json RPC 2.0 messages to establish communication between between three different components host clients and servers hosts are applications running AI models an example would be Cloud desktop or Aid driven Ides for example cursor wind surf that needs access to external data or tools the second one is clients these are modules within hosts are responsible for communication with servers and and they are required for maintaining connections and forwarding requests so clients are modules that are running within the servers so what exactly is a server these are lightweight programs that each expose specific capabilities through standard model context protocol these lets you connect to local data sources so that would include files databases and services on your computer or remote services such as external systems available with the internet through the API so you need to have a server that is actually exposing either local data storage or remote Services then you are going to have clients which are communicating with the server and hosts are the actual AI applications that are using the servers through the clients now don't worry if it sounds complicated I'm going to break it down so to further explain how an mCP Works we're going to be using some material from a visual guide to llm agents by Martin this is an excellent guide link is going to be in the video description so he has this visual in his blog post which I really love a lot so it really breaks down what hosts clients and servers are hosts are your AI applications like cursor Cloud open AI wind Surf and you can even create your own hosts for that matter then you have the clients that enable the communication between mCP servers and mCP hosts now there is a unified API that enables this communication and an mCP server is interacting with external world through custom apis or custom tools so this implementation is very different from the normal function called The Tool usage because in that case you will have to implement your own communication protocol for different tools or apis and that is not really standardized so by by adding this mCP client and server you actually standardizing standardizing the protocol and the actual tools are going to be running on the mCP server so that kind of exra abstracts away all the complexities from the mCP host okay so to to further break it down we're going to look at this example from the same blog post now in general tools are important components of agend Frameworks allowing llms to interact with the world and extend their capabilities however enabling tool use when you have many different apis becomes Troublesome as tool needs to be manually tracked and fed to the LM manually described and then manually updated whenever API changes so this is what the normal tool usage looks like so for example if you have something like a prompt which ask for today's weather then you need to provide a list of different tools that are available to the llm the llm will decide which tool to use make that call get the response and then feed those results to generate the final response right so all of this is happening through the llm loop and you will have to manually track everything now we looked at this implementation of the mCP and how does it unifies this API or the communication essentially right so now here's a quick example so he says let's assume you want a given llm application to summarize the the five latest commits from your repository the mCP host together with a client would first call the mCP server to ask which tools are available so initially the LM has no idea which tools are tools are available on a given server it just has a list of servers that are available to this mCP client right so the host makes a request to the server to get a list of tools then the llm receives the information and may choose to use a tool it sends a request to the mCP server via the host then receives the results including the tool used right so the llm will use the mCP host get the list of the tools that are available and then it will decide whether to use a tool or not when it decides to use a tool the mCP server will actually use that tool and will return the results and everything is going to be fed back to the llm as a part part of the prompt plus the tools and then the LM will just use that those results to generate the final output now there is one more very cool thing that is happening which is important to keep in mind in this case since the mCP server can have a number of different tools available you can have multiple mCP servers interacting with the llm and in that case even if you have thousands of different tools through multiple different mCP servers the llm does not have to track those those tools right normally if the llm has to make a tool call in an agentic workflow then it first needs to see which tools are available so let's say if there are thousands of tools you will need to include those thousands of tools in it system prompt so that the LM can actually see them and then it will need to decide which tool to use however in this case you have this another layer of abstraction which really isolates the list of tools that are available from the llm so the llm can just decide which mCP host or which mCP server to use through the mCP host that it's interacting with and that will abstract away these multiple tool definitions and Tool calls next we're going to look at the three main components of an MCB server so these are resources tools and prompts resources are file like data that can be read by the client so think about these and API responses or file contents then you have tools or functions that can be called to perform actions like sending an email or quering a data so that's the list of tools that are available on the mCP server and then to orchestrate everything you have prompts these are templates for structuring interaction with the llms so here is a a slide from one of the presentation from atropic with each server you have tools resources and prompts and all of them them are exposed to the mCP client to the m to the mCP host so again tools can be model control functions invoked by the model so this could be retrieval tool Search tool and as I said it could be external API calls like sending a message or updating record from a database then you have resources these are data exposed to the applications files database records API responses these are the outputs that you get so those becomes resources and now you have prompts which are predefined templates for AI interactions so document question answer think about these as prompt templates that the server is going to be using okay so I hope this gives you a really good idea of what nmcp is what are the different components how they interact with each other and how it works well now the question is why it's getting so much traction all of a sudden as I said this is almost four months old concept Sean from latent space podcast has put together a list of reasons which I think really resonates so here he says why mcp1 in short so one here is the becoming def facto standard or not exactly equivalent but alternative approaches like openi in L chain lra all right now lch chain had this concept of tool calls which has been used a lot but then there are other providers like open AI or even Lama index they also tried to come up with their own approaches but according to him the reason that mCP is getting a lot of traction is that it's an AI native version of an old idea so we need standards one standard is rest apis that everybody SE using https tcps or other standards and the age of llms we actually need a standard so that we can standardize the data connection between the L M and our own data sources the second is mCP is an old the second is mCP is an open standard with big backer in in this case the backer is anthropic and anthropic has been actually making updates to it and it's also good to see that now companies like openi and even Google are thinking about adopting this standard so en Tropic has the best developer AI brand I totally agree with it cloud has been an awesome coding llm if you don't run into rate limits and then mCP is based off of LSP which is language server protocol this is an existing successful protocol LSP standardized how to add support for programming languages across whole ecosystem of development tools so this is basically again it's a native version of an old idea in in a very similar way mCP is just trying to standardize how to integrate additional context and tools into the ecosystem of llm applications when anthropic announced mcps back in November they actually had a number of different clients servers and tools available which made it actually useful okay we already have seen a whole Community being built around it which is pretty great so for example cursor has support for mCP servers similarly vent surf also has support for it however you need to be very careful when you are choosing mCP server there are GitHub repos with thousands of different servers that are available in a subsequent video I'll show you how you can use these servers in AI IDs like cursor and wind surf but you need to be careful when you're choosing these servers you want to make sure that they are properly vetted because you are essentially exposing your API Keys your data through these servers so a couple of other comments at the moment mcps are definitely getting a lot of tractions so it's really good to know them however we don't know what the future is going to hold it's a very fluid situation so there might be other companies who will come up with their own standards but we want to look at an open-source standard that the industry is going to adopt mcps seems to be that standard at the moment second you don't have to wrap everything in an mCP server there are still use cases for tools and function calls especially um if you have a small number of tools it's probably better to implement them themselves rather than adding this extra L of abstraction okay so I hope this clarifies what exactly an mCP is and what are the different components I am going to be creating more developers focused content so we're going to look at a few examples of how you can build your own mCP server especially now Gemini is going to be also adding support for it so you could use it with anthropic open AI or Gemini models and hopefully there is going to be support by the open source models as well so if you are interested in content like that make sure you subscribe to the channel anyways thanks for watching and as always see you in the next one