[00:00:06] Hello everyone. My name is Stefan Halter [00:00:08] and I'm a developer on the .NET team. [00:00:10] I've worked a lot on ASP.NET Core in the [00:00:12] past, closely with Dan. We just did a [00:00:14] great presentation. Uh, but today I'm [00:00:17] going to share with you um what's new in [00:00:20] the MCP C SDK. Um, I'm going to try to [00:00:24] be uh as demoheavy as possible. um is [00:00:27] seeing the demos work and if not I'll [00:00:29] fall back to some slides. Um but um for [00:00:32] those of you who uh have been living [00:00:34] under a rock and have been trying to [00:00:36] avoid AI um MCP stands for model context [00:00:39] protocol. It was uh popularized around [00:00:42] the end of uh 2024 by Anthropic who used [00:00:45] it in cloud code and then around the [00:00:47] same time everyone else picked it up and [00:00:50] it's uh essentially a way to uh plug in [00:00:54] agents um into your software um in a [00:00:58] reusable way. So um I promised demos so [00:01:03] we're going to start with just a [00:01:05] fireworks control tool to kind of give [00:01:07] you an idea of what this looks like. Um, [00:01:10] I've already attached some MCPS ahead of [00:01:13] time. So, I hit this little icon, um, up [00:01:17] here, [00:01:18] uh, which, you know, shows extensions. [00:01:20] And if you look here, I have three MCPs [00:01:22] set up. This is in a JSON config, um, [00:01:26] which has both kinds of MCP servers. So [00:01:30] if I zoom in a little bit, [00:01:35] you can see that there's uh you know an [00:01:38] HTTP type or remote type server and [00:01:40] local which runs uh executable. So this [00:01:43] communicates either over streamable HTTP [00:01:46] or standard IO. The C SDK supports both, [00:01:49] but for this particular sample um we're [00:01:52] doing fireworks, which I already have [00:01:54] running um inside of one of my command [00:01:58] line tabs. Um, so ready to s uh receive [00:02:02] um requests. [00:02:05] And here I'm going to try using Luna. So [00:02:09] hopefully it's fast. And I'll try to [00:02:10] launch some fireworks and show you what [00:02:12] that's like. [00:02:15] So I currently have this configured to [00:02:21] prompt for um tool usage, which it [00:02:25] should um if it stops reasoning soon. [00:02:28] asks me about and it'll give me um [00:02:30] parameters um for launching this [00:02:33] fireworks show which will end up showing [00:02:35] me. I'll allow it for this session. We [00:02:37] have a little celebration um and it [00:02:39] shows in line this iframe which is [00:02:42] returned from MCP. So this is using a [00:02:44] feature that used to be called MCP UI is [00:02:46] now called MCP apps. Um and um that's [00:02:52] uh something that we're going to dig [00:02:53] into a little deeper. So this particular [00:02:57] server, here's the program CS, we got [00:02:59] the fireworks server. Um, and it [00:03:02] supports either standard IO or HTTP, but [00:03:04] by default it is uh using HTTP, which we [00:03:08] see here. Um, and then at this point, [00:03:11] we're adding um tools, which includes [00:03:14] this launch firework tool that we just [00:03:16] called, uh, prompts and resources. And [00:03:19] I'll get into the prompts and resources [00:03:21] in a little bit. Tools are probably [00:03:23] something that you're pretty familiar [00:03:24] with. um agents have supported tool [00:03:27] calling for a long time now. That's what [00:03:28] makes them agentic and MCP provides a [00:03:32] JSON RPCbased protocol for how to call [00:03:35] this. Um and then this is using web [00:03:38] application builder. If you're doing [00:03:40] standard IO only, you're free to use [00:03:42] host application builder. Um and then [00:03:44] you can choose either with your standard [00:03:45] IO uh server transport or with HP [00:03:48] transport. And we're using the stateless [00:03:51] mode which we recently made the default. [00:03:53] And um this is useful um for scalability [00:03:57] um if you don't have sticky sessions and [00:04:00] just like general reliability. So your [00:04:02] server um lasts past a a restart. So [00:04:06] this sample you might also know is [00:04:08] notice is using signal R. So um it's [00:04:12] being kept in sync. So I have a tab over [00:04:14] here where you can see the same little [00:04:16] celebration firework show. Um and MCP is [00:04:20] end to end. So initially I showed you um [00:04:24] how to call an MCP server from VS Code. [00:04:27] You can do the same from Visual Studio, [00:04:29] GitHub Copilot app, Codeex, Cloud Code, [00:04:32] etc. Um but you can also use the same C [00:04:36] SDK to um call the tools um from a [00:04:41] client. So I also have this fireworks [00:04:44] client [00:04:46] um which is [00:04:48] um basically using the MCP client to [00:04:52] list the fireworks tools available from [00:04:54] our endpoint and then it's passing the [00:04:57] tools that we get from the listing to [00:05:00] the uh I chat client. So if any of you [00:05:03] saw Louise's excellent session [00:05:04] yesterday, um tools are just uh you know [00:05:08] AI tools or AI functions um that can [00:05:11] work end to end with you know the [00:05:13] Microsoft extensions AI stack. So also [00:05:16] pre-cooked a little bit I have um this [00:05:21] app set to basically say let's try and [00:05:24] customize this firework show to be [00:05:26] specific for net comp. So if we run that [00:05:30] um this will connect to the MCP server [00:05:33] and we can prove that because hopefully [00:05:36] um you know we get a new little [00:05:37] fireworks show with a net comp theme. So [00:05:41] this shows how uh tools can interact [00:05:43] with real life things. You know [00:05:45] hopefully you have something a little [00:05:46] more um exciting than a vibecoded uh you [00:05:51] know fireworks show but um it works well [00:05:54] for demos. Another thing that I want to [00:05:57] show you that I think if you take [00:05:59] nothing else away from this talk um is [00:06:03] the MCP inspector. So if you're working [00:06:05] on an MCP server um you could see how in [00:06:08] my last demo where I asked it to launch [00:06:10] fireworks, it took a minute before it [00:06:12] did before Lena decided which tool to [00:06:14] call and that's not using a high [00:06:16] reasoning model. But um if you connect [00:06:20] with the uh fireworks uh show control [00:06:23] with uh the server inspector which I [00:06:27] also pre-launched um that's just npx. [00:06:30] Let me see if I can zoom in here. Um [00:06:36] all right there we go. Um so we have npx [00:06:40] model context protocol inspector. um [00:06:43] that launched this um browser window [00:06:46] with a API token to prevent kind of [00:06:49] cross-sight request forgery attacks and [00:06:51] then I can see the apps in the tools and [00:06:54] so forth myself. So if I wanted to in [00:06:57] this case an app is typically returned [00:06:59] from a tool call which is like launch [00:07:01] fireworks um I can [00:07:04] test it here without having to involve [00:07:07] an agent and I can see the same kind of [00:07:08] output and at the same time I can also [00:07:11] see the actual JSON RPC payloads going [00:07:15] back and forth. Um in the C SDK we try [00:07:18] as much as possible to abstract um all [00:07:21] this JSON RPC away from you. Um so we [00:07:24] work across the various protocol [00:07:26] versions of MCP that exist um but we [00:07:30] also um have many layers of the stack [00:07:32] which give you um control. So back to [00:07:34] the slides for a second. [00:07:38] All right. So that's the the fireworks [00:07:41] control demo. Um and the value [00:07:44] proposition of MCP is that it's a shared [00:07:47] interface. So a lot of people have [00:07:50] called this basically the USBC of AI or [00:07:53] just USB. Um so it gives you a common [00:07:57] interface for hosts or clients um and [00:08:00] servers to um you know facilitate tool [00:08:05] calls without relying on a SDK in a [00:08:08] specific language or whatever um or you [00:08:11] know having to use an open AI or [00:08:13] anthropic specific kind of toolkit. Um [00:08:17] you know there's a this standardization [00:08:19] is really key because going on with M [00:08:22] you know at the beginning of MCP a lot [00:08:24] of the feedback that I read online was [00:08:26] we already have uh open API specs we [00:08:29] already have HTTP like why wouldn't I [00:08:32] use that and as uh the big benefit of [00:08:35] MCP is you have that standardization um [00:08:39] similar to USB like before USB we had um [00:08:42] serial ports we had PS2 which wasn't a [00:08:46] to connect your PS2 to your computer. It [00:08:48] was a keyboard and mouse interface for [00:08:50] those youngans watching. Um, but this is [00:08:55] uh, you know, easy to plug in. And if [00:08:58] you can't find kind of that extensions [00:09:01] button that I showed to, you know, [00:09:03] preconfigure everything, um, ask your [00:09:05] agent to configure the MCP for you. Um, [00:09:07] and you're likely to have good success [00:09:09] with that. Um so yes um in this case we [00:09:15] showed the tools launch fireworks and uh [00:09:18] MCP apps which gives you that iframe UI [00:09:20] uses a capability called resources an [00:09:24] MCP which gives you access to something [00:09:27] a bit like a file directory um through [00:09:30] the MCP interface and then prompts um [00:09:33] allow you to do um parameterized [00:09:37] instructions um to kind of set up your [00:09:39] agent session. All those can be uh [00:09:42] viewed and manipulated through the MCP [00:09:45] inspector. The inspector tends to get [00:09:46] new features first um even you know [00:09:49] before the popular clients or hosts. So [00:09:52] uh I recommend peeking around through [00:09:55] that. Um so to the layering I talked [00:09:58] about. So I talked about how there's [00:10:00] this highle um API which I'm going to [00:10:03] show uh more closely just after this [00:10:06] slide. um and lower level APIs. Um right [00:10:10] now we have six packages. Um there are [00:10:13] three primary ones. Um I recommend that [00:10:17] um most people uh well if you want to do [00:10:20] a remote MCP server, you have to use the [00:10:23] model context protocol ASP.NET core [00:10:25] package. What's convenient about that is [00:10:28] um you can call that map MCP method that [00:10:30] I scrolled by earlier. Specify uh route [00:10:33] parameters. Um, so you can even have um, [00:10:37] you know, a dynamic MCP server based on [00:10:40] the name of your route. Um, and you can [00:10:42] host multiple MCP servers at different [00:10:44] endpoints inside of your ASP.NET Core [00:10:46] app. Um, so it doesn't have to be [00:10:48] exclusively MCP. Um, for some people who [00:10:52] don't want, you know, the ASP.NET Core [00:10:54] shared framework and is you're either [00:10:56] doing a client or a standard IO server, [00:11:00] um, feel free to use the model context [00:11:01] protocol package. And if you um just [00:11:05] have no love for dependency injection um [00:11:08] or kind of you know you want to be as [00:11:10] lowle as possible there's a uh core [00:11:12] package um which you know um should trim [00:11:16] even better. Um so there's also [00:11:18] extensions that are um defined by MCP [00:11:22] via the uh SCP process which is the [00:11:25] specification enhancement proposals. Um [00:11:28] I'm part of the MCP transport working [00:11:31] group. There are a bunch of them for [00:11:33] various things like skills, UI, O and so [00:11:37] forth. And this um allows the protocol [00:11:41] to add new features um without um [00:11:45] affecting anyone who's using the primary [00:11:47] packages and allows people to pick or [00:11:49] choose um which features you want to [00:11:50] have. And um so really quickly, if you [00:11:55] want to see what's supported, I [00:11:57] recommend going to model context [00:12:00] protocol. io [00:12:03] and um [00:12:06] you can see here that the C SDK is one [00:12:09] of the official SDKs um that is now [00:12:13] owned by the agentic AI foundation. So [00:12:16] model context protocol as I mentioned [00:12:18] earlier in the talk was originally [00:12:19] created by anthropic but they then [00:12:22] donated it to the Linux foundation that [00:12:24] spun off the agentic AI foundation and [00:12:26] they now manage all these model context [00:12:29] protocol repos. We help maintain the C [00:12:33] SDK here at Microsoft. Um same like [00:12:36] Google has some people helping on the Go [00:12:38] SDK and so forth. Um so it's a real [00:12:40] community effort. Um and since they've [00:12:43] done this tiering system, you can see C# [00:12:45] SDK is a tier one uh SDK, which means [00:12:48] that we support um all the required um [00:12:52] protocol specification. Uh and we also [00:12:55] have a lot of support for these [00:12:56] extensions. Um here you can see a bunch [00:12:58] of clients that support um MCP as you [00:13:02] could see earlier like VS Code supports [00:13:05] MCP apps. Some of these things like [00:13:07] skills are very new. Um like this is [00:13:09] skills over MCP. Um so that allows you [00:13:12] to access skills remotely, maybe [00:13:14] parameterize it and so forth. Um was [00:13:17] currently a beta extension. [00:13:21] [snorts] [00:13:21] So quickly looking uh back at this [00:13:24] Fireworks server example, [00:13:26] uh some some things to note. Um, so we [00:13:30] added the fireworks tools and this [00:13:32] should be very familiar to anyone who's [00:13:34] worked with like an MVC controller. Um, [00:13:37] this is all AOT compatible and you can [00:13:40] see that the launch fireworks here um [00:13:46] has a set of parameters. Uh, one of the [00:13:48] parameters uh comes from the service [00:13:50] provider. So um you can inject services [00:13:54] into your methods um like iHub context [00:13:56] which allows the synchronization between [00:13:58] the browser windows. Um and then uh the [00:14:02] next two parameters are services as [00:14:04] well. The last four are um parameters [00:14:08] that are provided via JSON over JSON RPC [00:14:11] either via standard IO or HTTP. And [00:14:13] that's why we have these description [00:14:15] attributes so the agent knows what type [00:14:18] of parameters to include. uh in these [00:14:21] calls. Um and then with prompts we have [00:14:24] a similar thing where we just attribute [00:14:28] methods and [00:14:31] carry on. So this IMCP server builder [00:14:35] that you see us attaching prompts, [00:14:37] resources and so forth to is part of [00:14:40] that outer kind of non-core package. So [00:14:42] you can use this without ASP.NET Core, [00:14:44] but the core package um has you working [00:14:47] at a lower level. So, I know that I'm [00:14:51] already about halfway through this talk, [00:14:52] so I'm not going to spend a lot of time [00:14:54] sh writing that code or even demoing it, [00:14:56] but um there are low-level APIs where [00:14:59] you can call MCP server tool.create with [00:15:03] a delegate. You know, it will do the [00:15:05] same kind of lookup um that we were [00:15:08] doing inside the class earlier for [00:15:09] launch fireworks. You can new up some [00:15:11] MCP server options. Um you can pass your [00:15:14] set of tools to the tool collection. [00:15:16] Same thing with prompts and resources. [00:15:19] And you can run the server and this will [00:15:21] start talking back and forth between MCP [00:15:24] uh [00:15:25] using MCP between your client and [00:15:28] server. Um furthermore, if you don't [00:15:32] want to do like a highlevel, you know, [00:15:35] take parameters return content and you [00:15:37] want to see the actual JSON RPC payload [00:15:40] as it goes over the wire, there's [00:15:42] options for that, too. Um you can do [00:15:45] that directly via MCP server options in [00:15:47] the core um nougat package [00:15:52] but you can also um just use these [00:15:55] helpers. So um you have things like if [00:15:59] you want to instead of defining tools um [00:16:03] from code and want to read a list of [00:16:06] tools um with parameters from a [00:16:08] database, you could do with list tools [00:16:11] handler and that will give you um a [00:16:14] request object and allow you to return a [00:16:18] list tool result and so forth. Um same [00:16:20] thing you can do um filters which is [00:16:24] essentially like middleware um that [00:16:27] allow you to intercept like specifically [00:16:29] launch fireworks or um certain users um [00:16:33] you can um handle cross cutting concerns [00:16:36] that way. [00:16:39] So creating an MCP server. Um there's a [00:16:43] project template. Um you can use net new [00:16:45] MCP server. Um sample MPCP server. Um I [00:16:49] considered going through the file new [00:16:52] project thing in Visual Studio, but I'm [00:16:55] already running over time. But you [00:16:57] already saw um some of these attributes. [00:17:00] So um basically it just sets up a basic [00:17:03] convert Celsius to Fahrenheit tool. And [00:17:06] um there's an option for both uh remote [00:17:09] and a local MCP server. So that's [00:17:13] installed if you have the latest .NET 11 [00:17:16] SDK. Even the .NET 10 SDK has this. So I [00:17:19] recommend trying it out. It's not nearly [00:17:21] as complicated as the Fireworks demo [00:17:24] because it doesn't have uh as much going [00:17:27] on. [snorts] And then yes, um I already [00:17:30] showed you uh the client launching a [00:17:33] Fireworks show. So that shows you kind [00:17:35] of the end to end where the user [00:17:38] interacts with the model through the [00:17:40] client um which provides the tools that [00:17:43] the model can call and then um the [00:17:45] server can run your code and this allows [00:17:47] you to add um a level of determinism [00:17:50] beyond what would you might have with a [00:17:52] CLI because you can you know expose [00:17:54] specific cool tools with specific rules [00:17:56] and um it offers a remote capability in [00:17:59] case uh you don't have like uh shell [00:18:01] access Um, so that's what this slide is [00:18:05] about. Um, so standard IO, um, is [00:18:08] useful, of course, if you want to do [00:18:09] something like computer use or interact [00:18:11] with the machine you're on. All right. [00:18:14] So, another really cool feature, which [00:18:16] I'm glad we had time to get to, is [00:18:18] elicitation. So, this gives you another [00:18:21] benefit beyond uh just a command line [00:18:25] API or a skill. Um when you implement an [00:18:28] MPCP server, you can um do uh requests [00:18:33] that basically instead of taking [00:18:34] parameters from the model or the agent, [00:18:37] the rule is that you have to um expose [00:18:41] elicitations to the user. So, in this [00:18:44] case, I'm going to start a new chat in [00:18:49] the GitHub copilot app, which also has [00:18:51] the uh server set up. And I can you plan [00:18:58] a source.net release. [00:19:01] Um, shout out to Tanner who um did a [00:19:06] very um cool talk yesterday on the math [00:19:10] features that we've introduced in C# [00:19:12] recently and is also maintaining [00:19:14] source.net. Um this is a uh fake [00:19:18] um planning thing but it's asking all [00:19:21] right what version of uh source.net do [00:19:23] we want to use? Right? So this um as it [00:19:26] turns out is a parameter to the release [00:19:30] planner server which you can see here. [00:19:34] So it just has a parameter like we [00:19:36] showed earlier which takes a um a [00:19:41] version with and in this case since I [00:19:44] didn't tell the agent what version I [00:19:45] wanted it just asked me but it didn't [00:19:47] have to it could have guessed. Um but [00:19:50] for this you see that we just have this [00:19:53] um [00:19:56] all right zooming in this basically set [00:19:59] of enumes I have to pick. So we're going [00:20:00] to go straight to prod like I always do. [00:20:03] We're going to go blue green roll out to [00:20:05] 50% and then roll back if we have one. [00:20:08] Um and then um we have a second [00:20:11] elicitation where my server said that [00:20:14] before we make any action we need to [00:20:16] approve a release plan. So how did this [00:20:17] work? Um [00:20:20] so in here we set up uh the server tool [00:20:24] with a bunch of uh elicit request [00:20:28] params. So we have a request schema that [00:20:31] took um various enumes and like sche uh [00:20:34] numbers. So for uh percentages we could [00:20:37] say it could be one to 100 and so forth. [00:20:40] Um and then we're um managing the state [00:20:44] basically between requests um ourselves [00:20:47] by B 64 encoding it. So that's not [00:20:49] secure. Um you should use like data [00:20:51] protection or something if you're asking [00:20:52] the client to roundt trip it. But um [00:20:55] this is new with the latest SDK because [00:20:57] um prior to that the implementation for [00:21:00] doing this required um doing a [00:21:03] servertoclient request and that required [00:21:06] sticky sessions essentially. It required [00:21:08] the client to go back to the exact same [00:21:11] server um to [00:21:15] to basically continue the continuation. [00:21:18] Um so the new model we return an error [00:21:23] which says hey we require more input um [00:21:26] please show this request to the user um [00:21:29] send us the input and um along with the [00:21:34] entire new request. So if the request [00:21:36] goes to a new server, it has that [00:21:38] context and it can decode the state that [00:21:40] you roundtrip using B 64 encoding or um [00:21:45] data protection encryption or something [00:21:46] of that nature. [00:21:49] So yeah, this is uh how you can uh [00:21:52] return an input required result which is [00:21:54] like an error result. Um and this slide [00:21:57] explains like why that helps uh [00:21:59] scalability is you don't need a sticky [00:22:01] session. um if your server dies um you [00:22:04] can restart and as long as you can [00:22:06] restore the state from the database or [00:22:08] the roundtrip data you're in good shape. [00:22:13] Um, one nice thing of using an SDK [00:22:16] instead of trying to do um, you know, [00:22:18] the JSON RPC by hand, of course you have [00:22:21] a bunch of eyes on it, a bunch of people [00:22:23] contributing, tons of public uh, [00:22:25] contributors have helped us here and one [00:22:27] um, that we got from internal Microsoft [00:22:29] team was uh, basically a mixed mode [00:22:32] which allows you to program the new way [00:22:35] where you return an error result but if [00:22:37] you're talking to an older client, it [00:22:40] will convert that to server to client [00:22:41] request. So as long as you have sticky [00:22:43] sessions, you can still support [00:22:44] elicitation the old way for older [00:22:46] clients. Uh for clients that haven't [00:22:48] updated to the new 7 28 protocol, which [00:22:51] is uh July 28th, 2026, they came out [00:22:55] with this like new stateless very [00:22:56] reliable protocol. They uh the you know [00:22:58] MCP [00:23:00] um protocol committee really focused on [00:23:04] um remote servers and how they can [00:23:06] scale. Um, another thing that's super [00:23:08] helpful um, with MCP is, okay, you have [00:23:12] a standardized way to request input [00:23:16] directly from the user and not the [00:23:17] model. You also have a way to [00:23:19] authenticate. So here I'm just going to [00:23:23] show quickly. [00:23:27] I have the protected um MCP sample [00:23:32] um loaded [00:23:34] from the model context protocol [00:23:38] um repo. And here you can see that we're [00:23:42] using um require authorization on [00:23:45] mapmcp. So this should be very familiar [00:23:48] to anyone who's uh used ASP.NET core [00:23:51] authorization and it's even using um [00:23:54] adjot baroth. The only thing that's kind [00:23:56] of special is that we have this um add [00:23:59] ncp call to the authentication builder [00:24:02] which gives the client the data that it [00:24:05] needs to authenticate. So um you might [00:24:08] have noticed earlier that it said hey [00:24:10] you need to sign in to this protected [00:24:11] MCP server. So this will um pop up a [00:24:16] browser um ask me to authenticate with [00:24:19] Entra. I'm going to skip that for now [00:24:21] since I'm out of time. But then, you [00:24:24] know, inside of your tool call handlers [00:24:26] and stuff, you'll have a claims [00:24:28] principle where you can see what roles [00:24:30] that user is in, what access you should [00:24:32] give them. Um, and you don't need to put [00:24:36] tokens um inside of your environment and [00:24:39] stuff and give access to secrets to the [00:24:42] agent. Um, this works um all through the [00:24:47] MCP host, which is super helpful. [00:24:54] All right. Um, so I talked a little bit [00:24:56] throughout this talk about where um, MCP [00:24:58] fits in with CLI and skills. They are [00:25:00] complimentary. Um, there are there is [00:25:02] some overlap too. So um, you know, no [00:25:04] one's making use of MCP, but I do think [00:25:06] there are a lot of benefits um, [00:25:08] particularly with features like [00:25:10] elicitation off and MCP apps. Um, all [00:25:14] right. And yeah, I definitely recommend [00:25:17] that you take a look at the uh SDK docs [00:25:20] and the protocol documentation uh to [00:25:23] learn more. And I'll have the samples [00:25:26] that I showed you up on the net comp [00:25:29] sample [snorts] page soon.