Skip to main content

Posts

Showing posts with the label MCP

Ship your C# MCP Server as a one-click bundle with MCPB

You built an MCP server in C#. It works great on your machine. Now you want to share it with colleagues, publish it to the community, or ship it as part of a product. The problem? Every time someone wants to use a local MCP server, they have to clone a repo, install runtimes, hand-edit a JSON config file, get the path wrong, edit it again... you know the drill. MCP Bundles ( .mcpb ) solve exactly that. They're the .vsix of the MCP ecosystem: a single file that a supporting app (like Claude for Desktop) opens with one click to present a guided install dialog. No terminal, no JSON editing, no "works on my machine." This post walks through taking a C# MCP server binary and packaging it into a distributable .mcpb file from scratch. What's inside a .mcpb file? Before touching anything, it helps to understand what you're building. A .mcpb file is just a ZIP archive with a specific structure: my-server.mcpb (ZIP file) ├── manifest.json ← required: ...

Expose your stored procedures as AI agent tools with DAB 2.0

Data API builder 2.0 (currently in public preview) is a major release focused on MCP and AI integration. Among its headline features is the ability to expose stored procedures as custom MCP tools , making them discoverable and callable by AI agents. No glue code, no middleware, no extra plumbing. In this post I'll walk through how the feature works, and show a practical example: wiring up a full-text search stored procedure as its own dedicated tool that any MCP client can discover and call by name. The idea: a dedicated search tool By default, DAB's SQL MCP Server exposes tables and views through generic DML tools — things like list_books , get_book , and so on. These are useful for straightforward CRUD, but they're not designed for complex operations like full-text search. With custom-tool: true , you can go further. Set that flag on a stored-procedure entity and DAB dynamically registers the procedure as a named, purpose-built tool in tools/list . The AI agent di...

Icons for Tools, Resources, and Prompts–Because a picture is worth a thousand words

With the ever growing list of MCP servers and supported tools, it is hard to spot the right tool. With the v1.0 release of the official MCP C# SDK, you can make it a little bit easier to discover your tools thanks to the introduction of icon support — tools, resources, and prompts can now carry icon metadata that clients can display in their UIs. Because a picture is worth a thousand words MCP servers expose tools, resources, and prompts through list endpoints ( tools/list , resources/list , prompts/list ). Up until now, those lists were purely textual — names and descriptions. With icons, client applications like MCP Inspector or AI agent UIs can render visual identifiers alongside each item, making large tool catalogs much easier to navigate at a glance. The simple case: a single icon via attribute The quickest way to add an icon to a tool is through the IconSource parameter on the [McpServerTool] attribute: The same IconSource parameter is available on [McpServerResour...

Testing your MCP server with Visual Studio HTTP Files

If you're building or testing Model Context Protocol (MCP) servers and you need a quick way to verify your endpoints are working correctly. Visual Studio's HTTP files ( .http ) provide an elegant, code-based approach to API testing What are Visual Studio HTTP files? HTTP files are plain text files with a .http or .rest extension that let you define and execute HTTP requests directly in your editor. They're supported in Visual Studio, Visual Studio Code (with the REST Client extension), and JetBrains IDEs. Think of them as executable documentation for your API. Why use HTTP files for MCP testing? The Model Context Protocol defines a JSON-RPC 2.0 interface for AI model interactions. Testing these endpoints traditionally meant using tools like Postman or curl commands, but HTTP files offer several advantages: Version control friendly : Store your test requests alongside your code Easy sharing : Team members can run the same tests instantly Fast iteration...

Passing parameters to a hosted MCP Server in C#

The Model Context Protocol (MCP) enables seamless integration between AI applications and external data sources. When working with MCP servers in C#, you'll often need to pass parameters to configure server connections, specify endpoints, or provide authentication details. This post walks you through the practical approaches to handling URL parameters when connecting to MCP servers. Understanding MCP transport mechanisms Before diving into configuration, it's crucial to understand the two primary ways MCP servers communicate, as this fundamentally impacts how you pass parameters. STDIO Transport involves running the MCP server as a child process that communicates through standard input/output streams. Your MCP client launches the server (typically a Node.js script or executable) and exchanges messages via stdin/stdout. This is the most common approach for local development and desktop applications. Hosted MCP Servers run as independent web services that expose Se...

Building our first MCP Resources enabled MCP Server with C#–Advanced

This is a follow-up on an earlier post where I demonstrated how to build your own MCP server in C# and expose one or more MCP resources. Today we dive a little bit deeper and look at some more advanced features you can add to your MCP server implementation. Working with complex return types Resources can return various types. Here are some advanced examples: Return values from resource methods can be strings (for simple text), ReadResourceResult (for full control), or other types that the SDK automatically marshals into the appropriate format. Dependency injection Resources can use dependency injection to access services: We changed our implementation to use instance methods (not static). Now we need to register the class in Program.cs: Progress reporting For long-running operations, you can report progress: IProgress parameters accepting ProgressNotificationValue values enable progress reporting from resources to clients, with progress notifications propaga...

Building our first MCP Resources enabled MCP Server with C#

In our first post , we explored what MCP resources are and why they matter. In a second post , we learned how to use resources in VS Code. A third post followed where I showed the same in Visual Studio. Now it's time to build—let's create our own MCP resource server from scratch using C# and the official .NET SDK. By the end of this post, you'll have a working MCP server that exposes both static and dynamic resources, Setting up our project Let's start by creating a new console application and adding the necessary packages. Step 1: Create the Project Open your terminal and run: dotnet new console -n ProjectDocsServer cd ProjectDocsServer Step 2: Add Required Packages We need two NuGet packages: # Add the MCP SDK (currently in preview) dotnet add package ModelContextProtocol --prerelease # Add hosting support for dependency injection dotnet add package Microsoft.Extensions.Hosting The ModelContextProtocol package provides the core MCP server functio...

Hands-on with MCP Resources in Visual Studio

In the first post of this series, we explored what MCP resources are and why they're the overlooked piece of the MCP puzzle. In a second post we showed how to use MCP resources in Visual Studio Code. Before I continue with a next post on building your own MCP server, I first want to show you how Visual Studio handles MCP resources. Setting up your MCP server with resources in Visual Studio. Let's start by installing an MCP server that provides resources. We'll use the GitHub MCP Server as our example because it's widely used and demonstrates several resource patterns. We’ll use an mcp.json file to configure our mcp server: Create .vscode/mcp.json in your workspace root Add your server configuration: Save the file—Visual Studio will detect it and try to load the MCP server. If you now try to use this MCP server, you’ll notice that it doesn’t work yet. This is because we first need to authenticate and fetch an OAUTH token. Click on the …...

View your installed MCP servers in VSCode

Managing Model Context Protocol (MCP) servers in VS Code has become significantly easier with the dedicated management interface in the Extensions view. While you can configure MCP servers in multiple places throughout VS Code, the Extension tab provides a centralized, visual approach to monitoring and controlling all your available MCP servers. The challenge of multiple configuration points VS Code offers several ways to configure MCP servers, which provides flexibility but can also create complexity: Workspace settings via .vscode/mcp.json files for project-specific configurations User settings for global MCP server configurations across all workspaces Automatic discovery of servers defined in other tools like Claude Desktop Direct installation from the curated MCP server list Command-line configuration using the --add-mcp option And more… While this flexibility is powerful for developers working across different projects and environments, it ca...