mcpopenapi

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

README

MCP OpenAPI Server

This package implements an MCP (Model Context Protocol) server for OpenAPI specification validation using the libopenapi library.

Features

  • Validates OpenAPI specifications
  • Returns detailed validation errors
  • Lists schema information for valid specifications

Usage

As a Command Line Tool
# Build
cd ${HOME}/code/github/freeflowuniverse/herolauncher/pkg/mcp/openapi/cmd/openapi
go build -o mcpopenapi
cp mcpopenapi ${HOME}/hero/bin/
As a Library
package main

import (
	"fmt"

	"github.com/freeflowuniverse/herolauncher/pkg/mcp/openapi"
)

func main() {
	// Specify the path to an OpenAPI spec file
	filePath := "path/to/openapi.json"

	// Validate the OpenAPI spec
	result, err := openapi.ValidateOpenAPISpec(filePath)
	if err != nil {
		panic(err)
	}

	fmt.Println(result)
}

Example

See the examples directory for a complete example of how to use this package.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMCPServer

func NewMCPServer(stdin io.Reader, stdout io.Writer) (*mcp.Server, error)

NewMCPServer creates a new MCP server for OpenAPI validation

func ValidateOpenAPISpec

func ValidateOpenAPISpec(filePath string) (string, error)

ValidateOpenAPISpec validates an OpenAPI specification from a file path and returns any errors found

Types

type HelloArguments

type HelloArguments struct {
	Submitter string `json:"submitter" jsonschema:"required,description=The name of the person to greet"`
}

HelloArguments represents the arguments for the hello tool

type OpenAPIValidationArgs

type OpenAPIValidationArgs struct {
	FilePath string `json:"filePath" jsonschema:"required,description=The path to the OpenAPI specification file to validate"`
}

OpenAPIValidationArgs represents the arguments for the OpenAPI validation tool

Jump to

Keyboard shortcuts

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