Loading video player...
Lately I’ve been experimenting more with AI agents instead of just prompting and copy-pasting code. Once you start giving agents tools, things get interesting. They can call APIs, read documents, run builds, execute tests, and generally do real work. To make that possible, Anthropic introduced Model Context Protocol (MCP), an open standard that lets agents discover and invoke tools in a consistent way. In this video, I build a small proof-of-concept MCP server called Coin Flip Service. It’s intentionally simple, but it shows the core ideas behind how agents interact with tools. What we cover in this video: - What Model Context Protocol (MCP) is and why it exists - Why AI agents need tools - MCP server architecture and transports - Building a simple .NET console MCP server - Registering an MCP server in VS Code - Letting an agent call a custom tool - Some of the security concerns that come with giving agents real capabilities The example tool is trivial (it just flips a coin) but the mechanics are the same ones you’d use for tools that interact with APIs, databases, CI/CD pipelines, or other systems. Once you see how easy it is to wire this up, it becomes pretty clear how powerful (and potentially risky) this pattern can be. Source code: https://github.com/Fabricari/poc-coin-flip-mcp-server Connect with me: YouTube: https://www.youtube.com/@impostersyndromedev LinkedIn: www.linkedin.com/in/stevencharlesharrison Transcript Alright! So lately, I’ve been getting more comfortable with this idea of using agents to help me write code. Especially with those more human-in-the-loop kind of workflows. That said, it’s quite a bit different than just prompting, copying, and pasting. Agents are actually able to do quite a bit of autonomous planning and orchestrating… using tools. You can get them to make a bunch of API calls, query databases, and read documents. And then they stitch all that information together in a way so that LLM’s are able to give you more reliable results. But more than that, you can actually get your agents to do things. Modify code, run builds, execute tests. You can get them to open pull requests, trigger CI/CD workflows, and even help you out with code reviews. Or maybe… Maybe you can get it to order you a cheeseburger. Get it delivered. But, yeah, like I said, to do all that, agents need tools. And, my goodness, there are so many tools! So, to help with that, the folks at Anthropic introduced this thing called Model Context Protocol. MCP. It’s an open standard that helps with discovering and invoking tools in a more regular way. Still, when I first heard about it, I thought, “Man, that can’t be good. Giving agents, known for their hallucinations and glazing, access to passwords and third-party systems?” But yeah, I guess it’s not that much different than publishing NuGet packages or SDKs. And enabling your client applications to make a bunch of API calls. But yeah… Still, I can’t help but feel a little bit nervous. But then, I figured... What the heck! The best way to deal with this is to actually try to build an MCP Server for myself! A little proof-of-concept! Now, this one’s going to be real simple. I’m going to call it “Coin Flip Service.” A little helper function. Returns heads or tails. Helps you make all the real important decisions. Paper, plastic. Buy it, build it. Love it, leave it… Now, before we dive into the code, let’s see if we can make some sense of what this MCP Server’s actually going to look like. Architecturally, that is. So yeah, I’m using VS Code with a GitHub Copilot Chat extension. And to tell it where my MCP Service is, I’ve got to register it. So, I can do that here inside a little dot-VS-code folder, sitting in my workspace. And inside there, they got this MCP JSON file where I can list out all my servers. And once we got that, VS Code can actually make the call and launch the process. In this case, I’m going real simple. It’s just a local .NET console app. Going to make basic calls using the Standard Input-Output. At least, that’s how they define it in protocol. And here, you can see the agent’s going to make calls to my MCP server using a Client Transport Object. And my server’s over here listening with its own Server Transport Object. Once that request gets sent, the transport hands it on down to the coin-flip tool. And that’s got a private method that does the actual coin flipping. Heads or tails… Real simple. Now there’s other ways we could have done it. We could have had the agent use an HTTP Client Transport if the service was hosted remotely or on the web. Or, for that matter, we could have had our local service proxy all the calls, out into the cloud, using REST or some other API-friendly protocol. Alright? Now… Let’s check out the code!