Fix Codegen and Add MCPCode Generation - #140
Conversation
There was a problem hiding this comment.
Pull Request Overview
Introduces a new MCP code generator and NucliaDB sample, plus expands the OpenAPI generator and core HTTP support.
- Adds RestClient.Net.McpGenerator and CLI to generate MCP tools from OpenAPI and a full NucliaDB sample suite.
- Enhances core RestClient.Net with HEAD and OPTIONS support and refactors OpenAPI generator to a new API surface.
- Updates CI to enforce formatting, run tests, and Docker cleanup.
Reviewed Changes
Copilot reviewed 59 out of 66 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| RestClient.Net/HttpClientExtensions.cs | Adds HeadAsync and OptionsAsync HTTP methods. |
| RestClient.Net/HttpClientFactoryExtensions.cs | Adds CreateHead and CreateOptions factory delegates. |
| RestClient.Net.OpenApiGenerator/* | Significant refactor to parsing and generation APIs and packaging. |
| RestClient.Net.McpGenerator/* | New MCP tool/server generator and CLI. |
| Samples/NucliaDbClient/* | New sample with docker-compose, setup scripts, demo, tests, and MCP server. |
| Samples/RestClient.OpenApiGenerator.Sample.* | Updates to Async methods and records usage. |
| .github/workflows/pr-build.yml | CI changes: tool restore, formatting check, Docker verify/cleanup, mutation testing. |
| .config/dotnet-tools.json | Adds csharpier tool. |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 58 out of 65 changed files in this pull request and generated 11 comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 58 out of 65 changed files in this pull request and generated 13 comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
TLDR;
New code generator that creates MCP server tools from OpenAPI specs, plus comprehensive NucliaDB sample implementation demonstrating the full workflow from OpenAPI → RestClient.Net extensions → MCP tools.
Summary
This PR adds RestClient.Net.McpGenerator, a code generator that transforms OpenAPI specifications into Model Context Protocol (MCP) server tools. The generator builds on top of the existing OpenAPI → RestClient.Net extension methods, creating type-safe MCP tools that expose REST APIs to Claude and other LLM tools. Includes a complete reference implementation using the NucliaDB API with tests, demo, and working MCP server.
Details
New Components (36 new files, 64 total changed)
MCP Generator (
RestClient.Net.McpGenerator)McpToolGenerator.cs- Generates MCP tool classes wrapping RestClient.Net extensionsMcpServerGenerator.cs- Orchestrates OpenAPI → MCP tool code generationNucliaDB Sample Suite (
Samples/NucliaDbClient*)Core Library Enhancements
CreateOptionsdelegates)Infrastructure
Key Features
IHttpClientFactorypattern (no socket exhaustion)