▲reactivite
/packages/docs/courses/cli/skillpool/promaster/contact
all docs

$ npm view @ubuligan/codegen

Utility

@ubuligan/codegen

Generate a type-safe TypeScript SDK straight from a live MCP server's tool, resource, and prompt schemas.

npm versiondownloads
npm github
$ npm install @ubuligan/codegen

Introspect a live MCP server and generate a type-safe TypeScript SDK from its tool, resource and prompt schemas. One typed class, one method per tool, with argument and result types derived from the server's JSON Schemas.

Part of the MCP Toolkit. Ships the mcp-codegen CLI.

CLI#

No install needed:

# From an HTTP server:
npx @ubuligan/codegen http://localhost:3000/mcp -o src/mcp-sdk.ts

# From a local stdio server (the command to spawn it):
npx @ubuligan/codegen "node dist/index.js" -o src/mcp-sdk.ts
FlagDefaultPurpose
<target>—Server URL (http://…) or a stdio command line.
-o, --out <file>mcp-sdk.tsOutput file.
-c, --class-name <name>GeneratedMCPClientName of the generated class.
--stdoutoffPrint to stdout instead of writing a file.

The generated SDK imports from @ubuligan/client, so install that in the consuming project:

npm install @ubuligan/client
import { GeneratedMCPClient } from "./mcp-sdk.js";

const sdk = new GeneratedMCPClient({ transport: { type: "http", url: "http://localhost:3000/mcp" } });
await sdk.connect();
const sum = await sdk.add({ a: 2, b: 3 }); // fully typed

Programmatic API#

npm install @ubuligan/codegen
import { generateSdk } from "@ubuligan/codegen";

const { code, introspection } = await generateSdk({
  target: "http://localhost:3000/mcp",
  className: "MyClient",
});
console.log(`${introspection.tools.length} tools`);
// write `code` wherever you like
  • generateSdk({ target, className?, ... }) → { code, introspection }
  • introspect(target) → raw Introspection (tools/resources/prompts).
  • parseTarget(string) → a Target (url vs stdio command).
  • emitSdk(introspection, opts) → SDK source string.

License#

MIT

  • home
  • packages
  • skillpool
  • docs
  • cli
▲reactivite

// The fastest way to scaffold production-ready React apps. Built by developers, for developers.

$ npm create reactivite@latest

resources/

  • └─ documentation
  • └─ packages
  • └─ cli
  • └─ courses
  • └─ markdown
  • └─ diff
  • └─ run
  • └─ radio
  • └─ tv
  • └─ games
  • └─ about
  • └─ contact

community/

  • └─ github

© 2026 reactivite — all rights reserved