Summary
Add support for generating MCP (Model Context Protocol) servers from OpenAPI specifications, enabling any API with an OpenAPI definition to be automatically exposed as AI-consumable tools for Claude, ChatGPT, VS Code Copilot, and other AI assistants.
Background & Motivation
The Problem
AI assistants (Claude, ChatGPT, GitHub Copilot, etc.) increasingly need to interact with external APIs. The Model Context Protocol (MCP) has emerged as the standard for connecting AI assistants to external data sources and tools. However, creating MCP servers today requires:
- Manual implementation of tool definitions, schemas, and handlers
- Duplication of effort - API definitions already exist in OpenAPI specs but must be re-implemented for MCP
- Maintenance burden - keeping MCP servers in sync with API changes
The Opportunity
Kiota already excels at:
- ✅ Parsing and understanding OpenAPI specifications
- ✅ Generating type-safe code across multiple languages (C#, Java, TypeScript, Python, Go, PHP, Ruby, Dart)
- ✅ Handling authentication, serialization, and error handling
- ✅ Enterprise-grade stability and Microsoft ecosystem integration
Extending Kiota to generate MCP servers would provide a "universal API-to-AI bridge" - any API with an OpenAPI spec could instantly become AI-accessible.
Competitive Landscape & Prior Art
Existing Solutions (Community)
OpenAPI Generator Activity
There is an active feature request (OpenAPITools/openapi-generator#22001) for MCP server generation, with a Quarkus MCP generator PR already submitted (#22197).
Why Kiota is Better Positioned
Having evaluated OpenAPI Generator, we found it:
- Fragmented - Too many competing implementations, inconsistent across languages
- Not homogeneous - Different language generators have different capabilities
- Less mature for enterprise use
Kiota advantages:
- Consistent architecture - Single
LanguageWriter pattern ensures uniform behavior
- Enterprise-ready - Production-tested, backed by Microsoft
- Better TypeScript/C# support - Critical for MCP (most MCP servers are TypeScript)
- Existing OpenAPI parsing - Mature, well-tested OpenAPI handling
Proposed Solution
Architecture
Extend Kiota's LanguageWriter system with new MCP-specific writers:
src/Kiota.Builder/Writers/
├── CSharp/
├── TypeScript/
├── Python/
├── ...
└── MCP/ # NEW
├── TypeScript/ # MCP server in TypeScript
├── Python/ # MCP server in Python
└── CSharp/ # MCP server in C#
Generated Output Example
Input: OpenAPI spec for a Pet Store API
Output: A fully functional MCP server
// Generated by Kiota MCP Writer
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
const server = new Server({
name: "petstore-mcp",
version: "1.0.0",
}, {
capabilities: { tools: {} }
});
// Tool: listPets - Generated from GET /pets
server.setRequestHandler(ListToolsRequestSchema, async () => ({
tools: [{
name: "listPets",
description: "List all pets in the store",
inputSchema: {
type: "object",
properties: {
limit: { type: "integer", description: "Maximum number of pets to return" }
}
}
}, {
name: "createPet",
description: "Create a new pet",
inputSchema: {
type: "object",
properties: {
name: { type: "string", description: "Pet name" },
tag: { type: "string", description: "Pet tag" }
},
required: ["name"]
}
}]
}));
// Tool handlers - call the actual API
server.setRequestHandler(CallToolRequestSchema, async (request) => {
switch (request.params.name) {
case "listPets":
const response = await fetch(`${baseUrl}/pets?limit=${request.params.arguments.limit}`);
return { content: [{ type: "text", text: JSON.stringify(await response.json()) }] };
// ... other tools
}
});
CLI Usage
# Generate MCP server from OpenAPI spec
kiota generate --language mcp-typescript \
--openapi https://api.example.com/openapi.json \
--output ./mcp-server
# Options
--transport stdio|sse|http # MCP transport type
--auth bearer|apikey|oauth2 # Authentication method
Mapping OpenAPI → MCP
| OpenAPI Concept |
MCP Concept |
operationId |
Tool name |
summary / description |
Tool description |
| Request body schema |
Tool inputSchema |
| Response schema |
Tool response content |
| Security schemes |
Server authentication |
| Servers array |
Base URL configuration |
Implementation Phases
Phase 1: TypeScript MCP Server (MVP)
- Generate TypeScript MCP server with stdio transport
- Support basic CRUD operations
- Handle JSON request/response bodies
- Generate tool definitions from operations
Phase 2: Multi-Language Support
- Add Python MCP writer (using
mcp Python SDK)
- Add C# MCP writer (using .NET MCP SDK when available)
- Ensure consistent behavior across languages
Phase 3: Advanced Features
- SSE and HTTP transports
- OAuth2 and complex auth flows
- Streaming responses
- Resource endpoints (not just tools)
- Prompt templates from API descriptions
Success Criteria
Use Cases
- Enterprise API Exposure - Companies can instantly make internal APIs available to AI assistants
- Developer Tools - API documentation becomes interactive through AI
- Rapid Prototyping - Test API integrations with AI before building full clients
- Accessibility - Non-developers can interact with APIs through natural language
Related Work
Questions for Maintainers
- Would this fit as a new
GenerationLanguage enum value, or should it be a separate concept (e.g., GenerationTarget.MCP)?
- Should MCP generation reuse existing language writers for model generation, or be fully standalone?
- Is there interest in Microsoft contributing to or endorsing this feature given Azure API Management scenarios?
Labels: enhancement, feature-request, good-first-issue (for initial exploration)
I'm happy to contribute to the implementation if there's interest from the maintainers.
Summary
Add support for generating MCP (Model Context Protocol) servers from OpenAPI specifications, enabling any API with an OpenAPI definition to be automatically exposed as AI-consumable tools for Claude, ChatGPT, VS Code Copilot, and other AI assistants.
Background & Motivation
The Problem
AI assistants (Claude, ChatGPT, GitHub Copilot, etc.) increasingly need to interact with external APIs. The Model Context Protocol (MCP) has emerged as the standard for connecting AI assistants to external data sources and tools. However, creating MCP servers today requires:
The Opportunity
Kiota already excels at:
Extending Kiota to generate MCP servers would provide a "universal API-to-AI bridge" - any API with an OpenAPI spec could instantly become AI-accessible.
Competitive Landscape & Prior Art
Existing Solutions (Community)
OpenAPI Generator Activity
There is an active feature request (OpenAPITools/openapi-generator#22001) for MCP server generation, with a Quarkus MCP generator PR already submitted (#22197).
Why Kiota is Better Positioned
Having evaluated OpenAPI Generator, we found it:
Kiota advantages:
LanguageWriterpattern ensures uniform behaviorProposed Solution
Architecture
Extend Kiota's
LanguageWritersystem with new MCP-specific writers:Generated Output Example
Input: OpenAPI spec for a Pet Store API
Output: A fully functional MCP server
CLI Usage
Mapping OpenAPI → MCP
operationIdnamesummary/descriptiondescriptioninputSchemaImplementation Phases
Phase 1: TypeScript MCP Server (MVP)
Phase 2: Multi-Language Support
mcpPython SDK)Phase 3: Advanced Features
Success Criteria
kiota generate --language mcp-typescriptproduces working MCP serverUse Cases
Related Work
Questions for Maintainers
GenerationLanguageenum value, or should it be a separate concept (e.g.,GenerationTarget.MCP)?Labels:
enhancement,feature-request,good-first-issue(for initial exploration)I'm happy to contribute to the implementation if there's interest from the maintainers.