Skip to content

Conversation

@MelbourneDeveloper
Copy link
Owner

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

Copilot AI review requested due to automatic review settings October 19, 2025 04:43
Copy link

Copilot AI left a 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.

Copilot AI review requested due to automatic review settings October 19, 2025 04:50
Copy link

Copilot AI left a 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.

Copilot AI review requested due to automatic review settings October 19, 2025 05:01
Copy link

Copilot AI left a 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.

Repository owner deleted a comment from Copilot AI Oct 19, 2025
Repository owner deleted a comment from Copilot AI Oct 19, 2025
Repository owner deleted a comment from Copilot AI Oct 19, 2025
Repository owner deleted a comment from Copilot AI Oct 19, 2025
Repository owner deleted a comment from Copilot AI Oct 19, 2025
Repository owner deleted a comment from Copilot AI Oct 19, 2025
@MelbourneDeveloper MelbourneDeveloper merged commit a153367 into main Oct 19, 2025
1 check passed
@MelbourneDeveloper MelbourneDeveloper deleted the Fixcodegen branch October 19, 2025 05:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants