You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This commit was created on GitHub.com and signed with GitHub’s verified signature.
Fix Codegen and Add MCPCode Generation (#140)
# 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 extensions
- `McpServerGenerator.cs` - Orchestrates OpenAPI → MCP tool code
generation
- CLI tool for command-line generation
**NucliaDB Sample Suite** (`Samples/NucliaDbClient*`)
- Generated client code from NucliaDB OpenAPI spec (~5,800 LOC)
- Comprehensive integration tests with Docker-based NucliaDB instance
- Demo console application showing usage patterns
- Working MCP server implementation with setup documentation
**Core Library Enhancements**
- Added OPTIONS HTTP method support (`CreateOptions` delegates)
- Enhanced test coverage for all HTTP methods including cancellation
scenarios
**Infrastructure**
- CI/CD: Added Docker verification and container cleanup to PR builds
- Test ordering: Priority-based test execution for integration tests
- Code quality: Relaxed StyleCop ordering rules, promoted EXHAUSTION001
to error
**Key Features**
- Generates type-safe MCP tools with proper parameter descriptions
- Integrates with `IHttpClientFactory` pattern (no socket exhaustion)
- Functional composition using Result types for error handling
- Full end-to-end example: OpenAPI → Extensions → MCP Tools → Working
Server