Skip to content

Commit eac230f

Browse files
committed
Add stdio support to MCP Studio
1 parent 1fc0d1c commit eac230f

File tree

4 files changed

+1330
-2
lines changed

4 files changed

+1330
-2
lines changed

mcp-studio/README.md

Lines changed: 110 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,112 @@
11
# MCP Studio
22

3-
Your MCP server description goes here.
3+
MCP server for managing workflows, executions, assistants, and prompts. Supports both HTTP and stdio transports.
4+
5+
## Features
6+
7+
- **Workflows**: Create, update, delete, and list workflow definitions
8+
- **Executions**: View and manage workflow execution history
9+
- **Assistants**: Manage AI assistant configurations
10+
- **Prompts**: Store and retrieve prompt templates
11+
12+
## Usage
13+
14+
### HTTP Transport (Mesh Web Connection)
15+
16+
```bash
17+
# Development with hot reload
18+
bun run dev
19+
20+
# Production
21+
bun run build:server
22+
node dist/server/main.js
23+
```
24+
25+
### Stdio Transport (Mesh Custom Command)
26+
27+
```bash
28+
# Run directly
29+
bun run stdio
30+
31+
# Development with hot reload
32+
bun run dev:stdio
33+
```
34+
35+
#### Adding to Mesh as Custom Command
36+
37+
In Mesh, add a new custom command connection:
38+
39+
1. Go to **MCPs****Add MCP****Custom Command**
40+
2. Configure the command:
41+
- **Command**: `bun`
42+
- **Args**: `--watch /path/to/mcp-studio/server/stdio.ts`
43+
3. Click **Save** - Mesh will spawn the process and fetch the tools
44+
4. Go to the **Settings** tab to configure the database binding
45+
5. Select a PostgreSQL connection from the **Database** dropdown
46+
6. Click **Save Changes**
47+
48+
This enables:
49+
- Live reloading during development
50+
- Mesh bindings UI for database configuration (same dropdowns as HTTP connections)
51+
- Automatic migrations when bindings are configured
52+
53+
## Bindings
54+
55+
The stdio transport supports Mesh bindings via:
56+
57+
- `MCP_CONFIGURATION` - Returns the state schema for the bindings UI (uses `BindingOf` format)
58+
- `ON_MCP_CONFIGURATION` - Receives configured bindings (connection IDs) and runs migrations
59+
60+
The binding schema uses the same format as HTTP mode:
61+
```typescript
62+
const StdioStateSchema = z.object({
63+
DATABASE: BindingOf("@deco/postgres").describe("PostgreSQL database binding"),
64+
});
65+
```
66+
67+
This renders as a dropdown in Mesh UI showing all connections that implement `@deco/postgres`.
68+
69+
## Environment Variables
70+
71+
| Variable | Required | Description |
72+
|----------|----------|-------------|
73+
| `DATABASE_URL` | Yes | PostgreSQL connection string (e.g., from Supabase project settings) |
74+
75+
**Note**: STDIO connections receive binding configuration (connection IDs) from Mesh, but still require `DATABASE_URL` env var for actual database connectivity. This is because STDIO processes cannot proxy database calls through Mesh.
76+
77+
## Available Tools
78+
79+
### Workflow Collection
80+
- `COLLECTION_WORKFLOW_LIST` - List all workflows
81+
- `COLLECTION_WORKFLOW_GET` - Get a single workflow by ID
82+
- `COLLECTION_WORKFLOW_CREATE` - Create a new workflow
83+
- `COLLECTION_WORKFLOW_UPDATE` - Update an existing workflow
84+
- `COLLECTION_WORKFLOW_DELETE` - Delete a workflow
85+
86+
### Execution Collection
87+
- `COLLECTION_WORKFLOW_EXECUTION_LIST` - List workflow executions
88+
- `COLLECTION_WORKFLOW_EXECUTION_GET` - Get execution details with step results
89+
90+
### Assistant Collection
91+
- `COLLECTION_ASSISTANT_LIST` - List all assistants
92+
- `COLLECTION_ASSISTANT_GET` - Get a single assistant by ID
93+
- `COLLECTION_ASSISTANT_CREATE` - Create a new assistant
94+
- `COLLECTION_ASSISTANT_UPDATE` - Update an existing assistant
95+
- `COLLECTION_ASSISTANT_DELETE` - Delete an assistant
96+
97+
### Prompt Collection
98+
- `COLLECTION_PROMPT_LIST` - List all prompts
99+
- `COLLECTION_PROMPT_GET` - Get a single prompt by ID
100+
101+
## Development
102+
103+
```bash
104+
# Install dependencies
105+
bun install
106+
107+
# Type check
108+
bun run check
109+
110+
# Format code
111+
bun run fmt
112+
```

mcp-studio/package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
"type": "module",
77
"scripts": {
88
"dev": "bun run --hot server/main.ts",
9+
"dev:stdio": "bun --watch server/stdio.ts",
10+
"stdio": "bun server/stdio.ts",
911
"configure": "deco configure",
1012
"gen": "deco gen --output=shared/deco.gen.ts",
1113
"check": "tsc --noEmit",
@@ -15,6 +17,7 @@
1517
},
1618
"dependencies": {
1719
"@ai-sdk/mcp": "^1.0.1",
20+
"postgres": "^3.4.5",
1821
"@decocms/bindings": "^1.0.3",
1922
"@decocms/runtime": "^1.0.3",
2023
"@jitl/quickjs-wasmfile-release-sync": "^0.31.0",
@@ -41,7 +44,8 @@
4144
"tailwind-merge": "^3.0.2",
4245
"tailwindcss": "^4.0.6",
4346
"tailwindcss-animate": "^1.0.7",
44-
"zod": "^3.24.3"
47+
"zod": "^3.24.3",
48+
"zod-to-json-schema": "^3.24.5"
4549
},
4650
"devDependencies": {
4751
"deco-cli": "^0.28.0",

0 commit comments

Comments
 (0)