# Spec2tools

> Dynamically convert OpenAPI specs into AI agent tools

- **Type:** MCP server
- **Install:** `agentstack add mcp-cahidarda-spec2tools`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [CahidArda](https://agentstack.voostack.com/s/cahidarda)
- **Installs:** 0
- **Category:** [Integrations](https://agentstack.voostack.com/c/integrations)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [CahidArda](https://github.com/CahidArda)
- **Source:** https://github.com/CahidArda/spec2tools

## Install

```sh
agentstack add mcp-cahidarda-spec2tools
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# 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](./packages/core) | Core utilities for OpenAPI parsing and authentication | `npm install @spec2tools/core` |
| [@spec2tools/sdk](./packages/sdk) | Create AI SDK tools from OpenAPI specifications | `npm install @spec2tools/sdk` |
| [@spec2tools/cli](./packages/cli) | CLI for interacting with OpenAPI-based AI tools | `npx @spec2tools/cli` |
| [@spec2tools/stdio-mcp](./packages/stdio-mcp) | MCP server exposing OpenAPI endpoints as tools via stdio | `npx @spec2tools/stdio-mcp` |

## Quick Start

### Using the SDK

```ts
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

```bash
# 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

```bash
# 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%:

```bash
# MCP server with code mode
claude mcp add --transport stdio my-api \
  -- npx @spec2tools/stdio-mcp ./openapi.yaml --code-mode
```

```ts
// 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:

```ts
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

```bash
# Clone the repo
git clone https://github.com/CahidArda/spec2tools.git
cd spec2tools

# Install dependencies
pnpm install

# Build all packages
pnpm build
```

## License

MIT

## Source & license

This open-source MCP server is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [CahidArda](https://github.com/CahidArda)
- **Source:** [CahidArda/spec2tools](https://github.com/CahidArda/spec2tools)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/mcp-cahidarda-spec2tools
- Seller: https://agentstack.voostack.com/s/cahidarda
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
