Summary
I'd like to contribute a C# / .NET server SDK (McpUi.Server) for mcp-ui. This aligns with the roadmap item: "Add SDKs for additional programming languages (in progress)".
I'm actively building an MCP server in C# that uses _meta.ui.resourceUri to deliver interactive UI, and I've been manually constructing the UIResource payloads. A proper SDK would formalize this and give the growing .NET MCP ecosystem first-class mcp-ui support.
Scope
Server SDK only — matching the pattern of the existing Python and Ruby SDKs. No client SDK is needed (that's a React/browser concern).
What would be included
| Component |
Description |
CreateUIResource() |
Core factory function — URI validation, rawHtml/externalUrl handling, text/blob encoding |
| Type definitions |
UIResource, CreateUIResourceOptions, RawHtmlPayload, ExternalUrlPayload, content payload discriminated unions |
| UI metadata |
Metadata prefixing (mcpui.dev/ui-), preferred-frame-size, initial-render-data |
| External URL fetching |
Async HTTP fetch with SSRF protections (private IP blocking), <base> tag injection, size limits — matching the TypeScript SDK's behavior |
| UI Action result helpers |
Factory methods for tool, prompt, link, intent, notify action types |
| Custom exceptions |
McpUiServerException, InvalidUriException, InvalidContentException, EncodingException |
| Unit tests |
Full coverage using xUnit — porting the test cases from the Python SDK |
| README |
Installation, usage examples, API reference |
Proposed file structure
sdks/
└── csharp/
└── server/
├── McpUi.Server.sln
├── src/
│ └── McpUi.Server/
│ ├── McpUi.Server.csproj
│ ├── McpUiServer.cs # Core CreateUIResource
│ ├── Types.cs # All type definitions
│ ├── UIActionResults.cs # Action result helpers
│ ├── Utilities.cs # URL validation, encoding, helpers
│ └── Exceptions.cs # Custom exceptions
└── tests/
└── McpUi.Server.Tests/
├── McpUi.Server.Tests.csproj
├── CreateUIResourceTests.cs
├── MetadataTests.cs
└── UIActionResultTests.cs
Dependencies
ModelContextProtocol — the official C# MCP SDK, provides EmbeddedResourceBlock, TextResourceContents, BlobResourceContents
- Target framework:
net8.0 (matching the official C# MCP SDK)
Usage example
using McpUi.Server;
var resource = await McpUiServer.CreateUIResourceAsync(new CreateUIResourceOptions
{
Uri = "ui://my-server/widget",
Content = new RawHtmlPayload("<h1>Interactive Widget</h1>"),
Encoding = ContentEncoding.Text,
UIMetadata = new UIResourceMetadata
{
PreferredFrameSize = ("800px", "600px")
}
});
Questions for maintainers
- NuGet package naming: I'm planning
McpUi.Server to follow .NET conventions. Any preferences? (MCP.UI.Server, McpUI.Server, etc.)
- External URL fetching: The TypeScript SDK does full HTTP fetch +
<base> tag injection + SSRF protection. The Python SDK stores the URL string as-is. I'd like to match the TypeScript behavior for feature parity — does that align with your expectations?
- CI integration: Should the initial PR include a
test:csharp script in the root package.json (similar to test:ruby), or should that be a follow-up?
Happy to discuss further before starting work. Looking forward to contributing!
Summary
I'd like to contribute a C# / .NET server SDK (
McpUi.Server) for mcp-ui. This aligns with the roadmap item: "Add SDKs for additional programming languages (in progress)".I'm actively building an MCP server in C# that uses
_meta.ui.resourceUrito deliver interactive UI, and I've been manually constructing theUIResourcepayloads. A proper SDK would formalize this and give the growing .NET MCP ecosystem first-class mcp-ui support.Scope
Server SDK only — matching the pattern of the existing Python and Ruby SDKs. No client SDK is needed (that's a React/browser concern).
What would be included
CreateUIResource()rawHtml/externalUrlhandling, text/blob encodingUIResource,CreateUIResourceOptions,RawHtmlPayload,ExternalUrlPayload, content payload discriminated unionsmcpui.dev/ui-),preferred-frame-size,initial-render-data<base>tag injection, size limits — matching the TypeScript SDK's behaviortool,prompt,link,intent,notifyaction typesMcpUiServerException,InvalidUriException,InvalidContentException,EncodingExceptionProposed file structure
Dependencies
ModelContextProtocol— the official C# MCP SDK, providesEmbeddedResourceBlock,TextResourceContents,BlobResourceContentsnet8.0(matching the official C# MCP SDK)Usage example
Questions for maintainers
McpUi.Serverto follow .NET conventions. Any preferences? (MCP.UI.Server,McpUI.Server, etc.)<base>tag injection + SSRF protection. The Python SDK stores the URL string as-is. I'd like to match the TypeScript behavior for feature parity — does that align with your expectations?test:csharpscript in the rootpackage.json(similar totest:ruby), or should that be a follow-up?Happy to discuss further before starting work. Looking forward to contributing!