@spec2tools/stdio-mcp
Exposes any OpenAPI spec endpoints as AI agent tools via stdio, requiring no code generation or maintenance.
README
Spec2Tools
Dynamically convert OpenAPI specs into AI agent tools at runtime—no code generation required.
Packages
This monorepo contains four packages:
| Package | Description | Install |
|---|---|---|
| @spec2tools/core | Core utilities for OpenAPI parsing and authentication | npm install @spec2tools/core |
| @spec2tools/sdk | Create AI SDK tools from OpenAPI specifications | npm install @spec2tools/sdk |
| @spec2tools/cli | CLI for interacting with OpenAPI-based AI tools | npx @spec2tools/cli |
| @spec2tools/stdio-mcp | MCP server exposing OpenAPI endpoints as tools via stdio | npx @spec2tools/stdio-mcp |
Quick Start
Using the SDK
import { createTools } from '@spec2tools/sdk';
import { generateText, stepCountIs } from 'ai';
import { openai } from '@ai-sdk/openai';
const tools = await createTools({ spec: './openapi.yaml' });
const result = await generateText({
model: openai('gpt-4o'),
tools,
prompt: 'List all users',
stopWhen: stepCountIs(3)
});
console.log(result.text);
Using the CLI
# Set your OpenAI API key
export OPENAI_API_KEY=your-api-key
# Start the agent with an OpenAPI spec
npx @spec2tools/cli start --spec https://api.example.com/openapi.json
Using as MCP Server
# Add to Claude Code (or any MCP client)
claude mcp add --transport stdio my-api \
-- npx @spec2tools/stdio-mcp ./path/to/openapi.yaml
Code Mode
Collapse all API endpoints into just 2 tools (search + execute), cutting input token usage by ~99.9%:
# MCP server with code mode
claude mcp add --transport stdio my-api \
-- npx @spec2tools/stdio-mcp ./openapi.yaml --code-mode
// SDK with code mode
const tools = await createTools({
spec: './openapi.yaml',
codeMode: true,
});
You can also convert any existing AI SDK tools to code mode:
import { toCodeModeTools } from '@spec2tools/core';
const codeModeTools = toCodeModeTools(existingTools);
Thesis
You have a server. You have an OpenAPI spec. Now, with all the MCP hype, you're told you need to build another server—an MCP server—just so AI agents can call your API. You look it up: define tools, maintain handlers, keep it in sync with your actual API. But wait... you already described your API in OpenAPI. Why do we need to describe it to the agent twice?
Spec2Tools is the alternative. It reads your OpenAPI spec and exposes endpoints as tools—no code generation, no maintenance burden. Use it directly with the AI SDK, or spin up an MCP server instantly from your existing spec.
Development
# Clone the repo
git clone https://github.com/CahidArda/spec2tools.git
cd spec2tools
# Install dependencies
pnpm install
# Build all packages
pnpm build
License
MIT
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.