openapi2mcp
Verified Safeby cosmonic-labs
Overview
Generates Model Context Protocol (MCP) server tools (TypeScript code) from an OpenAPI specification.
Installation
wash openapi2mcp [path/to/open/yaml/or/json] --project-path [path/to/generated/mcp/server]Environment Variables
- INPUT_FILE
- PROJECT_PATH
- HOME
Security Notes
The tool processes OpenAPI specifications and generates TypeScript code. It uses `wash`'s `host_exec` to interact with the filesystem (copying files to/from a sandbox) and execute other commands like `wash build` or `npx`. While the generation process itself is sandboxed in WASI, the plugin performs file operations (copying a user's project into a sandbox and copying the generated code back) and executes build commands on the host machine. If `project_path` or `openapi_path` are manipulated to point to sensitive system directories or contain malicious code (e.g., in an OpenAPI definition causing malicious scripts in the generated `package.json`), this could lead to unintended consequences when `wash build` or other tools are run on the generated project. However, direct shell injection through path arguments for `host_exec` is mitigated by passing arguments as a list of strings. The core Rust generator code does not use `eval` or obvious obfuscation, nor does it contain hardcoded secrets. The primary risk lies with how the generated TypeScript code is handled downstream by the user, and the implicit trust in the `project_path` where generated files are placed.
Similar Servers
mcp-openapi-server
Exposes OpenAPI endpoints as Model Context Protocol (MCP) tools, enabling Large Language Models (LLMs) to discover and interact with REST APIs through a standardized protocol.
template-mcp-server
Provides a CLI tool and template to quickly get started building a Model Context Protocol (MCP) server using FastMCP, supporting both stdio and HTTP transports.
mcp-typescript-template
A TypeScript template for building remote Model Context Protocol (MCP) servers with robust tooling, best practices, and an example 'echo' tool for AI model interaction.
MyMCP
Dynamically convert any OpenAPI v3 specification into a fully-functional Model Context Protocol (MCP) server, exposing external APIs as MCP tools.