Skip to main content
Docs: ApiGear Core

MCP Server

The apigear mcp command starts a Model Context Protocol (MCP) server that exposes ApiGear CLI functionality as tools for AI assistants. This allows tools like Claude Code, Cursor, and other MCP-compatible clients to generate SDKs, manage templates, and validate specifications through natural language.

Setup

Claude Code

Register the MCP server with Claude Code:

claude mcp add apigear -- apigear mcp

Other MCP Clients

Add the following to your MCP client configuration:

{
"mcpServers": {
"apigear": {
"command": "apigear",
"args": ["mcp"]
}
}
}

Available Tools

The MCP server exposes 7 tools organized by category. Each tool declares an annotation so MCP clients know whether to prompt for confirmation:

AnnotationMeaning
read-onlyOnly reads data, makes no changes — safe to run without confirmation
destructiveWrites files to disk, may overwrite existing content
idempotentCan be called repeatedly with the same result

Specification

ToolAnnotationDescription
specificationCheckread-onlyLoad and validate API specification files (module, solution, rules)
specificationSchemaread-onlyShow the schema for module, solution, or rules documents in YAML or JSON format

specificationCheck Parameters

ParameterRequiredDescription
fileYesPath to specification file

specificationSchema Parameters

ParameterRequiredDescription
typeYesDocument type (module, solution, rules)
formatYesOutput format (yaml, json)

Example prompts:

"Check if my demo.module.yaml is valid."

"Show me the module schema in YAML format."

Generation

ToolAnnotationDescription
generateSolutiondestructiveGenerate SDK based on a solution document
generateExpertdestructiveGenerate code using expert mode with individual options

generateSolution Parameters

ParameterRequiredDescription
solutionYesPath to solution file
forceNoForce overwrite (true/false)
watchNoWatch for changes (true/false)

generateExpert Parameters

ParameterRequiredDescription
inputYesInput module files (comma-separated)
outputYesOutput directory
templateYesTemplate directory
featuresNoFeatures to enable (comma-separated, defaults to all)
forceNoForce overwrite (true/false)
watchNoWatch for changes (true/false)

Example prompts:

"Generate code from apigear/demo.solution.yaml."

"Generate a C++14 SDK from demo.module.yaml using apigear-io/template-cpp14, output to generated/cpp, enable the api and stubs features."

Template

ToolAnnotationDescription
templateListread-onlyList available templates from the registry
templateUpdateidempotentUpdate the template registry from remote sources

Both template tools take no parameters.

Example prompts:

"Show me all available ApiGear templates."

"Update the template registry."

Utility

ToolAnnotationDescription
versionread-onlyDisplay CLI version information

The version tool takes no parameters.

Example prompt:

"What version of ApiGear CLI is installed?"