OpenAPI → MCP server

kiid-mcp developer guide

Run the forge on your own machine, turn an OpenAPI document into a working MCP server, then start and test that server locally: over REST, over MCP and in the chat UI.

forge service :5199 forged server :5080 PostgreSQL :5432 kiid-chat :5173

How it works

The CLI you install never contains the generator. It reads your spec, sends it to the forge service and writes the project it gets back. The forged project is thin glue that references the compiled ProjectKiid.Mcp.* runtime packages.

kiid-mcp CLIWizard, flags or editor. Reads the OpenAPI file or URL.
Forge servicePlans tools, classifies intent and risk, renders templates. Stays server-side.
Forged projectProgram.cs, tool catalog, MCP tools, settings, tests, README.
Running MCP server/mcp, REST, SSE, audit, sessions, Scalar docs at /docs.

The hosted forge at generate.ostersono.com is not live yet, so during development you run the forge service yourself and point the CLI at it.

Prerequisites

  • .NET 10 SDK
  • Docker Desktop, running, for the forged server's PostgreSQL audit store (any PostgreSQL 14+ also works)
  • Node.js 20+ for the kiid-chat UI and the MCP Inspector (optional)
  • Access to the ProjectKiid package feed, so forged projects can restore ProjectKiid.Mcp.*

Start the forge service

Open a terminal in the repository root and leave this running:

PowerShell
dotnet build ProjectKiid.slnx -c Release
dotnet run -c Release --no-build --project src/Kiid.McpForge.Server --urls http://localhost:5199

Check it is up:

PowerShell
Invoke-RestMethod http://localhost:5199/health     # status: ok

Install the CLI

The CLI is a .NET global tool. Pack it with a fresh dev version and install it; the same command updates an existing install.

PowerShell
$v = "1.0.0-dev." + (Get-Date -Format yyyyMMddHHmm)
dotnet pack src/Kiid.McpForge/Kiid.McpForge.csproj -c Release -p:Version=$v -o .\.localfeed
dotnet tool update -g ProjectKiid.McpForge --version $v --add-source .\.localfeed
"kiid-mcp is not recognized"? The terminal was opened before the install. VS Code terminals inherit PATH from VS Code, so restart VS Code, or refresh the current terminal:
$env:Path = [Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [Environment]::GetEnvironmentVariable("Path","User")

Without installing, run the build output directly: .\src\Kiid.McpForge\bin\Release\net10.0\kiid-mcp.exe

Forge a server

Point the CLI at your local forge once per terminal, then pick how you want to work.

PowerShell
$env:KIID_MCP_ENDPOINT = "http://localhost:5199"
kiid-mcp

The wizard asks, in order: which model polishes descriptions (Claude, OpenAI, Ollama or none), the OpenAPI file or URL, then shows the planned tools for you to confirm, then the solution name, output folder, port, and whether to build and test.

The run ends with a Ready panel showing the folder, the tool count, and build and test results. Every forged project has its own README with a "Run it locally" guide written for that API.

Run the forged server locally

  1. Start PostgreSQL. Every call is audited first; with the database down the server refuses to call your API.
    cd C:\src\Orders.Mcp
    docker compose up -d postgres
  2. Give it the upstream credentials. The forged README names the exact scheme. For an API key header, the header name is already in appsettings.json; only the key is needed:
    dotnet user-secrets --project src/Orders.Mcp.Api set "Upstream:ApiKey" "<your-api-key>"
    # bearer: "Upstream:BearerToken"   basic: "Upstream:Username" + "Upstream:Password"
  3. Run it.
    dotnet run --project src/Orders.Mcp.Api        # http://localhost:5080
    Port taken? Add --urls http://localhost:<port>.
  4. Open http://localhost:5080/docs for the Scalar API reference and try any endpoint from the browser.

Test it

REST, from a terminal

PowerShell
irm http://localhost:5080/api/info                                    # server, upstream, tool counts
irm http://localhost:5080/api/tools | ft name, method, path, risk     # the tool catalog
irm http://localhost:5080/api/tools/<tool>/invoke                     # real call, read-only tools
irm "http://localhost:5080/api/ask?q=list all orders"                 # natural language
irm "http://localhost:5080/api/intent/classify?q=delete order 5"      # dry run, calls nothing
irm http://localhost:5080/api/audit?take=10                           # every call, every channel

Writes need POST, and destructive tools are refused until the body includes "confirm": true. The forged project also ships a .http file with ready-made requests for VS Code and Visual Studio.

MCP protocol

npx @modelcontextprotocol/inspector --cli http://localhost:5080/mcp --transport http --method tools/list
npx @modelcontextprotocol/inspector --cli http://localhost:5080/mcp --transport http --method tools/call --tool-name <tool>
npx @modelcontextprotocol/inspector                    # browser UI

A real AI client

claude mcp add --transport http orders-mcp http://localhost:5080/mcp

Ask Claude a question about your data. Deletes and other destructive actions ask for confirmation first. Cursor picks up the forged .cursor/mcp.json automatically.

Chat UI

kiid-chat is a prebuilt React app that ships inside the CLI. It talks to a forged server, keeps conversations on the server and lets you browse and run read-only tools.

kiid-mcp ui --out ./kiid-chat --server http://localhost:5080
cd kiid-chat
npm install
npm run dev                # http://localhost:5173
TabWhat to check
ChatAnswers stream in. Refresh the page and the conversation returns. Create, rename and delete sessions.
ToolsEvery generated tool is listed; read-only ones run in place.
DevServer URL, optional Authorization header, optional OpenAI-compatible model, theme.

Troubleshooting

SymptomCause and fix
kiid-mcp is not recognizedStale terminal PATH. Restart VS Code or run the PATH refresh under Install the CLI.
Could not reach the generator serviceThe forge isn't running, or KIID_MCP_ENDPOINT isn't set in this terminal.
405 on /mcp in a browserExpected. /mcp is for MCP clients, which use POST. Use /docs in the browser.
422 "The audit store is unavailable"PostgreSQL is down. Start Docker, run docker compose up -d postgres, restart the server.
401 / 403 from a toolUpstream credentials missing or wrong. Set them with dotnet user-secrets.
502 from a toolThe upstream API is down, unreachable, or its HTTPS certificate isn't trusted (dotnet dev-certs https --trust for local APIs).
Address already in useAnother app owns the port. Pass --urls http://localhost:<port>.
Restore can't find ProjectKiid.Mcp.*The package feed in the forged nuget.config isn't reachable or needs credentials.
kiid-chat network or CORS errorAdd the UI's origin to Cors:AllowedOrigins in the forged server's settings.

Updating the CLI

The installed tool is a snapshot. After changing CLI code, repeat Install the CLI; each pack needs a new version, because NuGet will not re-extract a version it has cached. Changes to templates or planning live in the forge service, so restarting the service is enough for those.

dotnet tool uninstall -g ProjectKiid.McpForge          # remove it