convert

package
v0.0.0-...-014d440 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2026 License: MIT Imports: 16 Imported by: 2

Documentation

Index

Constants

View Source
const (
	PropertyTypeString  propertyType = "string"
	PropertyTypeInteger propertyType = "integer"
	PropertyTypeNumber  propertyType = "number"
	PropertyTypeBoolean propertyType = "boolean"
	PropertyTypeObject  propertyType = "object"
	PropertyTypeArray   propertyType = "array"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Args

type Args struct {
	ServerAddr      string
	AuthToken       string
	AuthUsername    string
	AuthPassword    string
	AuthOAuth2Token string
	Headers         map[string]any
	Body            any
	BodyContentType string
	Query           map[string]any
	Path            map[string]any
	Forms           map[string]any
}

type Converter

type Converter struct {
	// contains filtered or unexported fields
}

Converter represents an OpenAPI to MCP converter

func NewConverter

func NewConverter(parser *Parser, options Options) *Converter

NewConverter creates a new OpenAPI to MCP converter

func (*Converter) Convert

func (c *Converter) Convert() (*server.MCPServer, error)

Convert converts an OpenAPI document to an MCP configuration

type Options

type Options struct {
	OpenAPIFrom    string
	ServerName     string
	Version        string
	ToolNamePrefix string
	ServerAddr     string
	Authorization  string
}

type Parser

type Parser struct {
	// contains filtered or unexported fields
}

Parser represents an OpenAPI parser

func NewParser

func NewParser() *Parser

NewParser creates a new OpenAPI parser

func (*Parser) GetDocument

func (p *Parser) GetDocument() *openapi3.T

GetDocument returns the parsed OpenAPI document

func (*Parser) GetInfo

func (p *Parser) GetInfo() *openapi3.Info

GetInfo returns the info section of the OpenAPI document

func (*Parser) GetOperationID

func (p *Parser) GetOperationID(path, method string, operation *openapi3.Operation) string

GetOperationID generates an operation ID if one is not provided

func (*Parser) GetPaths

func (p *Parser) GetPaths() *openapi3.Paths

GetPaths returns all paths in the OpenAPI document

func (*Parser) GetServers

func (p *Parser) GetServers() []*openapi3.Server

GetServers returns all servers in the OpenAPI document

func (*Parser) Parse

func (p *Parser) Parse(data []byte) error

Parse parses an OpenAPI document from bytes

func (*Parser) ParseFile

func (p *Parser) ParseFile(filePath string) error

ParseFile parses an OpenAPI document from a file

func (*Parser) ParseFileV2

func (p *Parser) ParseFileV2(filePath string) error

func (*Parser) ParseV2

func (p *Parser) ParseV2(data []byte) error

Jump to

Keyboard shortcuts

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