-
Notifications
You must be signed in to change notification settings - Fork 51
Fix Codegen and Add MCPCode Generation #140
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
...piGenerator.Sample.JSONPlaceholder/RestClient.OpenApiGenerator.Sample.JSONPlaceholder.csproj
Show resolved
Hide resolved
RestClient.Net.OpenApiGenerator/ExtensionMethodGenerator.cs.bak
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
...piGenerator.Sample.JSONPlaceholder/RestClient.OpenApiGenerator.Sample.JSONPlaceholder.csproj
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
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)