apimcp

package module
v0.1.0 Latest Latest
Warning

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

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

README

apimcp

CI Go Reference

Convert an OpenAPI document into an MCP server.

What it does

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

Status

This is an MVP. It supports OpenAPI JSON/YAML, common HTTP methods, path and query parameters, JSON request bodies, Bearer tokens, stdio transport, and allow/deny tool filters.

Run

go run ./cmd/apimcp --spec openapi.yaml --base-url https://api.example.com

The project uses the official Go MCP SDK and adapts OpenAPI operations into MCP tools. It does not expose every operation automatically when --allow is set:

go run ./cmd/apimcp --spec openapi.yaml --allow getUser,listUsers --stdio

The --stdio flag is accepted for compatibility with MCP client configurations; stdio is the default transport.

Library usage

spec, err := apimcp.LoadFile("openapi.yaml")
if err != nil {
    return err
}

return apimcp.RunStdio(ctx, spec, apimcp.Options{
    BaseURL:     "https://api.example.com",
    BearerToken: token,
})

Development

go test ./...
go test -race ./...
go vet ./...

Roadmap

  • OpenAPI references and reusable schemas
  • API key and OAuth authentication
  • HTTP transport
  • file upload/download handling
  • generated tool documentation

Contributing

See CONTRIBUTING.md for the development workflow and commit conventions.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewServer

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

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)

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