H9CEAI · Session 7 · Model Context Protocol Pre-recorded lecture transcript (Victor del Rosal) Hello, everyone. You're very welcome back to Customer Engagement and AI. Great to have you in this session. So as I mentioned in my note, as we're moving to more technical, slightly more technical content, we're going to find it easier to have this sort of pre-recorded session that you can pause at any time. and, you know, adjust to your learning style and preference. And again, I think it's just because you have to go back and forth between your own screen, your own work during the sessions, and then, you know, listen to the live video. And again, we're constrained by the two-hour time limit, 8 to 10 P.m. I find that this would be a better medium where you have access to the session and other facilities around the transcript, etc. So again, we're going to experiment with this, see how it works for you. And also in the last few sessions that we have together, we will have a live session. feedback, especially for the final project. So that's coming up next. So after we look at today's content, we'll get into that shortly. We will transition in the couple, the next few weeks to the both, I suppose, the CA2, continuous assessment #2, but also with a focus on your final project. So we'll get to work on that as well. So again, good to have you and let's just have a quick look at the previous week on chat bots. We're talking about chat bots and building the chat bot. So we said that the key component to get an actual response is the LLM brain. Now, this is what I suppose the main feature of the current wave and generation of chatbots is the fact that they're powered by a large language model. Previously, it was only the user talking to the knowledge base via keyword search or decision trees, etc. Nothing wrong with that. but the newest generation, and as they get more capable, these LLMs are able to give users natural response, natural language responses, so interact in real time. So we saw examples of that. And for those of you that may not want to necessarily set up a paid account, API key. We found a workaround with Google AI Studio. So again, test this, play with it, tinker a little bit, and see if it works for you. Now, with that said, I think it is a good idea to invest a few dollars of EUR. Again, not much, you know, to play with these. four or five EUR, the minimum that you might need to fund the tokens. So it does not have to be the latest model. It can be, you know, for example, in Claude, you have the Opus tier, and then you have Sonnet. And Sonnet is almost as capable at a fraction of the cost. So Play around with the tokens. You have ChatGPT, you have Claude and Gemini. Those are the three that I recommend. And again, all are comparable or all are perfect for our purposes and do avail of any free credits like these free tokens. Now, the other important thing that we're going to start using today is the idea of giving the LLMs access to credentials. So at this stage, I would hope that you've tried GitHub. So what happens then is instead of having to manually upload an index file to a repository, the LLM can do it for you. So it can commit and push the changes all the way out to a GitHub page without having to do that manually. So that's very powerful. Same goes for Google account integration. For example, it can fetch e-mail, it can read your messages. And again, it all comes with, you know, with care and some risks. But these are, you know, you have these risks for everything that we might use on the internet. But keep an eye on it, document yourself, learn about it, research. And as you're comfortable with it, try giving access and authorizing some of these services. Cloudflare is another example. It gives access to domain names. So if you want to register your own domain name and other services, it's a very good idea. I highly recommend it. That's one I use quite a bit. So today we're talking about the model context protocol. So this is quite useful, MCP. You might have heard of it. We talked about it a little bit. So again, if I go back here, one of the slides, you know, we were talking about knowledge bases, so it could be a PDF or any other static knowledge. And then dynamic ones. We're going to see that an example today, Google Sheets. But we also have a tool, tool access. So we're going to research what that is. We're going to look at that and also look at some of the examples and we'll see that shortly. So an MCP, let's start with a video. Let me share that with you. Give me one sec. Okay, here we go. And it should start playing shortly. MCP stands for Model Context Protocol. And it's simply a way for AI models like ChatGPT, Gemini, or Claude to communicate with external tools. See, when you have a large language model, an LLM like ChatGPT on its own, it's great at conversation, strategizing, pulling historical facts. But when you actually ask it to perform some... meaningful tasks like sending an e-mail or updating your tasks list, it will say, sorry, I can't do that. It can write the e-mail for you, but then you'll need to go and copy that e-mail over to your Gmail app and then send the e-mail. So we've realized here by connecting LLMs directly to the tools we use each and every day, they can become a lot more powerful. Two things happen when we connect. LLMs to tools. First, they can actually pull in context from the tool. So for instance, if you ask it to run an analysis about what are the most common job titles of new customers that you have, if your large language model is connected directly to your CRM, like Salesforce, it will be able to pull in that data and run that analysis. Now, on top of just... pulling in context, it now moves us away from just simply knowledge, but going towards action. And by connecting the LLM to tools, we can perform action. So rather than just writing the e-mail for you, it can go and actually either create the draft in your Gmail account directly for you to review, or even all the way through to actually sending out that e-mail. Now what the model context protocol is specifically is just an agreed upon standard about how tools should interact with AI models. Rather than every single tool, so rather than Salesforce creating their own method to connect with an AI, rather than Google creating their own method to connect with an AI, rather than Notion and pretty much any tool you're using creating their own method, The team at Anthropic developed this model context protocol, which involves an MCP server that makes it very simple for AI to connect with MCP servers and then leverage different tools. And this is something that it's hoping that the rest of the industry will adopt. Now that you understand what MCP is, you're probably wondering what it actually looks like in practice. The good news is that setting up your own MCP server is much easier than most people think. You don't even need to write any code. Click this video right here to see a real. .. All right, okay, very good. So I suppose the idea behind MCPs is, you know, and I'd like to show the, let me show the next slide, is that you can connect a number of services as we see here. So databases, e-mail, calendar, CRMs, cloud servers, GitHub, as I mentioned earlier, and a ton of other You know, at this point, you're looking at hundreds and not thousands of different MCP servers for all sorts of external tools, applications. It is the way, you know, I like to think of it as a, let me see if I have that, as a USB connector. That's universal. And you know, that is the concept of an MCP server or the model context protocol. Again, it's that common way to interact for all sorts of data formats. And again, Pioneer or created by Anthropic. So what I'd like you to do is to take a moment to research 10 uses of MCP updated to this month. and then ask in research how you can do this. While using AI and terminal, what can you use MCP for? What are 10 practical use cases? And then based on this, can you reflect how it might apply for, particularly for customer engagement? use cases. And feel free to share this. Again, you don't have to do it in the chats. We're not in the live session. But can you do this? You know, prepare a single paragraph and submit this via Moodle. So there'll be an option there to submit it as part of your of today's session. So this should take you about 10 minutes or so. So take a moment and reflect on it and just send that short piece. And we're going to pause here for that. Thank you. Okay, so thanks for sending that via Moodle. Let's carry on. And again, based on that research, you would have seen a number of applications for MCP servers. Some are more complex, of course. They're more complex integrations. We're going to build one of the most basic ones involving a database or Google Sheet later as our class exercise. So we'll do that and I'll show you the approach, the exercise. But again, keep exploring and keep playing with MCPs after today's session. So we'll do a few exercises together and then at the end of the session, I'll ask you to create your own And you know, and submit your own version of it. Okay, so a reminder that if you need free credits or free tokens to connect your LLM to the MCP server or for any other exercise, you might already have this set up. So check if it's already working for you. And again, if not, look at alternative solutions. to get these tokens and integrate the token and the LLM brain into your application. All right, so previously we saw my own example, borrow bats, a specialist retailer on slow pitch softball players for Europe looking for certified bats. or bats that are legal in tournaments. So let me show you the how that went. Let me let's click on that. Okay, so here we have it. So I suppose after the previous session, we have this already working, the different advices, so we can go for any of them. And you know, now the way, and again, I suggest you might do this to test if your LLM brain is working, if your application has that wired in. you might ask something that is not connected, not relevant to the actual service. So something like, what are your opening hours? I mean, this is not a shop, so it shouldn't, it should say, no, no, we're online first, so there we go. Can I order food? No, sorry. Okay, so there we go. Now we check that it's not just canned conversations or responses rather. So it is working. Okay, so from the previous session, what I realized was that the database that it has, that it's connected to, it was only giving maybe 40 of all the... the universal responses, so it was capped. So this is an internal, let's say, NCP server connected to the database itself that is working. So give me all that that are. 25 or 26 oz balanced. And then, so it's checking, comparing with the team. And there we go. So it has a number of options there. The different, different bats. And, and again, it should check all the salt, and then price them. From most. the least expensive. X, and there we go. So again, we see that the service is working, it is querying the database, and it has, presumably, let's say, it has an MCP server of sorts. OK, so it did a live check, and here's what they stand. OK, so, and then there's a price right there. OK, now for this particular example, it's not so clear, you know, that MCP connection is not so clear, even though it did. And again, it was not as, I suppose, as straightforward. We're going to do a better example that illustrates this point. But we tested so far the LLM brain, and we can add more MCP integrations as required. Maybe this is not the best example. Now, what we're going to do now is let's build our own. Let's try and build a chat bot that has this MCP. So again, we're looking to connect all the, not only the front end, the LLM brain, but in this case, an external tool, and that will be the MCP server. So let's go ahead, and before we do that, I want to... We're going to do that exercise shortly. It's around a vet. So vets and different offerings, rather, to pets, different pets. So we're going to do that shortly. Before we do that, I want you to try something else, which is... I want you to find a fun application of an MCP server, even if the chatbot is not connected. So now the approach for this is the following. You're just going to go on your terminal and say, look, I want to connect an MCP server without the LLM brain. So we're going to take out the LLM portion of it, and you'll deploy this to a GitHub page. So you have about 25 minutes to do this on your own. Now, here's the thing. For me, again, it's important that you try and tinker with MCP servers before we do the other more formal exercise. We're going to do that together. shortly. This approach is what I would recommend, and I'm going to show an example to illustrate what you might be able to do. The whole point is that you find a live API, that you find some public data that you can connect to, and then transform it into some or connect that into the front end. So, let me illustrate that with an example. So, previously, something I prepared is called a... Iris. And again, this is for fun. This is my own version or answer to this exercise. It took me a day or two, just tinkering around. And the idea, the basic or the initial idea was to create a sort of like a screensaver application, adding some white noise. And sometimes I use it, you know, commuting, et cetera. But then I thought, could I add an MCP server to this? So let me show you what it looks like. Let's go to Iris. So it has a time. You can toggle the time. You can have a countdown or just the actual time of the day. Now, if we go here to live, we're going to see in pulse. You'll see this option. Let's show the clock right there. So if you, I don't know if we can zoom in, but right now it has a... the selector for the International Space Station. So this is the actual location at the time of recording of the space station. So it's moving somewhere in the Pacific Ocean. And we toggle that off and then show earthquakes. So this is the US Geological Service, USGS. And if you hover on any of these, you can see that this was 11 hours ago. This earthquake, five points here, not too bad. Others, 5.1 and 5.8, and we see the different locations. So this is an example of an API. So this is public data that is being pulled in by the application that I created. So this is a screen saver application. And it, again, it pulls that. and it displays it in real time, just like I showed you there. So if we overlay, so there's the space station traveling in that direction. And then layered also earthquake. So this is an illustration of what, you know, something that you might want to try. So think about it of, so for this one, what you could do is work in your terminal, AI terminal, say, look, I need an MCP server, a public. open API that we can play with, pull that information, and display it somehow. So take a moment to do this, try it out, and see how it works for you. Okay? So I'll see you in about 25 minutes. Thanks. I was going to say, if you have any questions, there's an option to submit questions. So available that as well. OK, thanks. Okay, so I've also enabled a submission link for this fun application of the MCP server. So again, all the practice that you can get is very good. So I look forward to reviewing that. Thanks very much for your submissions. Okay, so let's move on to the class demo I want to do. This will be our main demonstration. for today. So let's work on it. This is the context. So Meadow Vet Care is a modern Irish vet clinic serving dogs, cats, rabbits, small mammals, birds, with 90 plus services. Even birds, yeah? So the idea here is to build a customer chatbot. that answers real questions from the clinic's live data. This is the MCP idea, giving, you know, as you would expect, giving your AI a live tool. And that's that live tool can be something simple. And we're going to think we're going to assume for this for this vet for this clinic that they have Google Sheets. And that's the source of information, that's where they update their services, so nothing fancy. Of course, it can be an ERP, it could be many other fancier things. For now, we'll keep it simple. We need to build the front end, and we need to fetch the data from that Google Sheet, and then we need to wire in the LLM brain. that will reply in natural language. Once this works, we need to get it working so that it would create or answer questions such as, what dog services do you offer? Are there any offers on microchipping? Do you have telehealth services, et cetera. So the whole, the idea is that this chatbot will. We'll connect to the Google Sheet and answer any and all questions regarding that. So let's have a look at the Google Sheet itself, see what it gives us. And I'll post a link in here so you can copy that and inspect it yourself. So you see here the first data feature is the service ID, the category, consultation, preventive, nutrition, etc. Species, the ones we mentioned, the pricing per service, how long it lasts, If it requires an appointment, yes or no. What's the availability of the service? How many slots they have left? So we presume this is dynamic, so it's constantly being updated. We have a way to update it very efficiently, seamlessly. Are there any special offers on that? And the service name, what it includes. or could be like a seen as a category as well. I suppose it is a name, sorry, it is a name, just very detailed. And then a longer description of each service, what exactly each of these is. So again, we could sort this by any way we want. So there's a ton of services around here, dozen or two services. Okay, so let's. We see that, and again, the way it works is once you have an open API, so we're going to treat this as an API, this Google Sheet. It's the way it's shared is shared with anyone with the link, so we have access. If I had restricted this, then there'd be no way. To, I suppose it would be workarounds, but not easily accessible, so it is open for us to see, and the vets they want it open, so that that's that works for us. That's perfect. OK, so that's the data, the data structure, the data set. Now, the idea is to connect it. to connect it to the brain and create the front end. So you're very good already at creating the front end. Now the question is, how do we bring all of that together? So let me show you my conversation here. So we're working with Claude, the Opus model, and I just started the conversation saying, we need to build this. So it is, and that's it, just copying the description. And again, you'll have access to the description yourself. And just, you know, give it the URL to the Google Sheet and build everything. So create the MCP, having dynamic access and building the front end for it. So it starts a response. So yeah, sure, the sheet is public. I can, and I see all the services. So Had no trouble, it was perfect in the first first go. It had everything it wanted from the from the in terms of the services, so the the MCP connection was working straight off. And then it went to ask for the API key. So it presumed that I wanted Claude, which was correct, that's fine. Could have gone for OpenAI or Gemini. And I needed an Anthropic API key. So it told me where to get it, because the one that I had on file was not working. So I got the new key. And I posted it down later. So then it went ahead and created its own version. So again, you don't have to micromanage it. You don't have to say everything that you want. You could, of course, and we can do that. We could iterate that way. But just look, it went ahead and created the concept itself. the color, all the different specs for the front end. Then I posted the key, which will be rotated by the way, and then tested that the key works and it is deployed. So it deployed the... that part and then the MCP server was working. The back end, it was verified and it can do go ahead and so now we're going to test it shortly. So notice here, I did not have to do anything, any manual work, given that I had pre-authorized, in this case, Claude Code to access my GitHub repository, access my GitHub account, create the repository, and then go all the way and create and push. and enable a GitHub page. So all of this is done by your AI on terminal. You don't have to do that manually anymore. You should know how it works. You should know how to do it manually in case you want to do it. And you've seen the tutorials in AI Batch on how to do it. But again, the whole point of pre-authorizing and giving the keys, as I said to you at the start, Giving keys to AI is the whole point that you can do this automatically. So then it's going to verify that it renders and it's doing the final checks and there it is. So this is the, this will be the page. Okay, so we'll go ahead here. And again, it did its final checks. That should be the page, so let's let's I'm gonna test it live with you and see how how it goes. Okay. Metal Metal Vet Care. Hello and welcome to Metal Vet Care. Okay. So let's do the microchipping. Let's see if that works. We offer some market shipping. OK, yes is yes. currently 30 euro and there's a special offer. A few extra details. It's about 15 minutes, available Monday to Saturday. If you have a dog rabbit, book online. And you could easily create this and you know, create a Stripe integration or PayPal. You could do this, right? What dog services do you offer? And look, it has a number of live services, so we're going to play a little bit with with the with the see what happens and test it. See if it works. Okay, so dog services and it gives you the whole array of services. Wellness check, bath and brush, and the pricing. So, and I must say it's very, the aesthetics is pretty good, the cards. Free nail trim included, et cetera. Again, I'm gonna, you might do my usual messing and I order food. Yeah, a burger. Why do I always ask for a burger? I don't always eat burgers, okay, by the way. Ah, no, we're a vet clinic. So look, it's responding in, again, natural language, so proving that, you know, it's most likely an LLM brain. Let's ask a random question. What, where? Do you think the ISS is right now? Again, the most random I could think of. That's about outside my wheelhouse. I'm just here for metal vet care questions. There you go. So it does bring us back. So that's good. Okay. All right. Now let's try something here. Let's do, see if it works dynamically. So let's increase. The price, let's go just to the order this. Okay, so instead of 55, so this is the general consultation for... or dogs. Okay, so let's increase the price to 550. All right, let's see what happens and if it gets that. And then the next one, #2, 770, whatever, just random. Now, let's reference this with the service ID and see if it works. Again, it might not update. I might need to go back into the terminal and re-update, but let's see if it's doing live integration. And if not, we'll complain to the terminal and make sure it does do live. What is the most current price for? I see what it. Okay, so I don't know why it doesn't, so that's a limitation because it should be able to, okay, so. All right, so we can just ask by the service name. Yeah, the whole thing. K. What is the most earned price for? Let's see if I can get it. You should have gotten it with the service ID, so... Okay, so that's good. See, it's polling. Again, it's not the ideal format there, but look, it did get it. So I'm happy that it is live, right? Because we just made those two changes right now on the fly. So 550 and 770. And again, what I would say to the terminal is To the back, you know, our our own make sure that services are searchable. Virtual by, and let's just look at the data feature. Service ID. That is, if user asks for, and again, this is not some, this is more for us, right? From from a test tester perspective, it should work, not for, not not really for, you know, for actual customer, so it's more of an internal thing, so it's a minor thing. So the good news is it is dynamic. So that's excellent. Now let's go crazy on another one, and then let's add 2,300. OK, and then let's ask a question. What is your most expensive service? Yeah. Let's see, will I pick it up? Yes, no, maybe. Okay, so now there, okay, there it is. So, but you see, this chat bot is violating one of the principles we saw previously, which is just answer the question. So we need to train it with that. So, we can we can go back and say, look. There, OK, so there it is. So it did answer the question, but it just gives a lot of extra info, right? So there it is, based on the most expensive service is that. So again, the live link is working, so it's perfect. Just too much information, so that's fine. So we can say, keep your answers. Short and to the point. Yeah. Just answer. Paragraph. And not the full list of services, for example. Okay, again, I could, you know, I could tune it a bit more after that. So good news, again, it is working. It is connected to the LLM Brain, the API key work. So now you have a blueprint of how to do it. So you just need to wire it in, use your own key. et cetera, et cetera. Feel free to use this exact same Google Sheet. It's open for you to play with and create your own versions of it. So from this point on, I could just iterate as I need it, as I want, and create different the UI. interface and etc. But again, what I want to illustrate is how powerful it is. So if you have a small business yourself or friends, etc, you can say, look, if you have your services, we can do this. We can create a chatbot that actually works. And you can update it real time. And the user going to whatever page like this, a GitHub page or anything else like that, can and will be able to look up your services and you know, and you can post, change the data, blah blah blah. So again, you start becoming, as I said, to you, dangerous in a good way. with something as simple as this. But again, it's a number of skills, AI skills on terminal that you've been stacking over the last few weeks that will help you and enable you to do this. So now we tested that. Okay, so I suppose what I'd say to you is try this demo yourself. Give it a go with the information there. The link is there. Everything else that you need is there. And try to replicate it, improve it, make any changes. And again, what I might do is, instead of having a few submission links for today, I'm probably going to have a single one. For everything, so you can, you know, upload your research, upload everything else, so especially the the the the this, you know, the GitHub URL, so we might aggregate all of that. OK, so you probably will see that in the in Moodle, OK? All right, so it's your turn. So I need you to think of a new chat bot for any other business. So you could treat this again as part working towards your final project if you want to. You don't have to. We're still early enough. But you could do this for any other fictitious business that you wish. Again, think of anything that in the shape that would have a Google Sheet. Create that Google Sheet. By the way, the way the form and manner that I created this was, this is synthetic data, obviously. You can create it yourself. So you can recreate something exactly like this, as many. Data features, as many columns as you like, as many rows as you like, and practice. So, this is good, real-world practice, and then remember when you share it, share the link with anyone so that it is open to your AI agent. OK, so again, when you're finished... Create your own exercise, deploy it live, like I showed you there, and share and submit that URL. So, end to end, this session should take the same thing around 2 hours max to complete, and I look forward to seeing that on Moodle, your submission on Moodle. And I said to you at the start, the reason we're doing this pre-recording is just because it's way easier for you to pause and, you know, look back at what's being done and instead of, you know, waiting. And again, some of you might have different, different, faster, slower, that's perfect. So whatever suits you, that'll be. that'll be best. So again, thanks for all your work. Keep submitting that. We'll review some of that in further sessions. And keep an eye out. So start thinking about the final project ideas. At this stage, I'd say we're close to 80, 85% of the theory. and the practical tools that you will need for your final project. So there's not that much more. So by next week, I aim to be 90 to 95% of the way so that you're, you know, that you can start building, you know, fully. So we'll get to that next week. And again, do send any questions there. I'll enable more instructions next to this video for next steps. So keep building, guys. Well done. I hope you enjoyed it, and I'll talk to you soon. Thank you very much. Take care. Bye-bye.