swaggbot
Transforms Swagger/OpenAPI documented APIs into conversational interfaces, enabling natural language interaction with APIs through an MCP server for use with AI assistants.
README
Swaggbot
Transform Swagger/OpenAPI docs into conversational interfaces. Self-hosted, local-first, AI-powered API exploration.
Quick Start
# Docker (recommended)
git clone https://github.com/techbloom-ai/swaggbot.git
cd swaggbot && cp .env.example .env
# Generate SESSION_SECRET and add LLM API keys
docker-compose up -d
What is Swaggbot?
Swaggbot converts any Swagger/OpenAPI documented API into a conversational interface. Built for developers who want to:
- Explore APIs naturally — Chat instead of reading raw JSON
- Automate workflows — Multi-step operations with data extraction
- Stay in control — Self-hosted, data stays local
- Integrate anywhere — Web UI, MCP server, or direct API
Features
- 🤖 Natural Language API Interaction — "List all users" →
GET /users - 🔄 Workflow Automation — Chain multiple API calls with dependency resolution
- 🔌 MCP Server — Use with Claude Desktop, Cursor, Windsurf
- 🏠 Self-Hosted — Your data, your infrastructure
- 🔐 Session Management — Encrypted auth tokens, per-session isolation
- 🌐 Multi-Provider LLM — Moonshot, OpenAI, Anthropic, Ollama
- 📊 Array Filtering —
[name=John].idsyntax for data extraction - 🛡️ Security — CSP headers, rate limiting, encrypted storage
Architecture
┌─────────┐ ┌─────────┐ ┌─────────┐
│ Web UI │ │ MCP │ │ API │
│ Next.js │ │ Server │ │ Clients │
└────┬────┘ └────┬────┘ └────┬────┘
└─────────────┼─────────────┘
▼
┌─────────────────┐
│ Chat Service │ Intent Classification
│ + LLM Provider │ → Curl Generation → Execution
└─────────────────┘
│
┌─────────────┼─────────────┐
▼ ▼ ▼
┌────────┐ ┌─────────┐ ┌──────────┐
│SQLite │ │Workflow │ │ Target │
│(Local) │ │ Engine │ │ API │
└────────┘ └─────────┘ └──────────┘
Installation
Prerequisites
- Node.js 18+ or Docker
- LLM API key (Moonshot, OpenAI, Anthropic, or Ollama)
Docker (Recommended)
# 1. Clone and configure
git clone https://github.com/techbloom-ai/swaggbot.git
cd swaggbot
cp .env.example .env
# 2. Set SESSION_SECRET (required for auth)
# Linux/macOS:
export SESSION_SECRET=$(openssl rand -base64 32)
# Or add to .env: SESSION_SECRET=your_random_secret_here
# 3. Add your LLM API key to .env
# MOONSHOT_API_KEY=your_key_here
# 4. Start
docker-compose up -d
Database migrations run automatically on first startup.
Local Development
git clone https://github.com/techbloom-ai/swaggbot.git
cd swaggbot
pnpm install
cp .env.example .env.local
# Edit .env.local with SESSION_SECRET and LLM API keys
pnpm db:migrate
pnpm dev
Configuration
| Variable | Required | Default | Description |
|---|---|---|---|
SESSION_SECRET |
Yes | — | Random secret for session encryption (min 32 chars) |
MOONSHOT_API_KEY |
Yes* | — | Moonshot AI API key |
OPENAI_API_KEY |
Yes* | — | OpenAI API key |
ANTHROPIC_API_KEY |
Yes* | — | Anthropic API key |
OLLAMA_BASE_URL |
Yes* | — | Ollama server URL |
LLM_PROVIDER |
No | moonshot |
moonshot | openai | anthropic | ollama |
DATABASE_URL |
No | file:./data/swaggbot.db |
SQLite database path |
NEXT_PUBLIC_APP_URL |
No | http://localhost:3003 |
App base URL |
*At least one LLM provider required
Generate SESSION_SECRET
# Linux/macOS
openssl rand -base64 32
# Or any random string (min 32 characters)
API Reference
REST API
All endpoints require authentication via session cookie.
| Endpoint | Method | Description |
|---|---|---|
/api/auth/login |
POST | Authenticate and create session |
/api/session |
POST | Create API session from Swagger URL |
/api/session |
GET | List all sessions (paginated) |
/api/chat |
POST | Send message to API |
/api/workflow |
POST | Create multi-step workflow |
/api/workflow/:id/execute |
POST | Execute workflow |
MCP Server
{
"mcpServers": {
"swaggbot": {
"command": "docker",
"args": ["compose", "run", "--rm", "swaggbot-mcp"],
"env": {
"SESSION_SECRET": "your_secret",
"MOONSHOT_API_KEY": "your_key"
}
}
}
}
Usage Examples
Web UI
- Navigate to login page
- Create a session with your Swagger URL
- Start chatting:
"Create a user named John" "List all pets with status available" "Execute the login workflow"
API
# Authenticate
curl -X POST http://localhost:3003/api/auth/login \
-H "Content-Type: application/json" \
-d '{"password": "your_password"}' \
-c cookies.txt
# Chat with API
curl -X POST http://localhost:3003/api/chat \
-H "Content-Type: application/json" \
-b cookies.txt \
-d '{"sessionId": "...", "message": "List all users"}'
Technology Stack
| Component | Technology |
|---|---|
| Framework | Next.js 16 (App Router) |
| Language | TypeScript 5 |
| Database | SQLite (libSQL/Turso) |
| ORM | Drizzle ORM |
| UI | shadcn/ui + TailwindCSS 4 |
| State | Zustand |
| LLM SDK | Vercel AI SDK patterns |
| MCP | Model Context Protocol SDK |
| Testing | Vitest |
| Container | Docker + Docker Compose |
Project Structure
swaggbot/
├── app/ # Next.js App Router
│ ├── api/ # API routes
│ ├── sessions/ # Session UI
│ └── settings/ # Settings page
├── components/ # shadcn/ui components
├── lib/
│ ├── db/ # Database schema & migrations
│ ├── llm/ # LLM provider implementations
│ ├── services/ # Business logic
│ ├── auth/ # Session & encryption
│ └── prompts/ # LLM prompt management
├── scripts/ # MCP server & entrypoint
└── data/ # SQLite storage (Docker volume)
Security
- Local-first: All data stored locally in SQLite
- Encrypted tokens: Auth tokens encrypted with AES-256-GCM
- Session-based auth: Password-protected access
- CSP headers: Content Security Policy protection
- Rate limiting: Per-endpoint limits configurable
- No telemetry: Zero analytics or tracking
License
MIT © TechBloom
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。