Skip to content

7.2.0

Latest

Choose a tag to compare

@MelbourneDeveloper MelbourneDeveloper released this 19 Oct 20:50
· 2 commits to main since this release
a153367
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