mcp-playbook 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +911 -0
- package/bin/mcp-playbook.js +23 -0
- package/bin/postinstall.js +14 -0
- package/dist/cli/index.d.mts +7 -0
- package/dist/cli/index.d.ts +7 -0
- package/dist/cli/index.js +513 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/index.mjs +498 -0
- package/dist/cli/index.mjs.map +1 -0
- package/dist/client/assets/index-BtOeKclx.js +40 -0
- package/dist/client/index.html +24 -0
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +35 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +8 -0
- package/dist/index.mjs.map +1 -0
- package/dist/server/build.d.mts +26 -0
- package/dist/server/build.d.ts +26 -0
- package/dist/server/build.js +168 -0
- package/dist/server/build.js.map +1 -0
- package/dist/server/build.mjs +132 -0
- package/dist/server/build.mjs.map +1 -0
- package/dist/server/connector.d.mts +119 -0
- package/dist/server/connector.d.ts +119 -0
- package/dist/server/connector.js +142 -0
- package/dist/server/connector.js.map +1 -0
- package/dist/server/connector.mjs +116 -0
- package/dist/server/connector.mjs.map +1 -0
- package/dist/server/dev-server.d.mts +16 -0
- package/dist/server/dev-server.d.ts +16 -0
- package/dist/server/dev-server.js +315 -0
- package/dist/server/dev-server.js.map +1 -0
- package/dist/server/dev-server.mjs +287 -0
- package/dist/server/dev-server.mjs.map +1 -0
- package/package.json +68 -0
package/README.md
ADDED
|
@@ -0,0 +1,911 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
<img src="https://raw.githubusercontent.com/your-org/mcp-playbook/main/assets/logo.png" alt="MCP Playbook" width="80" />
|
|
4
|
+
|
|
5
|
+
# MCP Playbook
|
|
6
|
+
|
|
7
|
+
**Playbook for MCP tools** — auto-generates interactive documentation and a live playground for your MCP servers.
|
|
8
|
+
|
|
9
|
+
[](https://www.npmjs.com/package/mcp-playbook)
|
|
10
|
+
[](LICENSE)
|
|
11
|
+
[](https://nodejs.org)
|
|
12
|
+
[](https://spec.modelcontextprotocol.io)
|
|
13
|
+
|
|
14
|
+
[Quick Start](#-quick-start) · [Configuration](#-configuration) · [CLI](#-cli-reference) · [Who is this for](#-who-is-this-for) · [Comparison](#-how-it-compares) · [Server structure](#-mcp-server-file-structure--what-you-need-to-know) · [Roadmap](#-roadmap)
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
<img src="https://raw.githubusercontent.com/your-org/mcp-playbook/main/assets/screenshot.png" alt="MCP Playbook UI" width="100%" />
|
|
19
|
+
|
|
20
|
+
</div>
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## ⚡ What is MCP Playbook?
|
|
25
|
+
|
|
26
|
+
If you have built MCP tools, you know the problem:
|
|
27
|
+
|
|
28
|
+
- Teammates **do not know what tools exist**
|
|
29
|
+
- There is **no documentation** of parameters or return types
|
|
30
|
+
- **Testing a tool** requires writing code or using raw JSON in the Inspector
|
|
31
|
+
- **New developers** spend hours figuring out what the server can do
|
|
32
|
+
- Tool documentation **goes stale** the moment anyone updates the server
|
|
33
|
+
|
|
34
|
+
**MCP Playbook** solves all of this — the same way Playbook solved it for React components.
|
|
35
|
+
|
|
36
|
+
It connects to your MCP server, **auto-discovers every tool** from its JSON Schema, and renders a beautiful interactive documentation site with a live playground. Zero manual documentation. Always up to date.
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
npx mcp-playbook init # create config — 30 seconds
|
|
40
|
+
npx mcp-playbook dev # open http://localhost:4242
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## 🎯 Problem statement
|
|
46
|
+
|
|
47
|
+
MCP (Model Context Protocol) is becoming the standard for exposing AI tools. Teams are building MCP servers with 10, 50, even 200+ tools. But there is no standard way to:
|
|
48
|
+
|
|
49
|
+
| Problem | Without MCP Playbook | With MCP Playbook |
|
|
50
|
+
|---|---|---|
|
|
51
|
+
| Discover available tools | Read source code or raw JSON | Browse a searchable UI |
|
|
52
|
+
| Understand a tool's parameters | Read the schema manually | Auto-generated docs with type badges |
|
|
53
|
+
| Test a tool | Write code or use raw Inspector | Click Run in the browser |
|
|
54
|
+
| Share docs with teammates | Write and maintain markdown manually | Deploy a static site from one command |
|
|
55
|
+
| Onboard a new developer | Days of reading code | Open a URL |
|
|
56
|
+
| Keep docs up to date | Manual — always goes stale | Automatic — re-reads server on every run |
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## 👥 Who is this for?
|
|
61
|
+
|
|
62
|
+
### ✅ Primary audience — MCP server developers
|
|
63
|
+
|
|
64
|
+
If you are **building an MCP server** in any language, this library documents and tests it automatically.
|
|
65
|
+
|
|
66
|
+
```
|
|
67
|
+
You build: Node.js MCP server with 50 tools
|
|
68
|
+
You run: npx mcp-playbook dev
|
|
69
|
+
You get: Complete interactive docs for all 50 tools instantly
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
**Best fit:**
|
|
73
|
+
- Backend developers building MCP servers in Node.js, Python, Go, Rust
|
|
74
|
+
- Fullstack teams using Next.js with MCP API routes
|
|
75
|
+
- Teams building AI agents that expose MCP tools
|
|
76
|
+
- Open source MCP server maintainers who need public documentation
|
|
77
|
+
|
|
78
|
+
### ✅ Secondary audience — MCP tool consumers
|
|
79
|
+
|
|
80
|
+
If you are **consuming MCP tools** built by another team, MCP Playbook is your reference guide — the same way Swagger UI documents REST APIs you consume.
|
|
81
|
+
|
|
82
|
+
```
|
|
83
|
+
Your team: building AI agents that call backend MCP tools
|
|
84
|
+
You need: know what tools exist, what parameters they take
|
|
85
|
+
You get: deployed URL your whole team bookmarks
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### ✅ Tertiary audience — non-developer stakeholders
|
|
89
|
+
|
|
90
|
+
Product managers, QA engineers, technical writers, and external API partners who need to understand what MCP tools are available — without running any code locally.
|
|
91
|
+
|
|
92
|
+
```
|
|
93
|
+
PM needs: understand what the AI agent can do
|
|
94
|
+
They open: https://mcp-docs.yourcompany.com
|
|
95
|
+
They see: every tool, every parameter, live testing UI
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
## ❌ Who is this NOT for?
|
|
101
|
+
|
|
102
|
+
| Situation | Why MCP Playbook does not fit |
|
|
103
|
+
|---|---|
|
|
104
|
+
| Pure React frontend with no MCP server | No MCP tools to document |
|
|
105
|
+
| REST-only API (no MCP) | Use Swagger / OpenAPI instead |
|
|
106
|
+
| Mobile app with no MCP server | No MCP tools involved |
|
|
107
|
+
| You need to debug MCP protocol messages | Use `@modelcontextprotocol/inspector` instead |
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
## 🌐 Language support
|
|
112
|
+
|
|
113
|
+
MCP Playbook connects over the **MCP protocol** — it does not care what language your server is written in. As long as your server speaks valid MCP, it works.
|
|
114
|
+
|
|
115
|
+
| Server language | Transport | Works? | Notes |
|
|
116
|
+
|---|---|---|---|
|
|
117
|
+
| **Node.js / TypeScript** | stdio, HTTP, SSE | ✅ | Best support, native |
|
|
118
|
+
| **Python** | stdio, HTTP, SSE | ✅ | FastMCP, official Python SDK |
|
|
119
|
+
| **Go** | HTTP, SSE | ✅ | Any Go MCP library |
|
|
120
|
+
| **Rust** | HTTP, SSE | ✅ | Any Rust MCP library |
|
|
121
|
+
| **Any language** | HTTP, SSE | ✅ | If it speaks MCP protocol |
|
|
122
|
+
|
|
123
|
+
> **Key insight:** MCP Playbook calls `tools/list` — a core MCP protocol method that every compliant server must implement. The server's internal language and framework are completely invisible to the library.
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
## 🔄 How it compares
|
|
128
|
+
|
|
129
|
+
### MCP Playbook vs MCP Inspector
|
|
130
|
+
|
|
131
|
+
The most common question. These are **complementary tools**, not competitors.
|
|
132
|
+
|
|
133
|
+
| Feature | `@modelcontextprotocol/inspector` | `mcp-playbook` |
|
|
134
|
+
|---|---|---|
|
|
135
|
+
| **Purpose** | Debug and validate protocol | Document and share with team |
|
|
136
|
+
| **Audience** | Server author (you) | Whole team + external devs |
|
|
137
|
+
| **Hosting** | Localhost only — not shareable | Deploy to any server or URL |
|
|
138
|
+
| **Persistent examples** | ❌ Fresh every session | ✅ Defined in config, committed to git |
|
|
139
|
+
| **Multi-server view** | ❌ One server at a time | ✅ All servers in one dashboard |
|
|
140
|
+
| **Static deployable docs** | ❌ Needs live Node process | ✅ `mcp-playbook build` → static site |
|
|
141
|
+
| **Raw JSON-RPC logs** | ✅ Full protocol inspection | ❌ Not the goal |
|
|
142
|
+
| **OAuth debugging** | ✅ Built-in | 🗓 Planned |
|
|
143
|
+
| **Team sharing via URL** | ❌ Per-launch token, localhost only | ✅ Deploy and share |
|
|
144
|
+
| **CLI / TUI mode** | ✅ | ❌ |
|
|
145
|
+
| **Config committed to git** | ❌ | ✅ |
|
|
146
|
+
|
|
147
|
+
**Use the Inspector when:** you are building a server and need to debug protocol messages, test OAuth flows, or inspect raw JSON-RPC communication.
|
|
148
|
+
|
|
149
|
+
**Use MCP Playbook when:** you want permanent team documentation, a shareable URL, onboarding for new developers, or a deployable static docs site.
|
|
150
|
+
|
|
151
|
+
### MCP Playbook vs Swagger UI
|
|
152
|
+
|
|
153
|
+
| Feature | Swagger UI | MCP Playbook |
|
|
154
|
+
|---|---|---|
|
|
155
|
+
| Protocol | REST / OpenAPI | MCP (Model Context Protocol) |
|
|
156
|
+
| Auto-discovery | Reads OpenAPI spec file | Connects to live MCP server |
|
|
157
|
+
| Live execution | ✅ | ✅ |
|
|
158
|
+
| Static build | ✅ | ✅ |
|
|
159
|
+
| Language agnostic | ✅ | ✅ |
|
|
160
|
+
| For AI tools | ❌ | ✅ |
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
## 🚀 Quick start
|
|
165
|
+
|
|
166
|
+
### Requirements
|
|
167
|
+
|
|
168
|
+
- **Node.js 18.0.0 or higher**
|
|
169
|
+
- An existing MCP server (stdio, HTTP, or SSE transport)
|
|
170
|
+
- npm, pnpm, or yarn
|
|
171
|
+
|
|
172
|
+
### Step 1 — Install
|
|
173
|
+
|
|
174
|
+
```bash
|
|
175
|
+
# npm
|
|
176
|
+
npm install --save-dev mcp-playbook
|
|
177
|
+
|
|
178
|
+
# pnpm
|
|
179
|
+
pnpm add -D mcp-playbook
|
|
180
|
+
|
|
181
|
+
# yarn
|
|
182
|
+
yarn add -D mcp-playbook
|
|
183
|
+
|
|
184
|
+
# or run without installing
|
|
185
|
+
npx mcp-playbook init
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
### Step 2 — Create config
|
|
189
|
+
|
|
190
|
+
```bash
|
|
191
|
+
npx mcp-playbook init
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
This creates `playbook.config.ts` in your current directory.
|
|
195
|
+
|
|
196
|
+
### Step 3 — Point it at your server
|
|
197
|
+
|
|
198
|
+
```typescript
|
|
199
|
+
// playbook.config.ts
|
|
200
|
+
import { defineConfig } from 'mcp-playbook'
|
|
201
|
+
|
|
202
|
+
export default defineConfig({
|
|
203
|
+
title: 'My API Playbook',
|
|
204
|
+
servers: [
|
|
205
|
+
{
|
|
206
|
+
name: 'My MCP Server',
|
|
207
|
+
transport: 'stdio',
|
|
208
|
+
command: 'node',
|
|
209
|
+
args: ['./server.js'],
|
|
210
|
+
}
|
|
211
|
+
]
|
|
212
|
+
})
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
### Step 4 — Start
|
|
216
|
+
|
|
217
|
+
```bash
|
|
218
|
+
npx mcp-playbook dev
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
Browser opens at **http://localhost:4242** showing all your tools with auto-generated documentation and a live playground.
|
|
222
|
+
|
|
223
|
+
---
|
|
224
|
+
|
|
225
|
+
## ⚙️ Configuration
|
|
226
|
+
|
|
227
|
+
All configuration lives in `playbook.config.ts` at your project root. Use `defineConfig()` for TypeScript autocomplete.
|
|
228
|
+
|
|
229
|
+
### Full reference
|
|
230
|
+
|
|
231
|
+
```typescript
|
|
232
|
+
import { defineConfig } from 'mcp-playbook'
|
|
233
|
+
|
|
234
|
+
export default defineConfig({
|
|
235
|
+
|
|
236
|
+
// ── Required ──────────────────────────────────────────────────────
|
|
237
|
+
|
|
238
|
+
servers: [
|
|
239
|
+
|
|
240
|
+
// stdio transport — spawn a local process
|
|
241
|
+
{
|
|
242
|
+
name: 'Local API', // display name in UI
|
|
243
|
+
transport: 'stdio',
|
|
244
|
+
command: 'node', // or 'python3', 'go run', etc.
|
|
245
|
+
args: ['./dist/server.js'], // path to your server entry file
|
|
246
|
+
env: { // environment variables (optional)
|
|
247
|
+
API_KEY: process.env.API_KEY!,
|
|
248
|
+
DB_URL: process.env.DB_URL!,
|
|
249
|
+
},
|
|
250
|
+
cwd: './packages/api', // working directory (optional)
|
|
251
|
+
},
|
|
252
|
+
|
|
253
|
+
// HTTP transport — connect to already-running server
|
|
254
|
+
{
|
|
255
|
+
name: 'Remote API',
|
|
256
|
+
transport: 'http',
|
|
257
|
+
url: 'http://localhost:3001/mcp',
|
|
258
|
+
headers: { // auth headers (optional)
|
|
259
|
+
'Authorization': `Bearer ${process.env.TOKEN}`,
|
|
260
|
+
'X-API-Key': process.env.API_KEY!,
|
|
261
|
+
}
|
|
262
|
+
},
|
|
263
|
+
|
|
264
|
+
// SSE transport — Server-Sent Events
|
|
265
|
+
{
|
|
266
|
+
name: 'Streaming Server',
|
|
267
|
+
transport: 'sse',
|
|
268
|
+
url: 'http://localhost:3002/sse'
|
|
269
|
+
},
|
|
270
|
+
|
|
271
|
+
],
|
|
272
|
+
|
|
273
|
+
// ── Optional ──────────────────────────────────────────────────────
|
|
274
|
+
|
|
275
|
+
title: 'Acme Corp API Playbook',
|
|
276
|
+
description: 'Interactive docs for all internal MCP tools',
|
|
277
|
+
port: 4242, // default: 4242
|
|
278
|
+
|
|
279
|
+
// Hand-written examples per tool — appear in Examples tab
|
|
280
|
+
// Load into Try tab with one click
|
|
281
|
+
// You do NOT need examples for every tool — only the important ones
|
|
282
|
+
examples: {
|
|
283
|
+
get_user: [
|
|
284
|
+
{
|
|
285
|
+
label: 'Fetch admin user',
|
|
286
|
+
description: 'Look up the main admin account',
|
|
287
|
+
input: { userId: 'usr_admin_001', include_meta: true },
|
|
288
|
+
expectedOutput: { id: 'usr_admin_001', name: 'Alice', role: 'admin' }
|
|
289
|
+
},
|
|
290
|
+
{
|
|
291
|
+
label: 'Fetch developer',
|
|
292
|
+
input: { userId: 'usr_dev_042' }
|
|
293
|
+
}
|
|
294
|
+
],
|
|
295
|
+
create_order: [
|
|
296
|
+
{
|
|
297
|
+
label: 'Standard order',
|
|
298
|
+
input: { userId: 'usr_123', productId: 'prod_456', quantity: 2 }
|
|
299
|
+
}
|
|
300
|
+
]
|
|
301
|
+
},
|
|
302
|
+
|
|
303
|
+
// Group tools into named sections in the sidebar
|
|
304
|
+
// A tool can appear in multiple sections
|
|
305
|
+
// Tools without a tag appear under their server name
|
|
306
|
+
tags: {
|
|
307
|
+
'User management': ['get_user', 'create_user', 'list_users', 'delete_user'],
|
|
308
|
+
'Orders': ['create_order', 'get_order', 'cancel_order'],
|
|
309
|
+
'Admin': ['purge_cache', 'get_metrics', 'list_audit_logs'],
|
|
310
|
+
},
|
|
311
|
+
|
|
312
|
+
// UI theme customisation
|
|
313
|
+
theme: {
|
|
314
|
+
primary: '#7C74D8', // accent colour for buttons, badges, selected items
|
|
315
|
+
background: '#080808', // main background colour
|
|
316
|
+
font: 'IBM Plex Mono', // must be available in the browser
|
|
317
|
+
},
|
|
318
|
+
|
|
319
|
+
})
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
---
|
|
323
|
+
|
|
324
|
+
## 🔐 Authentication
|
|
325
|
+
|
|
326
|
+
### For servers that require API keys or tokens
|
|
327
|
+
|
|
328
|
+
Pass credentials via the `env` field. Your MCP server reads them from environment variables.
|
|
329
|
+
|
|
330
|
+
```typescript
|
|
331
|
+
// playbook.config.ts
|
|
332
|
+
servers: [
|
|
333
|
+
{
|
|
334
|
+
name: 'Atlassian API',
|
|
335
|
+
transport: 'stdio',
|
|
336
|
+
command: 'node',
|
|
337
|
+
args: ['./server.js'],
|
|
338
|
+
env: {
|
|
339
|
+
ATLASSIAN_TOKEN: process.env.ATLASSIAN_TOKEN!,
|
|
340
|
+
ATLASSIAN_URL: process.env.ATLASSIAN_URL!,
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
]
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
Set your token in the shell before running:
|
|
347
|
+
|
|
348
|
+
```bash
|
|
349
|
+
export ATLASSIAN_TOKEN=your_personal_api_token
|
|
350
|
+
npx mcp-playbook dev
|
|
351
|
+
```
|
|
352
|
+
|
|
353
|
+
### For HTTP servers with auth headers
|
|
354
|
+
|
|
355
|
+
```typescript
|
|
356
|
+
{
|
|
357
|
+
transport: 'http',
|
|
358
|
+
url: 'https://api.yourcompany.com/mcp',
|
|
359
|
+
headers: {
|
|
360
|
+
'Authorization': `Bearer ${process.env.API_TOKEN}`,
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
```
|
|
364
|
+
|
|
365
|
+
### ⚠️ Current auth limitations
|
|
366
|
+
|
|
367
|
+
Full OAuth 2.0 in the UI (where each team member logs in with their own account) is **on the roadmap** but not yet implemented. For now:
|
|
368
|
+
|
|
369
|
+
| Auth method | Supported today |
|
|
370
|
+
|---|---|
|
|
371
|
+
| API keys via env variables | ✅ |
|
|
372
|
+
| Bearer tokens via headers | ✅ |
|
|
373
|
+
| Personal access tokens | ✅ |
|
|
374
|
+
| OAuth 2.0 in the UI | 🗓 Planned |
|
|
375
|
+
| Per-user auth in shared deployments | 🗓 Planned |
|
|
376
|
+
|
|
377
|
+
For internal team deployments today: use a shared service account token passed via env. For public-facing deployments that need per-user auth: wait for the OAuth feature or run the playground behind your own auth layer (SSO, Cloudflare Access, etc.).
|
|
378
|
+
|
|
379
|
+
---
|
|
380
|
+
|
|
381
|
+
## 💻 CLI Reference
|
|
382
|
+
|
|
383
|
+
All commands are available via `npx mcp-playbook` or the `mcp-playbook` binary if installed globally.
|
|
384
|
+
|
|
385
|
+
### `mcp-playbook dev`
|
|
386
|
+
|
|
387
|
+
Starts the development server with hot reload. Opens browser automatically.
|
|
388
|
+
|
|
389
|
+
```bash
|
|
390
|
+
mcp-playbook dev [options]
|
|
391
|
+
|
|
392
|
+
Options:
|
|
393
|
+
-p, --port <port> Port to run on (default: 4242)
|
|
394
|
+
-c, --config <path> Path to config file (default: playbook.config.ts)
|
|
395
|
+
--no-open Do not open browser automatically
|
|
396
|
+
```
|
|
397
|
+
|
|
398
|
+
```bash
|
|
399
|
+
# Examples
|
|
400
|
+
mcp-playbook dev
|
|
401
|
+
mcp-playbook dev --port 8080
|
|
402
|
+
mcp-playbook dev --config ./docs/playbook.config.ts
|
|
403
|
+
mcp-playbook dev --no-open
|
|
404
|
+
```
|
|
405
|
+
|
|
406
|
+
### `mcp-playbook build`
|
|
407
|
+
|
|
408
|
+
Connects to all configured servers, discovers all tools, and generates a **static documentation site**. Deploy it anywhere — no server required at view time.
|
|
409
|
+
|
|
410
|
+
```bash
|
|
411
|
+
mcp-playbook build [options]
|
|
412
|
+
|
|
413
|
+
Options:
|
|
414
|
+
-o, --output <dir> Output directory (default: playbook-dist)
|
|
415
|
+
-c, --config <path> Path to config file (default: playbook.config.ts)
|
|
416
|
+
```
|
|
417
|
+
|
|
418
|
+
```bash
|
|
419
|
+
# Examples
|
|
420
|
+
mcp-playbook build
|
|
421
|
+
mcp-playbook build --output ./docs-site
|
|
422
|
+
```
|
|
423
|
+
|
|
424
|
+
Deploy `playbook-dist/` to **GitHub Pages, Vercel, Netlify**, or any static host.
|
|
425
|
+
|
|
426
|
+
### `mcp-playbook init`
|
|
427
|
+
|
|
428
|
+
Scaffolds a `playbook.config.ts` file in the current directory. Safe to run — will not overwrite an existing config.
|
|
429
|
+
|
|
430
|
+
```bash
|
|
431
|
+
mcp-playbook init
|
|
432
|
+
```
|
|
433
|
+
|
|
434
|
+
---
|
|
435
|
+
|
|
436
|
+
## 🖥️ The Playbook UI
|
|
437
|
+
|
|
438
|
+
### Sidebar
|
|
439
|
+
|
|
440
|
+
Lists all discovered tools grouped by server. Contains:
|
|
441
|
+
- **Search** — filters across tool names, descriptions, and tags
|
|
442
|
+
- **Server filter** — show tools from one server at a time
|
|
443
|
+
- **Connection status** — green dot = connected, red = disconnected
|
|
444
|
+
- **Tag groups** — if you defined tags in config
|
|
445
|
+
|
|
446
|
+
### Docs tab
|
|
447
|
+
|
|
448
|
+
Auto-generated from the tool's JSON Schema. Shows:
|
|
449
|
+
- Every parameter with name, **type badge** (string, number, boolean, enum, object)
|
|
450
|
+
- Required vs optional label
|
|
451
|
+
- Default values
|
|
452
|
+
- Descriptions
|
|
453
|
+
- Enum values listed as pills
|
|
454
|
+
- Which server the tool belongs to
|
|
455
|
+
|
|
456
|
+
### Try it tab
|
|
457
|
+
|
|
458
|
+
Interactive form built from the input schema:
|
|
459
|
+
- `string` → text input
|
|
460
|
+
- `number` → number input
|
|
461
|
+
- `boolean` → true/false toggle
|
|
462
|
+
- `enum` → dropdown select
|
|
463
|
+
- `object` → nested form
|
|
464
|
+
|
|
465
|
+
Click **Run tool** to execute against the real MCP server. Response shown with syntax highlighting and execution time in milliseconds.
|
|
466
|
+
|
|
467
|
+
### Examples tab
|
|
468
|
+
|
|
469
|
+
Shows all examples you defined in `playbook.config.ts`. Click **Load →** to pre-fill the Try tab with those values. If no examples are defined, shows instructions for adding them.
|
|
470
|
+
|
|
471
|
+
### Schema tab
|
|
472
|
+
|
|
473
|
+
Shows the raw JSON Schema and the complete MCP tool definition — ready to copy-paste into another project.
|
|
474
|
+
|
|
475
|
+
### Hot reload
|
|
476
|
+
|
|
477
|
+
When running `mcp-playbook dev`, the config file is watched. Add a new server or modify examples → browser refreshes automatically without a page reload.
|
|
478
|
+
|
|
479
|
+
---
|
|
480
|
+
|
|
481
|
+
## 🏗️ How MCP Playbook works
|
|
482
|
+
|
|
483
|
+
```
|
|
484
|
+
Your playbook.config.ts
|
|
485
|
+
↓
|
|
486
|
+
mcp-playbook reads config
|
|
487
|
+
↓
|
|
488
|
+
Connects to each MCP server
|
|
489
|
+
(spawns process for stdio / connects to URL for HTTP/SSE)
|
|
490
|
+
↓
|
|
491
|
+
Calls tools/list on each server
|
|
492
|
+
(standard MCP protocol — works with any compliant server)
|
|
493
|
+
↓
|
|
494
|
+
Gets all tool schemas (name, description, inputSchema)
|
|
495
|
+
↓
|
|
496
|
+
Merges with your hand-written examples from config
|
|
497
|
+
↓
|
|
498
|
+
Serves React UI at localhost:4242
|
|
499
|
+
↓
|
|
500
|
+
Docs tab: renders schema as human-readable documentation
|
|
501
|
+
Try it tab: renders interactive form, executes real tool calls
|
|
502
|
+
Examples tab: shows preset inputs, loads them into Try tab
|
|
503
|
+
Schema tab: shows raw JSON for copy-paste
|
|
504
|
+
```
|
|
505
|
+
|
|
506
|
+
### The standard it relies on
|
|
507
|
+
|
|
508
|
+
Every MCP server regardless of language or library must implement `tools/list` — it is a core method of the MCP specification (maintained by Anthropic, open standard). This is why MCP Playbook works with any compliant server:
|
|
509
|
+
|
|
510
|
+
```
|
|
511
|
+
Atlassian MCP server → implements tools/list ✓
|
|
512
|
+
Linear MCP server → implements tools/list ✓
|
|
513
|
+
Your custom server → implements tools/list ✓
|
|
514
|
+
Any future server → implements tools/list ✓
|
|
515
|
+
```
|
|
516
|
+
|
|
517
|
+
---
|
|
518
|
+
|
|
519
|
+
## 📂 MCP server file structure — what you need to know
|
|
520
|
+
|
|
521
|
+
### One entry point, unlimited internal files
|
|
522
|
+
|
|
523
|
+
An MCP server always has **one entry point file** — the file MCP clients connect to. But internally it can import from as many files as you want.
|
|
524
|
+
|
|
525
|
+
```
|
|
526
|
+
From outside (mcp-playbook, Claude, any MCP client):
|
|
527
|
+
sees → one process running server.js
|
|
528
|
+
does not know → how many internal files exist
|
|
529
|
+
|
|
530
|
+
From inside (your code):
|
|
531
|
+
server.js imports tools/index.ts
|
|
532
|
+
tools/index.ts imports users/get_user.ts
|
|
533
|
+
tools/index.ts imports issues/create_issue.ts
|
|
534
|
+
... 100 files imported — all invisible to the outside
|
|
535
|
+
```
|
|
536
|
+
|
|
537
|
+
In your `playbook.config.ts` you always point at the **entry file only**:
|
|
538
|
+
|
|
539
|
+
```typescript
|
|
540
|
+
servers: [
|
|
541
|
+
{
|
|
542
|
+
name: 'My API',
|
|
543
|
+
transport: 'stdio',
|
|
544
|
+
command: 'node',
|
|
545
|
+
args: ['./server.js'], // ← always the entry point
|
|
546
|
+
// internal file structure does not matter here
|
|
547
|
+
}
|
|
548
|
+
]
|
|
549
|
+
```
|
|
550
|
+
|
|
551
|
+
### Multiple MCP servers — each its own entry file
|
|
552
|
+
|
|
553
|
+
You can run multiple completely separate MCP servers — each its own process, its own entry file, its own set of tools. MCP Playbook connects to all of them and shows everything in one unified dashboard.
|
|
554
|
+
|
|
555
|
+
```
|
|
556
|
+
Real world example — Atlassian:
|
|
557
|
+
|
|
558
|
+
jira-mcp/server.js → Jira tools only
|
|
559
|
+
confluence-mcp/server.js → Confluence tools only
|
|
560
|
+
bitbucket-mcp/server.js → Bitbucket tools only
|
|
561
|
+
```
|
|
562
|
+
|
|
563
|
+
```typescript
|
|
564
|
+
// playbook.config.ts — connect to all three at once
|
|
565
|
+
export default defineConfig({
|
|
566
|
+
servers: [
|
|
567
|
+
{
|
|
568
|
+
name: 'Jira',
|
|
569
|
+
transport: 'stdio',
|
|
570
|
+
command: 'node',
|
|
571
|
+
args: ['./jira-mcp/server.js'],
|
|
572
|
+
},
|
|
573
|
+
{
|
|
574
|
+
name: 'Confluence',
|
|
575
|
+
transport: 'stdio',
|
|
576
|
+
command: 'node',
|
|
577
|
+
args: ['./confluence-mcp/server.js'],
|
|
578
|
+
},
|
|
579
|
+
{
|
|
580
|
+
name: 'Bitbucket',
|
|
581
|
+
transport: 'stdio',
|
|
582
|
+
command: 'node',
|
|
583
|
+
args: ['./bitbucket-mcp/server.js'],
|
|
584
|
+
},
|
|
585
|
+
]
|
|
586
|
+
})
|
|
587
|
+
```
|
|
588
|
+
|
|
589
|
+
MCP Playbook spawns all three as separate processes and shows all their tools in one searchable UI — grouped by server, filterable, searchable.
|
|
590
|
+
|
|
591
|
+
> **Key rule:** one entry point per MCP server. How many files live inside that server is entirely your choice and completely invisible to MCP Playbook.
|
|
592
|
+
|
|
593
|
+
---
|
|
594
|
+
|
|
595
|
+
## 📂 Structuring a large MCP server (100+ tools)
|
|
596
|
+
|
|
597
|
+
For servers with many tools, use the **one file per tool + auto-loader** pattern. You never register tools manually in `playbook.config.ts` — MCP Playbook discovers them all automatically from the server.
|
|
598
|
+
|
|
599
|
+
```
|
|
600
|
+
src/
|
|
601
|
+
tools/
|
|
602
|
+
users/
|
|
603
|
+
get_user.ts
|
|
604
|
+
create_user.ts
|
|
605
|
+
list_users.ts
|
|
606
|
+
issues/
|
|
607
|
+
create_issue.ts
|
|
608
|
+
search_issues.ts
|
|
609
|
+
index.ts ← auto-loads all tool files
|
|
610
|
+
server.ts ← stays tiny forever
|
|
611
|
+
```
|
|
612
|
+
|
|
613
|
+
```typescript
|
|
614
|
+
// src/tools/users/get_user.ts — one file, one tool
|
|
615
|
+
import { z } from 'zod/v4'
|
|
616
|
+
|
|
617
|
+
export const name = 'get_user'
|
|
618
|
+
|
|
619
|
+
export const config = {
|
|
620
|
+
title: 'Get User',
|
|
621
|
+
description: 'Retrieve a user by their unique ID',
|
|
622
|
+
inputSchema: z.object({
|
|
623
|
+
userId: z.string().describe('The user UUID'),
|
|
624
|
+
include_meta: z.boolean().default(false).describe('Include metadata'),
|
|
625
|
+
})
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
export const handler = async ({ userId, include_meta }) => {
|
|
629
|
+
const user = await db.users.findById(userId)
|
|
630
|
+
return { content: [{ type: 'text', text: JSON.stringify(user) }] }
|
|
631
|
+
}
|
|
632
|
+
```
|
|
633
|
+
|
|
634
|
+
```typescript
|
|
635
|
+
// src/tools/index.ts — auto-loads every tool file
|
|
636
|
+
import { readdirSync, statSync } from 'fs'
|
|
637
|
+
import { join, dirname } from 'path'
|
|
638
|
+
import { fileURLToPath, pathToFileURL } from 'url'
|
|
639
|
+
|
|
640
|
+
const __dirname = dirname(fileURLToPath(import.meta.url))
|
|
641
|
+
|
|
642
|
+
export async function registerAllTools(server) {
|
|
643
|
+
function getToolFiles(dir) {
|
|
644
|
+
const files = []
|
|
645
|
+
for (const entry of readdirSync(dir)) {
|
|
646
|
+
const full = join(dir, entry)
|
|
647
|
+
if (statSync(full).isDirectory()) {
|
|
648
|
+
files.push(...getToolFiles(full))
|
|
649
|
+
} else if (entry.endsWith('.ts') && entry !== 'index.ts') {
|
|
650
|
+
files.push(full)
|
|
651
|
+
}
|
|
652
|
+
}
|
|
653
|
+
return files
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
for (const file of getToolFiles(__dirname)) {
|
|
657
|
+
const mod = await import(pathToFileURL(file).href)
|
|
658
|
+
server.registerTool(mod.name, mod.config, mod.handler)
|
|
659
|
+
}
|
|
660
|
+
}
|
|
661
|
+
```
|
|
662
|
+
|
|
663
|
+
```typescript
|
|
664
|
+
// src/server.ts — stays this small forever
|
|
665
|
+
import { McpServer } from '@modelcontextprotocol/server'
|
|
666
|
+
import { serveStdio } from '@modelcontextprotocol/server/stdio'
|
|
667
|
+
import { registerAllTools } from './tools/index.ts'
|
|
668
|
+
|
|
669
|
+
serveStdio(() => {
|
|
670
|
+
const server = new McpServer({ name: 'my-api', version: '1.0.0' })
|
|
671
|
+
registerAllTools(server)
|
|
672
|
+
return server
|
|
673
|
+
})
|
|
674
|
+
```
|
|
675
|
+
|
|
676
|
+
Adding a new tool = create one new file. `playbook.config.ts` never changes.
|
|
677
|
+
|
|
678
|
+
---
|
|
679
|
+
|
|
680
|
+
## 🚢 Deploying MCP Playbook
|
|
681
|
+
|
|
682
|
+
### Deploy to GitHub Pages
|
|
683
|
+
|
|
684
|
+
```yaml
|
|
685
|
+
# .github/workflows/deploy-playbook.yml
|
|
686
|
+
name: Deploy MCP Playbook
|
|
687
|
+
|
|
688
|
+
on:
|
|
689
|
+
push:
|
|
690
|
+
branches: [main]
|
|
691
|
+
|
|
692
|
+
jobs:
|
|
693
|
+
deploy:
|
|
694
|
+
runs-on: ubuntu-latest
|
|
695
|
+
steps:
|
|
696
|
+
- uses: actions/checkout@v4
|
|
697
|
+
- uses: actions/setup-node@v4
|
|
698
|
+
with:
|
|
699
|
+
node-version: 18
|
|
700
|
+
|
|
701
|
+
- run: npm install
|
|
702
|
+
- run: npm run build # build your MCP server first
|
|
703
|
+
- run: npx mcp-playbook build --output ./docs
|
|
704
|
+
|
|
705
|
+
- name: Deploy to GitHub Pages
|
|
706
|
+
uses: peaceiris/actions-gh-pages@v3
|
|
707
|
+
with:
|
|
708
|
+
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
709
|
+
publish_dir: ./docs
|
|
710
|
+
```
|
|
711
|
+
|
|
712
|
+
Every push to `main` auto-rebuilds and redeploys your docs.
|
|
713
|
+
|
|
714
|
+
### Deploy to Vercel
|
|
715
|
+
|
|
716
|
+
```bash
|
|
717
|
+
# Install Vercel CLI
|
|
718
|
+
npm install -g vercel
|
|
719
|
+
|
|
720
|
+
# Build static docs
|
|
721
|
+
npx mcp-playbook build
|
|
722
|
+
|
|
723
|
+
# Deploy
|
|
724
|
+
vercel playbook-dist/
|
|
725
|
+
```
|
|
726
|
+
|
|
727
|
+
### Deploy on your own server (always-on)
|
|
728
|
+
|
|
729
|
+
```bash
|
|
730
|
+
# Build static docs
|
|
731
|
+
npx mcp-playbook build --output /var/www/mcp-docs
|
|
732
|
+
|
|
733
|
+
# Serve with nginx — no Node.js needed at view time
|
|
734
|
+
# Just static files
|
|
735
|
+
```
|
|
736
|
+
|
|
737
|
+
---
|
|
738
|
+
|
|
739
|
+
## 🔧 Local development (for library contributors)
|
|
740
|
+
|
|
741
|
+
If you are contributing to MCP Playbook itself:
|
|
742
|
+
|
|
743
|
+
```bash
|
|
744
|
+
# Clone the repo
|
|
745
|
+
git clone https://github.com/your-org/mcp-playbook
|
|
746
|
+
cd mcp-playbook
|
|
747
|
+
|
|
748
|
+
# Install dependencies
|
|
749
|
+
npm install
|
|
750
|
+
|
|
751
|
+
# Build everything (server/CLI via tsup + React UI via Vite)
|
|
752
|
+
npm run build
|
|
753
|
+
|
|
754
|
+
# Test against the included example server
|
|
755
|
+
npx mcp-playbook dev --config example/playbook.config.ts
|
|
756
|
+
|
|
757
|
+
# Watch mode — rebuilds on every save
|
|
758
|
+
npm run dev # Terminal 1: rebuilds server/CLI
|
|
759
|
+
npm run dev:client # Terminal 2: rebuilds React UI
|
|
760
|
+
|
|
761
|
+
# Test as a real user would install it
|
|
762
|
+
npm pack
|
|
763
|
+
# creates mcp-playbook-0.1.0.tgz
|
|
764
|
+
|
|
765
|
+
mkdir /tmp/test-project && cd /tmp/test-project
|
|
766
|
+
npm init -y
|
|
767
|
+
npm install /path/to/mcp-playbook-0.1.0.tgz
|
|
768
|
+
npx mcp-playbook init
|
|
769
|
+
npx mcp-playbook dev
|
|
770
|
+
```
|
|
771
|
+
|
|
772
|
+
### Using npm link for active development
|
|
773
|
+
|
|
774
|
+
```bash
|
|
775
|
+
# Register library globally as a symlink
|
|
776
|
+
cd mcp-playbook
|
|
777
|
+
npm run build
|
|
778
|
+
npm link
|
|
779
|
+
|
|
780
|
+
# Use in any project
|
|
781
|
+
cd your-project
|
|
782
|
+
npm link mcp-playbook
|
|
783
|
+
npx mcp-playbook dev
|
|
784
|
+
|
|
785
|
+
# After making changes
|
|
786
|
+
cd mcp-playbook
|
|
787
|
+
npm run build # changes available immediately — no relinking needed
|
|
788
|
+
```
|
|
789
|
+
|
|
790
|
+
---
|
|
791
|
+
|
|
792
|
+
## 🔍 Troubleshooting
|
|
793
|
+
|
|
794
|
+
### Config not found
|
|
795
|
+
|
|
796
|
+
```bash
|
|
797
|
+
Error: Config not found: playbook.config.ts
|
|
798
|
+
|
|
799
|
+
Fix:
|
|
800
|
+
npx mcp-playbook init
|
|
801
|
+
```
|
|
802
|
+
|
|
803
|
+
### Port already in use
|
|
804
|
+
|
|
805
|
+
```bash
|
|
806
|
+
Error: Port 4242 is already in use
|
|
807
|
+
|
|
808
|
+
Fix:
|
|
809
|
+
npx mcp-playbook dev --port 4243
|
|
810
|
+
```
|
|
811
|
+
|
|
812
|
+
### Server shows as disconnected
|
|
813
|
+
|
|
814
|
+
Check the following in order:
|
|
815
|
+
|
|
816
|
+
1. **stdio transport** — verify `command` and `args` are correct and the file exists
|
|
817
|
+
```bash
|
|
818
|
+
node ./your-server.js # run it manually — should start without errors
|
|
819
|
+
```
|
|
820
|
+
|
|
821
|
+
2. **HTTP/SSE transport** — verify the server is running at the configured URL
|
|
822
|
+
```bash
|
|
823
|
+
curl http://localhost:3001/mcp # should respond
|
|
824
|
+
```
|
|
825
|
+
|
|
826
|
+
3. **Environment variables** — if your server needs `API_KEY` etc., pass them via `env` in config
|
|
827
|
+
|
|
828
|
+
4. **Check the terminal** — the mcp-playbook dev terminal shows connection error details
|
|
829
|
+
|
|
830
|
+
### dist/ not found (library developers only)
|
|
831
|
+
|
|
832
|
+
```bash
|
|
833
|
+
Error: Cannot find module './dist/cli/index.js'
|
|
834
|
+
|
|
835
|
+
Fix: npm run build
|
|
836
|
+
```
|
|
837
|
+
|
|
838
|
+
### Tool execution returns 401 Unauthorized
|
|
839
|
+
|
|
840
|
+
Your MCP server needs authentication credentials. Pass them via env:
|
|
841
|
+
|
|
842
|
+
```typescript
|
|
843
|
+
env: {
|
|
844
|
+
API_TOKEN: process.env.API_TOKEN!,
|
|
845
|
+
}
|
|
846
|
+
```
|
|
847
|
+
|
|
848
|
+
Set in your shell:
|
|
849
|
+
|
|
850
|
+
```bash
|
|
851
|
+
export API_TOKEN=your_token_here
|
|
852
|
+
npx mcp-playbook dev
|
|
853
|
+
```
|
|
854
|
+
|
|
855
|
+
### Changes to playbook.config.ts not picked up
|
|
856
|
+
|
|
857
|
+
The config is watched automatically. If it is not updating, click the **↻ Refresh** button in the top bar or restart the dev server.
|
|
858
|
+
|
|
859
|
+
---
|
|
860
|
+
|
|
861
|
+
## 🗺️ Roadmap
|
|
862
|
+
|
|
863
|
+
| Feature | Status |
|
|
864
|
+
|---|---|
|
|
865
|
+
| Core: auto-discovery, docs, Try it, Examples, Schema tabs | ✅ Done |
|
|
866
|
+
| stdio / HTTP / SSE transport | ✅ Done |
|
|
867
|
+
| Hot reload on config change | ✅ Done |
|
|
868
|
+
| Static site build (`mcp-playbook build`) | ✅ Done |
|
|
869
|
+
| Multi-server dashboard | ✅ Done |
|
|
870
|
+
| Tool call history / session log | 🗓 Planned |
|
|
871
|
+
| Export as curl / fetch / MCP SDK snippet | 🗓 Planned |
|
|
872
|
+
| Schema diff and changelog when tool definitions change | 🗓 Planned |
|
|
873
|
+
| **Authentication — OAuth 2.0 in the UI** | 🗓 Planned |
|
|
874
|
+
| Per-user auth for shared deployments | 🗓 Planned |
|
|
875
|
+
| Embeddable React component `<MCPStorybook />` | 🗓 Planned |
|
|
876
|
+
| VS Code extension integration | 🔭 Exploring |
|
|
877
|
+
| Hosted team sharing via URL (cloud version) | 🔭 Exploring |
|
|
878
|
+
| Mock mode — run without a real server | 🔭 Exploring |
|
|
879
|
+
| Semantic search across tool descriptions | 🔭 Exploring |
|
|
880
|
+
|
|
881
|
+
---
|
|
882
|
+
|
|
883
|
+
## 🤝 Contributing
|
|
884
|
+
|
|
885
|
+
PRs and issues are welcome. The MCP ecosystem needs this tool.
|
|
886
|
+
|
|
887
|
+
```bash
|
|
888
|
+
# Clone, build, test
|
|
889
|
+
git clone https://github.com/your-org/mcp-playbook
|
|
890
|
+
npm install
|
|
891
|
+
npm run build
|
|
892
|
+
npx mcp-playbook dev --config example/playbook.config.ts
|
|
893
|
+
```
|
|
894
|
+
|
|
895
|
+
Please open an issue before submitting large PRs so we can discuss the approach.
|
|
896
|
+
|
|
897
|
+
---
|
|
898
|
+
|
|
899
|
+
## 📄 License
|
|
900
|
+
|
|
901
|
+
MIT © your-org
|
|
902
|
+
|
|
903
|
+
---
|
|
904
|
+
|
|
905
|
+
<div align="center">
|
|
906
|
+
|
|
907
|
+
**mcp-playbook** · [npm](https://www.npmjs.com/package/mcp-playbook) · [GitHub](https://github.com/your-org/mcp-playbook) · [Issues](https://github.com/your-org/mcp-playbook/issues)
|
|
908
|
+
|
|
909
|
+
*If this library saves you time, give it a ⭐ on GitHub*
|
|
910
|
+
|
|
911
|
+
</div>
|