om

package module
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 17, 2026 License: MIT Imports: 15 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

om

Generate a TypeScript MCP server from an OpenAPI document.

Generate and run

Install with Go 1.27 or newer. Run generated projects with Node.js 22.18 or newer.

go install github.com/holon-sh/om/cmd/om@v0.0.1
om generate https://example.com/openapi.yaml my-api
cd my-api
npm ci
npm start

Connect an MCP client to http://127.0.0.1:3000/mcp using Streamable HTTP. Set the credential environment variables printed by om generate before starting the server. Server variables use the defaults from the document and can be overridden with their corresponding OM_ environment variables. Use PORT to select a different port and HOST to select an interface. The default interface is loopback. When hosting the exported handler remotely, configure authentication at the host.

You can also pass a local JSON or YAML document with an absolute HTTPS server URL. The output directory must be new.

Supported documents

om supports OpenAPI 3.0, 3.1, and 3.2. It uses the first document-level HTTPS server and creates one tool per supported operation. Tool schemas group parameters under path, query, header, and cookie, with a separate body for JSON requests. It handles default parameter serialization, flat deepObject query parameters, API keys, bearer tokens, and HTTP Basic. It uses local references to components.schemas.

The generator prints a reason for each skipped operation and fails when no supported operations remain. OAuth, external references, per-operation servers, and non-JSON request bodies are outside this subset.

Embed

Call om.Generate with the document bytes, their location if relative server URLs need resolving, and the project name. The result includes the generated files, required inputs, upstream endpoint, and skipped operations.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Endpoint

type Endpoint struct {
	Host string
	Port int
}

type Input

type Input struct {
	Name        string
	Description string
	Default     *string
	Choices     []string
	Secret      bool
}

type Omission

type Omission struct {
	Method string `json:"method"`
	Path   string `json:"path"`
	Reason string `json:"reason"`
}

func (Omission) String

func (o Omission) String() string

type Options

type Options struct {
	AppName string
}

type Project

type Project struct {
	Files       map[string][]byte
	Name        string
	Title       string
	Version     string
	Description string
	Inputs      []Input
	Endpoint    Endpoint
	Omitted     []Omission
}

func Generate

func Generate(ctx context.Context, data []byte, location *url.URL, options Options) (Project, error)

Generate turns one OpenAPI document into a self-contained TypeScript project. The caller supplies the bytes and, for relative server URLs, their HTTPS location.

Directories

Path Synopsis
cmd
om command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL