MCP Fusion/Integrations and federation/OpenAPI and Prisma generators

OpenAPI and Prisma generators

Ask AI about Vinkius

Turn existing schemas into secure MCP connectors: OpenAPI or Swagger endpoints become tools and Presenters, while Prisma annotations generate field-level security and tenant-aware code.

Most teams already have a source of truth. The OpenAPI generator and Prisma generator let you bring that source into MCP Fusion without hand-copying every endpoint. Both generate MVA-shaped code, so the output starts inside the same security and governance model as handwritten tools.

OpenAPI and Swagger

Install the generator package and run the binary:

bash
npm install @mcpfusion/openapi-gen
openapi-gen generate \
  --input ./openapi.yaml \
  --output ./src/mcp \
  --base-url https://api.example.com \
  --server-name billing

The CLI accepts -i/--input, -o/--output, -c/--config, --base-url, --context and --server-name. Tag filters are configured in the generator config with includeTags and excludeTags.

Programmatically, the pipeline is explicit:

typescript
import {
  parseOpenAPI,
  mapEndpoints,
  mergeConfig,
  emitFiles,
} from '@mcpfusion/openapi-gen';

const spec = parseOpenAPI(await readFile('./openapi.yaml', 'utf8'));
const mapped = mapEndpoints(spec);
const files = emitFiles(mapped, mergeConfig({
  features: { tags: true, presenters: true, toonDescription: true },
}));

The generator resolves $refs, converts Swagger 2.0 to OpenAPI 3, compiles input and response schemas to Zod, infers annotations, and emits files for Models, Presenters, tools, a registry and a server entry. The generated server is a starting point: add auth middleware, tenant resolution, credential declarations and domain-specific rules before production.

The config surface includes features (tags, annotations, presenters, descriptions, deprecated handling, TOON descriptions, server file), naming (snake_case or camelCase and deduplication), context.import, server settings and tag filters. The runtime exports loadOpenAPI and buildHandler when you need a generated operation inside an existing server.

Generated schemas describe the API, not your authorization policy. Review every generated Presenter allowlist, add tenant constraints and attach authentication before deploying the connector.

Prisma

Prisma generation is a real Prisma generator, not a separate command you run against an arbitrary database. Register it in schema.prisma:

prisma
generator mcp {
  provider = "@mcpfusion/prisma-gen"
  output   = "../src/tools/database"
}

Annotate the model fields that need a perception or tenancy rule:

prisma
model User {
  id        String @id @default(cuid())
  email     String /// @mcpfusion.hide
  tenantId  String /// @mcpfusion.tenantKey
  name      String /// @mcpfusion.describe("Display name for the agent")
}

Run npx prisma generate. The generator parses the Prisma DMMF with parseAnnotations, then emits a Presenter and tool files with emitPresenter and emitTool. The package includes naming helpers such as toSnakeCase, toPascalCase and pluralize.

Source annotations are the contract: @mcpfusion.hide removes a field from the agent surface, @mcpfusion.describe(...) becomes schema guidance and @mcpfusion.tenantKey marks the field the generated code must scope. Check the parser version you install before copying older README examples that use the stale @fusion.* spelling.

What both generators do not know

Neither generator can infer which records a role may see, which upstream errors are retryable or which actions are destructive in your business. Treat generated code as a secure scaffold, then add the policy layer:

  1. inspect the generated Presenter schemas
  2. attach requireJwt or requireApiKey
  3. resolve tenant context before the handler
  4. add .redactPII(), limits and invalidation hints
  5. generate and check mcpfusion.lock

Next steps