apimcp

package module
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2026 License: MIT Imports: 9 Imported by: 0

README

apimcp

CI Go Reference

English | 简体中文

Convert an OpenAPI document into an MCP server. MCP clients can discover API operations as tools and call the existing HTTP service without a second hand-written MCP implementation.

v0.13.0 is a pre-1.0 hardening release. It is suitable for local and controlled deployments, but a public Streamable HTTP endpoint must be placed behind an authenticating reverse proxy.

go run ./cmd/apimcp `
  --spec openapi.yaml `
  --base-url https://jsonplaceholder.typicode.com

The command above uses JSONPlaceholder as a runnable demo upstream. Replace the base URL with your own API address in a real deployment.

See the full English documentation for supported OpenAPI features, authentication, security controls, result contracts, and library usage.

See CONTRIBUTING.md for the contribution workflow.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHTTPHandler added in v0.8.0

func NewHTTPHandler(document *Document, options Options) (http.Handler, error)

NewHTTPHandler creates a bounded, origin-protected MCP Streamable HTTP handler for document. Callers that expose it to an untrusted network must wrap the returned handler with authentication.

func NewServer

func NewServer(document *Document, options Options) (*mcp.Server, error)

func RunHTTP added in v0.8.0

func RunHTTP(ctx context.Context, document *Document, options Options, addr string) error

RunHTTP starts an MCP Streamable HTTP server on addr. The MCP endpoint is available at /mcp.

func RunStdio

func RunStdio(ctx context.Context, document *Document, options Options) error

Types

type Document

type Document = openapi.Document

func LoadFile

func LoadFile(path string) (*Document, error)

func LoadFileWithOptions added in v0.11.0

func LoadFileWithOptions(path string, options LoadOptions) (*Document, error)

LoadFileWithOptions loads an OpenAPI document with an explicit reference policy.

type LoadOptions added in v0.11.0

type LoadOptions = openapi.LoadOptions

type Options

type Options = adapter.Options

Directories

Path Synopsis
cmd
apimcp command
internal

Jump to

Keyboard shortcuts

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