convex-mcp-visual 1.0.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/README.md +844 -0
- package/dist/apps/apps/realtime-dashboard/index.html +15 -0
- package/dist/apps/apps/schema-browser/index.html +15 -0
- package/dist/apps/assets/modulepreload-polyfill-B5Qt9EMX.js +1 -0
- package/dist/apps/assets/realtime-dashboard-BPA99DZn.js +140 -0
- package/dist/apps/assets/schema-browser-BEcF8hRP.js +499 -0
- package/dist/apps/assets/style-BTxSpbLq.css +1 -0
- package/dist/convex-client.d.ts +56 -0
- package/dist/convex-client.d.ts.map +1 -0
- package/dist/convex-client.js +206 -0
- package/dist/convex-client.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +93 -0
- package/dist/index.js.map +1 -0
- package/dist/resources/dashboard.d.ts +7 -0
- package/dist/resources/dashboard.d.ts.map +1 -0
- package/dist/resources/dashboard.js +255 -0
- package/dist/resources/dashboard.js.map +1 -0
- package/dist/resources/schema-browser.d.ts +7 -0
- package/dist/resources/schema-browser.d.ts.map +1 -0
- package/dist/resources/schema-browser.js +654 -0
- package/dist/resources/schema-browser.js.map +1 -0
- package/dist/server.d.ts +12 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +142 -0
- package/dist/server.js.map +1 -0
- package/dist/tools/dashboard.d.ts +19 -0
- package/dist/tools/dashboard.d.ts.map +1 -0
- package/dist/tools/dashboard.js +309 -0
- package/dist/tools/dashboard.js.map +1 -0
- package/dist/tools/schema-browser.d.ts +19 -0
- package/dist/tools/schema-browser.d.ts.map +1 -0
- package/dist/tools/schema-browser.js +260 -0
- package/dist/tools/schema-browser.js.map +1 -0
- package/dist/ui-server.d.ts +26 -0
- package/dist/ui-server.d.ts.map +1 -0
- package/dist/ui-server.js +202 -0
- package/dist/ui-server.js.map +1 -0
- package/package.json +55 -0
package/README.md
ADDED
|
@@ -0,0 +1,844 @@
|
|
|
1
|
+
# Convex MCP Visual
|
|
2
|
+
|
|
3
|
+
Visual MCP (Model Context Protocol) tools for exploring Convex databases. Opens interactive browser UIs alongside terminal output.
|
|
4
|
+
|
|
5
|
+
**Features:**
|
|
6
|
+
- **Graph View** - Visual schema diagram with draggable nodes and relationship lines
|
|
7
|
+
- **List View** - Table-based schema explorer with document browser
|
|
8
|
+
- **Dashboard** - Real-time metrics and charts
|
|
9
|
+
- **Dark Mode** - VS Code-style dark theme (toggle in header)
|
|
10
|
+
- **Dual Output** - Terminal markdown + browser UI simultaneously
|
|
11
|
+
|
|
12
|
+
Works with Claude Code and any MCP-compatible client.
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## Table of Contents
|
|
17
|
+
|
|
18
|
+
- [How MCP Works](#how-mcp-works)
|
|
19
|
+
- [Installation](#installation)
|
|
20
|
+
- [Setup](#setup)
|
|
21
|
+
- [Usage](#usage)
|
|
22
|
+
- [Switching Convex Backends](#switching-convex-backends)
|
|
23
|
+
- [Tools Reference](#tools-reference)
|
|
24
|
+
- [Tech Stack](#tech-stack)
|
|
25
|
+
- [Architecture](#architecture)
|
|
26
|
+
- [Keyboard Shortcuts](#keyboard-shortcuts)
|
|
27
|
+
- [Testing](#testing)
|
|
28
|
+
- [Stopping the MCP Server](#stopping-the-mcp-server)
|
|
29
|
+
- [Uninstalling](#uninstalling)
|
|
30
|
+
- [Troubleshooting](#troubleshooting)
|
|
31
|
+
- [Development](#development)
|
|
32
|
+
- [Security](#security)
|
|
33
|
+
- [Why This Project Exists](#why-this-project-exists)
|
|
34
|
+
- [Current Limitations](#current-limitations)
|
|
35
|
+
- [Wishlist & Future Plans](#wishlist--future-plans)
|
|
36
|
+
- [Claude.ai Web Integration](#claudeai-web-integration-future)
|
|
37
|
+
- [Contributing](#contributing)
|
|
38
|
+
- [License](#license)
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## How MCP Works
|
|
43
|
+
|
|
44
|
+
MCP (Model Context Protocol) is a standard protocol that allows AI assistants like Claude to communicate with external tools and services. Here's how this MCP server works:
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
┌─────────────────────────────────────────────────────────────────────────┐
|
|
48
|
+
│ Claude Code / MCP Client │
|
|
49
|
+
│ │
|
|
50
|
+
│ User: "Show me my Convex schema" │
|
|
51
|
+
└─────────────────────────────────────────────────────────────────────────┘
|
|
52
|
+
│
|
|
53
|
+
│ MCP Protocol (JSON-RPC over stdio)
|
|
54
|
+
▼
|
|
55
|
+
┌─────────────────────────────────────────────────────────────────────────┐
|
|
56
|
+
│ Convex MCP Visual Server │
|
|
57
|
+
│ │
|
|
58
|
+
│ • Receives tool requests via MCP protocol │
|
|
59
|
+
│ • Authenticates with Convex using local credentials │
|
|
60
|
+
│ • Queries Convex Cloud for schema/document data │
|
|
61
|
+
│ • Returns structured responses to Claude │
|
|
62
|
+
│ • Optionally opens browser UI on localhost:3456 │
|
|
63
|
+
└─────────────────────────────────────────────────────────────────────────┘
|
|
64
|
+
│ │
|
|
65
|
+
│ HTTP Client │ Local HTTP Server
|
|
66
|
+
▼ ▼
|
|
67
|
+
┌───────────────────────┐ ┌───────────────────────────┐
|
|
68
|
+
│ Convex Cloud │ │ Browser UI │
|
|
69
|
+
│ │ │ (localhost:3456) │
|
|
70
|
+
│ Your deployment at │ │ │
|
|
71
|
+
│ xyz.convex.cloud │ │ Interactive graph view, │
|
|
72
|
+
└───────────────────────┘ │ tables, dashboards │
|
|
73
|
+
└───────────────────────────┘
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
**Key Concepts:**
|
|
77
|
+
|
|
78
|
+
1. **stdio Mode**: The MCP server runs as a subprocess of Claude Code, communicating via stdin/stdout using JSON-RPC messages.
|
|
79
|
+
|
|
80
|
+
2. **Tools**: The server exposes two tools (`schema_browser`, `dashboard_view`) that Claude can invoke on your behalf.
|
|
81
|
+
|
|
82
|
+
3. **Dual Output**: Each tool returns both structured text for Claude AND opens a visual browser interface for you.
|
|
83
|
+
|
|
84
|
+
4. **Authentication**: The server reads your Convex credentials from `~/.convex/` (created by `npx convex login`) or from environment variables.
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
## Installation
|
|
89
|
+
|
|
90
|
+
### Option 1: From GitHub (Current)
|
|
91
|
+
|
|
92
|
+
Since this package is not yet published to npm, install from GitHub:
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
# 1. Clone the repository
|
|
96
|
+
git clone https://github.com/your-username/convex-mcp-visual.git
|
|
97
|
+
cd convex-mcp-visual
|
|
98
|
+
|
|
99
|
+
# 2. Install dependencies
|
|
100
|
+
npm install
|
|
101
|
+
|
|
102
|
+
# 3. Build the project
|
|
103
|
+
npm run build
|
|
104
|
+
|
|
105
|
+
# 4. Add to Claude Code (use YOUR absolute path)
|
|
106
|
+
claude mcp add convex-visual -- node /Users/yourname/path/to/convex-mcp-visual/dist/index.js --stdio
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
**Important**: You must use the **absolute path** to `dist/index.js`. Relative paths won't work.
|
|
110
|
+
|
|
111
|
+
**Example paths:**
|
|
112
|
+
- macOS: `/Users/yourname/projects/convex-mcp-visual/dist/index.js`
|
|
113
|
+
- Linux: `/home/yourname/projects/convex-mcp-visual/dist/index.js`
|
|
114
|
+
- Windows: `C:\Users\yourname\projects\convex-mcp-visual\dist\index.js`
|
|
115
|
+
|
|
116
|
+
### Option 2: npx (After npm Publish)
|
|
117
|
+
|
|
118
|
+
Once published to npm, you can use:
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
# Add to Claude Code directly (no clone needed)
|
|
122
|
+
claude mcp add convex-visual -- npx convex-mcp-visual --stdio
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### Option 3: Global Install (After npm Publish)
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
npm install -g convex-mcp-visual
|
|
129
|
+
claude mcp add convex-visual -- convex-mcp-visual --stdio
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### How It Works
|
|
133
|
+
|
|
134
|
+
```
|
|
135
|
+
┌─────────────────────────────────────────────────────────────────┐
|
|
136
|
+
│ claude mcp add convex-visual -- node /path/dist/index.js │
|
|
137
|
+
│ │
|
|
138
|
+
│ This tells Claude Code: │
|
|
139
|
+
│ 1. Register a server named "convex-visual" │
|
|
140
|
+
│ 2. When tools are needed, spawn: node /path/dist/index.js │
|
|
141
|
+
│ 3. Communicate via --stdio (stdin/stdout) │
|
|
142
|
+
└─────────────────────────────────────────────────────────────────┘
|
|
143
|
+
│
|
|
144
|
+
▼
|
|
145
|
+
┌─────────────────────────────────────────────────────────────────┐
|
|
146
|
+
│ When you say "Show me my Convex schema": │
|
|
147
|
+
│ │
|
|
148
|
+
│ 1. Claude Code starts the MCP server process │
|
|
149
|
+
│ 2. Sends JSON-RPC request: { method: "tools/call", ... } │
|
|
150
|
+
│ 3. Server queries your Convex deployment │
|
|
151
|
+
│ 4. Server opens browser UI on localhost:3456 │
|
|
152
|
+
│ 5. Server returns markdown to Claude │
|
|
153
|
+
│ 6. You see both: terminal output + browser visualization │
|
|
154
|
+
└─────────────────────────────────────────────────────────────────┘
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
---
|
|
158
|
+
|
|
159
|
+
## Setup
|
|
160
|
+
|
|
161
|
+
### 1. Convex Authentication
|
|
162
|
+
|
|
163
|
+
You need valid Convex credentials. The server checks these locations in order:
|
|
164
|
+
|
|
165
|
+
| Priority | Source | How to Set |
|
|
166
|
+
|----------|--------|------------|
|
|
167
|
+
| 1 | `CONVEX_DEPLOY_KEY` env var | `export CONVEX_DEPLOY_KEY=prod:xxx` |
|
|
168
|
+
| 2 | `CONVEX_URL` env var | `export CONVEX_URL=https://xxx.convex.cloud` |
|
|
169
|
+
| 3 | `~/.convex/config.json` | Run `npx convex login` |
|
|
170
|
+
|
|
171
|
+
**Recommended for local development:**
|
|
172
|
+
|
|
173
|
+
```bash
|
|
174
|
+
# Login to Convex (creates ~/.convex/config.json)
|
|
175
|
+
npx convex login
|
|
176
|
+
|
|
177
|
+
# Navigate to your Convex project directory
|
|
178
|
+
cd your-convex-project
|
|
179
|
+
|
|
180
|
+
# Deploy your project (optional, updates local config)
|
|
181
|
+
npx convex dev
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
**For CI/CD or servers:**
|
|
185
|
+
|
|
186
|
+
```bash
|
|
187
|
+
export CONVEX_DEPLOY_KEY=prod:your-deploy-key-here
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
### 2. Verify Installation
|
|
191
|
+
|
|
192
|
+
```bash
|
|
193
|
+
# Check MCP server is registered
|
|
194
|
+
claude mcp list
|
|
195
|
+
|
|
196
|
+
# You should see: convex-visual
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
### 3. Test Connection
|
|
200
|
+
|
|
201
|
+
```bash
|
|
202
|
+
# If installed globally or via npx
|
|
203
|
+
npx convex-mcp-visual --test
|
|
204
|
+
|
|
205
|
+
# If local development
|
|
206
|
+
npm test
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
---
|
|
210
|
+
|
|
211
|
+
## Usage
|
|
212
|
+
|
|
213
|
+
In Claude Code, simply ask:
|
|
214
|
+
|
|
215
|
+
| Request | What Happens |
|
|
216
|
+
|---------|--------------|
|
|
217
|
+
| "Show me my Convex schema" | Opens Schema Browser (graph view) |
|
|
218
|
+
| "What tables do I have?" | Shows tables in terminal + browser |
|
|
219
|
+
| "Show me the users table" | Opens Schema Browser pre-selected to users |
|
|
220
|
+
| "Create a dashboard for my data" | Opens Realtime Dashboard |
|
|
221
|
+
|
|
222
|
+
### Example Conversation
|
|
223
|
+
|
|
224
|
+
```
|
|
225
|
+
You: Show me my Convex schema
|
|
226
|
+
|
|
227
|
+
Claude: I'll open the Schema Browser for your Convex deployment.
|
|
228
|
+
|
|
229
|
+
[Opens browser with interactive graph view]
|
|
230
|
+
|
|
231
|
+
Here's your schema:
|
|
232
|
+
- users (245 documents)
|
|
233
|
+
- posts (1,234 documents)
|
|
234
|
+
- comments (892 documents)
|
|
235
|
+
|
|
236
|
+
The users table references posts, and comments reference both users and posts.
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
---
|
|
240
|
+
|
|
241
|
+
## Switching Convex Backends
|
|
242
|
+
|
|
243
|
+
You may need to switch between different Convex deployments (dev, staging, production).
|
|
244
|
+
|
|
245
|
+
### Method 1: Re-login to Different Project
|
|
246
|
+
|
|
247
|
+
```bash
|
|
248
|
+
# Logout from current deployment
|
|
249
|
+
npx convex logout
|
|
250
|
+
|
|
251
|
+
# Login to a different project
|
|
252
|
+
cd /path/to/other-convex-project
|
|
253
|
+
npx convex login
|
|
254
|
+
npx convex dev
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
### Method 2: Set Environment Variable
|
|
258
|
+
|
|
259
|
+
```bash
|
|
260
|
+
# Temporarily use a different deployment
|
|
261
|
+
export CONVEX_URL=https://different-project.convex.cloud
|
|
262
|
+
|
|
263
|
+
# Or with a deploy key
|
|
264
|
+
export CONVEX_DEPLOY_KEY=prod:your-other-key
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
### Method 3: Multiple MCP Registrations
|
|
268
|
+
|
|
269
|
+
You can register multiple instances for different backends:
|
|
270
|
+
|
|
271
|
+
```bash
|
|
272
|
+
# Production
|
|
273
|
+
claude mcp add convex-prod -- npx convex-mcp-visual --stdio
|
|
274
|
+
# Set CONVEX_DEPLOY_KEY in Claude Code settings for this instance
|
|
275
|
+
|
|
276
|
+
# Development
|
|
277
|
+
claude mcp add convex-dev -- npx convex-mcp-visual --stdio
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
### Viewing Current Deployment
|
|
281
|
+
|
|
282
|
+
In Claude Code, ask: "What Convex deployment am I connected to?"
|
|
283
|
+
|
|
284
|
+
The Schema Browser header also displays the current deployment URL.
|
|
285
|
+
|
|
286
|
+
---
|
|
287
|
+
|
|
288
|
+
## Tools Reference
|
|
289
|
+
|
|
290
|
+
### schema_browser
|
|
291
|
+
|
|
292
|
+
Interactive schema explorer with two view modes.
|
|
293
|
+
|
|
294
|
+
**Parameters:**
|
|
295
|
+
|
|
296
|
+
| Parameter | Type | Default | Description |
|
|
297
|
+
|-----------|------|---------|-------------|
|
|
298
|
+
| `table` | string | none | Pre-select a specific table |
|
|
299
|
+
| `showInferred` | boolean | true | Show inferred schemas from documents |
|
|
300
|
+
| `pageSize` | number | 50 | Documents per page in list view |
|
|
301
|
+
|
|
302
|
+
**Views:**
|
|
303
|
+
|
|
304
|
+
- **Graph View**: Visual diagram showing tables as nodes with relationship lines
|
|
305
|
+
- Drag nodes to rearrange
|
|
306
|
+
- Pan/zoom to navigate
|
|
307
|
+
- Click nodes to select
|
|
308
|
+
- Toggle dark mode in header
|
|
309
|
+
|
|
310
|
+
- **List View**: Traditional table list with schema details
|
|
311
|
+
- Paginated document browser
|
|
312
|
+
- Field types and optionality
|
|
313
|
+
- Search across tables
|
|
314
|
+
|
|
315
|
+
### dashboard_view
|
|
316
|
+
|
|
317
|
+
Real-time dashboard with metrics and charts.
|
|
318
|
+
|
|
319
|
+
**Parameters:**
|
|
320
|
+
|
|
321
|
+
| Parameter | Type | Default | Description |
|
|
322
|
+
|-----------|------|---------|-------------|
|
|
323
|
+
| `metrics` | array | [] | Metric definitions |
|
|
324
|
+
| `charts` | array | [] | Chart configurations |
|
|
325
|
+
| `refreshInterval` | number | 5 | Refresh interval in seconds |
|
|
326
|
+
|
|
327
|
+
**Metric Aggregations:** count, sum, avg, min, max
|
|
328
|
+
|
|
329
|
+
**Chart Types:** line, bar, pie
|
|
330
|
+
|
|
331
|
+
---
|
|
332
|
+
|
|
333
|
+
## Tech Stack
|
|
334
|
+
|
|
335
|
+
### Server
|
|
336
|
+
|
|
337
|
+
| Technology | Purpose |
|
|
338
|
+
|------------|---------|
|
|
339
|
+
| **Node.js 18+** | Runtime environment |
|
|
340
|
+
| **TypeScript** | Type-safe JavaScript |
|
|
341
|
+
| **@modelcontextprotocol/sdk** | Official MCP protocol implementation |
|
|
342
|
+
| **Convex SDK** | Convex database client |
|
|
343
|
+
|
|
344
|
+
### UI Applications
|
|
345
|
+
|
|
346
|
+
| Technology | Purpose |
|
|
347
|
+
|------------|---------|
|
|
348
|
+
| **Vanilla TypeScript** | No framework dependencies (React, Vue, etc.) |
|
|
349
|
+
| **HTML5 Canvas** | Graph rendering with pan/zoom/drag |
|
|
350
|
+
| **CSS3 Variables** | Theming (light/dark mode) |
|
|
351
|
+
| **Vite** | Fast bundling and hot reload |
|
|
352
|
+
|
|
353
|
+
### Why These Choices?
|
|
354
|
+
|
|
355
|
+
- **No UI framework**: Keeps bundle small (~62KB for schema browser), loads instantly
|
|
356
|
+
- **Canvas for graphs**: Smooth 60fps rendering, handles 100+ nodes easily
|
|
357
|
+
- **CSS Variables**: Runtime theme switching without JavaScript
|
|
358
|
+
- **TypeScript everywhere**: Catches errors at build time, better IDE support
|
|
359
|
+
- **Vanilla over frameworks**: Fewer dependencies = fewer security vulnerabilities
|
|
360
|
+
|
|
361
|
+
### Dependencies
|
|
362
|
+
|
|
363
|
+
```json
|
|
364
|
+
{
|
|
365
|
+
"dependencies": {
|
|
366
|
+
"@modelcontextprotocol/sdk": "^1.0.0",
|
|
367
|
+
"convex": "^1.17.0"
|
|
368
|
+
},
|
|
369
|
+
"devDependencies": {
|
|
370
|
+
"@types/node": "^20.0.0",
|
|
371
|
+
"typescript": "^5.0.0",
|
|
372
|
+
"vite": "^6.4.1"
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
```
|
|
376
|
+
|
|
377
|
+
Only **2 runtime dependencies** - minimal attack surface, fast installs.
|
|
378
|
+
|
|
379
|
+
---
|
|
380
|
+
|
|
381
|
+
## Architecture
|
|
382
|
+
|
|
383
|
+
```
|
|
384
|
+
convex-mcp-visual/
|
|
385
|
+
├── src/
|
|
386
|
+
│ ├── index.ts # CLI entry (--stdio, --http, --test)
|
|
387
|
+
│ ├── server.ts # MCP server + tool handlers
|
|
388
|
+
│ ├── convex-client.ts # Convex authentication + queries
|
|
389
|
+
│ ├── ui-server.ts # Local HTTP server (port 3456)
|
|
390
|
+
│ ├── tools/
|
|
391
|
+
│ │ ├── schema-browser.ts
|
|
392
|
+
│ │ └── dashboard.ts
|
|
393
|
+
│ └── resources/
|
|
394
|
+
│ ├── schema-browser.ts
|
|
395
|
+
│ └── dashboard.ts
|
|
396
|
+
├── apps/
|
|
397
|
+
│ ├── schema-browser/ # Graph + list view UI
|
|
398
|
+
│ └── realtime-dashboard/
|
|
399
|
+
└── dist/ # Compiled output (published to npm)
|
|
400
|
+
```
|
|
401
|
+
|
|
402
|
+
---
|
|
403
|
+
|
|
404
|
+
## Keyboard Shortcuts
|
|
405
|
+
|
|
406
|
+
### Schema Browser
|
|
407
|
+
|
|
408
|
+
| Key | Action |
|
|
409
|
+
|-----|--------|
|
|
410
|
+
| `G` | Toggle Graph/List view |
|
|
411
|
+
| `B` | Toggle sidebar panel |
|
|
412
|
+
| `R` | Refresh data |
|
|
413
|
+
| `↑/↓` | Navigate tables |
|
|
414
|
+
| `←/→` | Change page (List view) |
|
|
415
|
+
| `/` | Focus search |
|
|
416
|
+
| `+/-` | Zoom in/out (Graph view) |
|
|
417
|
+
|
|
418
|
+
### Dashboard
|
|
419
|
+
|
|
420
|
+
| Key | Action |
|
|
421
|
+
|-----|--------|
|
|
422
|
+
| `R` | Refresh data |
|
|
423
|
+
|
|
424
|
+
---
|
|
425
|
+
|
|
426
|
+
## Testing
|
|
427
|
+
|
|
428
|
+
### Test Connection
|
|
429
|
+
|
|
430
|
+
```bash
|
|
431
|
+
# Test that Convex credentials work
|
|
432
|
+
npm test
|
|
433
|
+
# or
|
|
434
|
+
npx convex-mcp-visual --test
|
|
435
|
+
```
|
|
436
|
+
|
|
437
|
+
**Expected output:**
|
|
438
|
+
```
|
|
439
|
+
Testing Convex connection...
|
|
440
|
+
✓ Connected to: https://your-deployment.convex.cloud
|
|
441
|
+
✓ Found 5 tables: users, posts, comments, likes, sessions
|
|
442
|
+
```
|
|
443
|
+
|
|
444
|
+
### Test MCP Protocol
|
|
445
|
+
|
|
446
|
+
```bash
|
|
447
|
+
# Run in HTTP mode for debugging
|
|
448
|
+
npm run start:http
|
|
449
|
+
# Server runs on http://localhost:3001
|
|
450
|
+
|
|
451
|
+
# Test with curl
|
|
452
|
+
curl -X POST http://localhost:3001 \
|
|
453
|
+
-H "Content-Type: application/json" \
|
|
454
|
+
-d '{"jsonrpc":"2.0","method":"tools/list","id":1}'
|
|
455
|
+
```
|
|
456
|
+
|
|
457
|
+
### Debug in Claude Code
|
|
458
|
+
|
|
459
|
+
If tools aren't working:
|
|
460
|
+
1. Check `claude mcp list` shows the server
|
|
461
|
+
2. Try `claude mcp logs convex-visual` for error messages
|
|
462
|
+
3. Verify Convex credentials with `npm test`
|
|
463
|
+
|
|
464
|
+
---
|
|
465
|
+
|
|
466
|
+
## Stopping the MCP Server
|
|
467
|
+
|
|
468
|
+
MCP servers are managed by Claude Code and run as subprocesses.
|
|
469
|
+
|
|
470
|
+
### Stop Temporarily
|
|
471
|
+
|
|
472
|
+
The server stops automatically when Claude Code closes.
|
|
473
|
+
|
|
474
|
+
### Disable the Server
|
|
475
|
+
|
|
476
|
+
```bash
|
|
477
|
+
# Remove from Claude Code
|
|
478
|
+
claude mcp remove convex-visual
|
|
479
|
+
```
|
|
480
|
+
|
|
481
|
+
### Kill Running Instances
|
|
482
|
+
|
|
483
|
+
If the server gets stuck:
|
|
484
|
+
|
|
485
|
+
```bash
|
|
486
|
+
# Find the process
|
|
487
|
+
ps aux | grep convex-mcp-visual
|
|
488
|
+
|
|
489
|
+
# Kill it
|
|
490
|
+
kill <pid>
|
|
491
|
+
|
|
492
|
+
# Or kill all node MCP servers
|
|
493
|
+
pkill -f "convex-mcp-visual"
|
|
494
|
+
```
|
|
495
|
+
|
|
496
|
+
---
|
|
497
|
+
|
|
498
|
+
## Uninstalling
|
|
499
|
+
|
|
500
|
+
### Remove from Claude Code
|
|
501
|
+
|
|
502
|
+
```bash
|
|
503
|
+
claude mcp remove convex-visual
|
|
504
|
+
```
|
|
505
|
+
|
|
506
|
+
### Remove Global Package
|
|
507
|
+
|
|
508
|
+
```bash
|
|
509
|
+
npm uninstall -g convex-mcp-visual
|
|
510
|
+
```
|
|
511
|
+
|
|
512
|
+
### Remove Local Installation
|
|
513
|
+
|
|
514
|
+
```bash
|
|
515
|
+
rm -rf /path/to/convex-mcp-visual
|
|
516
|
+
```
|
|
517
|
+
|
|
518
|
+
### Logout from Convex (Optional)
|
|
519
|
+
|
|
520
|
+
```bash
|
|
521
|
+
npx convex logout
|
|
522
|
+
```
|
|
523
|
+
|
|
524
|
+
This removes `~/.convex/config.json` but doesn't affect your Convex deployment.
|
|
525
|
+
|
|
526
|
+
---
|
|
527
|
+
|
|
528
|
+
## Troubleshooting
|
|
529
|
+
|
|
530
|
+
### Server not showing in Claude Code
|
|
531
|
+
|
|
532
|
+
```bash
|
|
533
|
+
# 1. Verify the MCP server is registered
|
|
534
|
+
claude mcp list
|
|
535
|
+
|
|
536
|
+
# 2. If not listed, re-add with absolute path
|
|
537
|
+
claude mcp add convex-visual -- node /full/path/to/dist/index.js --stdio
|
|
538
|
+
|
|
539
|
+
# 3. Restart Claude Code
|
|
540
|
+
```
|
|
541
|
+
|
|
542
|
+
### "No Convex deployment configured"
|
|
543
|
+
|
|
544
|
+
```bash
|
|
545
|
+
# Login to Convex
|
|
546
|
+
npx convex login
|
|
547
|
+
|
|
548
|
+
# Or set environment variable
|
|
549
|
+
export CONVEX_URL=https://your-deployment.convex.cloud
|
|
550
|
+
```
|
|
551
|
+
|
|
552
|
+
### Browser doesn't open
|
|
553
|
+
|
|
554
|
+
- Check if port 3456 is available: `lsof -i :3456`
|
|
555
|
+
- The terminal output always works even if browser fails
|
|
556
|
+
- Try opening manually: `http://localhost:3456`
|
|
557
|
+
|
|
558
|
+
### Authentication errors
|
|
559
|
+
|
|
560
|
+
```bash
|
|
561
|
+
# Clear credentials and re-login
|
|
562
|
+
npx convex logout
|
|
563
|
+
npx convex login
|
|
564
|
+
```
|
|
565
|
+
|
|
566
|
+
### Windows users
|
|
567
|
+
|
|
568
|
+
Use cmd wrapper in Claude Code settings:
|
|
569
|
+
|
|
570
|
+
```json
|
|
571
|
+
{
|
|
572
|
+
"command": "cmd",
|
|
573
|
+
"args": ["/c", "npx", "convex-mcp-visual", "--stdio"]
|
|
574
|
+
}
|
|
575
|
+
```
|
|
576
|
+
|
|
577
|
+
### "Connection closed" errors
|
|
578
|
+
|
|
579
|
+
This usually means the server crashed. Check:
|
|
580
|
+
1. Node.js version (requires 18+)
|
|
581
|
+
2. Run `npm test` to verify credentials
|
|
582
|
+
3. Check for error output in Claude Code logs
|
|
583
|
+
|
|
584
|
+
### Canvas appears blurry
|
|
585
|
+
|
|
586
|
+
The graph view scales for retina displays. If blurry, try:
|
|
587
|
+
- Refreshing the browser
|
|
588
|
+
- Zooming to 100% with the zoom controls
|
|
589
|
+
|
|
590
|
+
---
|
|
591
|
+
|
|
592
|
+
## Development
|
|
593
|
+
|
|
594
|
+
### Build Commands
|
|
595
|
+
|
|
596
|
+
```bash
|
|
597
|
+
npm install # Install dependencies
|
|
598
|
+
npm run build # Build server + UI apps
|
|
599
|
+
npm run build:server # Build only TypeScript server
|
|
600
|
+
npm run build:apps # Build only UI apps (Vite)
|
|
601
|
+
npm run dev # Watch mode for server
|
|
602
|
+
npm run clean # Remove dist/ folder
|
|
603
|
+
```
|
|
604
|
+
|
|
605
|
+
### Environment Variables
|
|
606
|
+
|
|
607
|
+
| Variable | Purpose | Default |
|
|
608
|
+
|----------|---------|---------|
|
|
609
|
+
| `CONVEX_URL` | Override deployment URL | From ~/.convex/ |
|
|
610
|
+
| `CONVEX_DEPLOY_KEY` | Deploy key for auth | None |
|
|
611
|
+
| `MCP_TIMEOUT` | Server startup timeout | 10000ms |
|
|
612
|
+
|
|
613
|
+
---
|
|
614
|
+
|
|
615
|
+
## Security
|
|
616
|
+
|
|
617
|
+
### What Data Does This Server Access?
|
|
618
|
+
|
|
619
|
+
- **Schema information**: Table names, field types, document counts
|
|
620
|
+
- **Sample documents**: First 50 documents per table (for display)
|
|
621
|
+
- **No write access**: This tool only reads data, never modifies
|
|
622
|
+
|
|
623
|
+
### Credentials Storage
|
|
624
|
+
|
|
625
|
+
- Credentials are read from `~/.convex/` or environment variables
|
|
626
|
+
- Credentials are never logged, stored, or transmitted elsewhere
|
|
627
|
+
- The local web server only binds to `localhost` (127.0.0.1)
|
|
628
|
+
|
|
629
|
+
### Network Security
|
|
630
|
+
|
|
631
|
+
- All Convex API calls use HTTPS
|
|
632
|
+
- The local UI server (port 3456) only accepts connections from localhost
|
|
633
|
+
- No data is sent to third parties
|
|
634
|
+
|
|
635
|
+
### Production Deploy Keys
|
|
636
|
+
|
|
637
|
+
If using `CONVEX_DEPLOY_KEY`:
|
|
638
|
+
- Use read-only deploy keys when possible
|
|
639
|
+
- Never commit deploy keys to version control
|
|
640
|
+
- Use environment variables or secrets management
|
|
641
|
+
|
|
642
|
+
---
|
|
643
|
+
|
|
644
|
+
## How It Differs from Official Convex MCP
|
|
645
|
+
|
|
646
|
+
| Feature | Official `npx convex mcp` | This Project |
|
|
647
|
+
|---------|---------------------------|--------------|
|
|
648
|
+
| Output | Text/JSON for AI | Visual browser UI |
|
|
649
|
+
| Purpose | AI coding assistant | Human exploration |
|
|
650
|
+
| Schema view | Text tables | Interactive graph diagram |
|
|
651
|
+
| Documents | JSON output | Paginated table browser |
|
|
652
|
+
| Dashboard | None | Real-time charts |
|
|
653
|
+
| Dark mode | No | Yes (VS Code style) |
|
|
654
|
+
|
|
655
|
+
**Use the official Convex MCP** for AI-assisted coding tasks.
|
|
656
|
+
**Use this project** when you want to visually explore your database.
|
|
657
|
+
|
|
658
|
+
---
|
|
659
|
+
|
|
660
|
+
## Why This Project Exists
|
|
661
|
+
|
|
662
|
+
### The Problem
|
|
663
|
+
|
|
664
|
+
When working with Convex databases, developers often need to:
|
|
665
|
+
- Quickly visualize table relationships and schema structure
|
|
666
|
+
- Browse documents without writing queries
|
|
667
|
+
- Understand how data flows between tables
|
|
668
|
+
- Get a high-level overview before diving into code
|
|
669
|
+
|
|
670
|
+
The official `npx convex mcp` is optimized for AI-assisted coding—it returns structured text that Claude can parse and use to help you write code. But humans often want to *see* their data visually.
|
|
671
|
+
|
|
672
|
+
### The Solution
|
|
673
|
+
|
|
674
|
+
This project bridges that gap by providing:
|
|
675
|
+
- **Visual schema diagrams** that show relationships at a glance
|
|
676
|
+
- **Interactive exploration** with drag, pan, and zoom
|
|
677
|
+
- **Real-time dashboards** for monitoring data
|
|
678
|
+
- **Dual output** so Claude still gets structured data while you get visuals
|
|
679
|
+
|
|
680
|
+
---
|
|
681
|
+
|
|
682
|
+
## Current Limitations
|
|
683
|
+
|
|
684
|
+
### What's Not Yet Supported
|
|
685
|
+
|
|
686
|
+
| Feature | Status | Notes |
|
|
687
|
+
|---------|--------|-------|
|
|
688
|
+
| Write operations | Not planned | Read-only by design for safety |
|
|
689
|
+
| Custom queries | Not implemented | Would require query builder UI |
|
|
690
|
+
| Real-time subscriptions | Partial | Dashboard refreshes on interval, not live |
|
|
691
|
+
| Multiple deployments | Manual | Must switch via env vars or re-login |
|
|
692
|
+
| Schema editing | Not planned | Use Convex dashboard for schema changes |
|
|
693
|
+
| Index visualization | Partial | Shows index names, not full definitions |
|
|
694
|
+
| Function introspection | Not implemented | Would show Convex functions |
|
|
695
|
+
|
|
696
|
+
### Known Issues
|
|
697
|
+
|
|
698
|
+
- **Large schemas**: Performance may degrade with 50+ tables
|
|
699
|
+
- **Complex relationships**: Only detects `Id<"table">` patterns, not custom references
|
|
700
|
+
- **Browser popup blockers**: May need to allow popups for localhost:3456
|
|
701
|
+
|
|
702
|
+
---
|
|
703
|
+
|
|
704
|
+
## Wishlist & Future Plans
|
|
705
|
+
|
|
706
|
+
### Short-Term (Next Release)
|
|
707
|
+
|
|
708
|
+
- [ ] **Export schema as image** - PNG/SVG export of graph view
|
|
709
|
+
- [ ] **Query builder** - Visual interface to build simple queries
|
|
710
|
+
- [ ] **Improved relationship detection** - Detect array references, nested IDs
|
|
711
|
+
- [ ] **Table statistics** - Show min/max/avg for numeric fields
|
|
712
|
+
- [ ] **Search within documents** - Full-text search across all tables
|
|
713
|
+
|
|
714
|
+
### Medium-Term
|
|
715
|
+
|
|
716
|
+
- [ ] **Schema diff view** - Compare schema between environments
|
|
717
|
+
- [ ] **Data sampling** - Statistical overview of field values
|
|
718
|
+
- [ ] **Relationship path finder** - Show how two tables connect
|
|
719
|
+
- [ ] **Custom themes** - User-defined color schemes
|
|
720
|
+
- [ ] **Bookmarks** - Save frequently accessed tables/views
|
|
721
|
+
|
|
722
|
+
### Long-Term Vision
|
|
723
|
+
|
|
724
|
+
- [ ] **Claude.ai web integration** (see below)
|
|
725
|
+
- [ ] **Collaborative viewing** - Share schema view with team
|
|
726
|
+
- [ ] **Schema history** - Track schema changes over time
|
|
727
|
+
- [ ] **AI-powered insights** - Claude analyzes schema and suggests optimizations
|
|
728
|
+
|
|
729
|
+
---
|
|
730
|
+
|
|
731
|
+
## Claude.ai Web Integration (Future)
|
|
732
|
+
|
|
733
|
+
### Current State
|
|
734
|
+
|
|
735
|
+
This MCP server currently works with:
|
|
736
|
+
- **Claude Code (CLI)** - Full support via stdio
|
|
737
|
+
- **Claude Desktop** - Full support via MCP configuration
|
|
738
|
+
- **Any MCP client** - Standard MCP protocol
|
|
739
|
+
|
|
740
|
+
It does **not** yet work with:
|
|
741
|
+
- **Claude.ai (web)** - Browser-based Claude at claude.ai
|
|
742
|
+
|
|
743
|
+
### Why It Doesn't Work on Claude.ai Web (Yet)
|
|
744
|
+
|
|
745
|
+
MCP servers run as local processes that communicate via stdio or HTTP. The Claude.ai web interface runs in a browser sandbox and cannot:
|
|
746
|
+
1. Spawn local processes
|
|
747
|
+
2. Access localhost servers
|
|
748
|
+
3. Read local files (~/.convex/)
|
|
749
|
+
|
|
750
|
+
### How It Could Work in the Future
|
|
751
|
+
|
|
752
|
+
Several approaches are being explored in the MCP ecosystem:
|
|
753
|
+
|
|
754
|
+
#### Option 1: MCP Gateway Service
|
|
755
|
+
```
|
|
756
|
+
Claude.ai (web) → MCP Gateway (cloud) → Your local MCP server
|
|
757
|
+
↑
|
|
758
|
+
Authenticated tunnel
|
|
759
|
+
```
|
|
760
|
+
|
|
761
|
+
A cloud gateway that securely proxies MCP requests to your local server. This would require:
|
|
762
|
+
- Secure authentication (OAuth, API keys)
|
|
763
|
+
- Tunnel software running locally
|
|
764
|
+
- Trust model for cloud proxy
|
|
765
|
+
|
|
766
|
+
#### Option 2: Browser Extension
|
|
767
|
+
```
|
|
768
|
+
Claude.ai (web) → Browser Extension → Local MCP server
|
|
769
|
+
```
|
|
770
|
+
|
|
771
|
+
A Chrome/Firefox extension that:
|
|
772
|
+
- Intercepts MCP tool requests from Claude.ai
|
|
773
|
+
- Routes them to localhost MCP servers
|
|
774
|
+
- Returns results to the web page
|
|
775
|
+
|
|
776
|
+
#### Option 3: Convex-Hosted MCP
|
|
777
|
+
```
|
|
778
|
+
Claude.ai (web) → Convex Cloud MCP endpoint
|
|
779
|
+
↓
|
|
780
|
+
Your Convex deployment
|
|
781
|
+
```
|
|
782
|
+
|
|
783
|
+
Convex could host MCP endpoints directly, eliminating the need for local servers. This would require:
|
|
784
|
+
- Convex adding MCP protocol support
|
|
785
|
+
- Authentication via Convex dashboard
|
|
786
|
+
- No local installation needed
|
|
787
|
+
|
|
788
|
+
#### Option 4: Claude.ai Native MCP Support
|
|
789
|
+
|
|
790
|
+
Anthropic could add native MCP support to Claude.ai with:
|
|
791
|
+
- Secure server registration in account settings
|
|
792
|
+
- OAuth-based authentication to your servers
|
|
793
|
+
- Sandboxed execution environment
|
|
794
|
+
|
|
795
|
+
### What You Can Do Now
|
|
796
|
+
|
|
797
|
+
1. **Use Claude Code CLI** - Full MCP support today
|
|
798
|
+
2. **Use Claude Desktop** - Configure MCP in settings
|
|
799
|
+
3. **Watch for updates** - MCP ecosystem is evolving rapidly
|
|
800
|
+
4. **Star the repo** - Show interest in web integration
|
|
801
|
+
|
|
802
|
+
### Preparing for Web Support
|
|
803
|
+
|
|
804
|
+
When web integration becomes available, this project is designed to be ready:
|
|
805
|
+
|
|
806
|
+
- **Stateless design**: Each request is independent
|
|
807
|
+
- **HTTP mode**: Already supports HTTP transport (`--http` flag)
|
|
808
|
+
- **Standard MCP**: Uses official MCP SDK
|
|
809
|
+
- **No local file requirements**: Can work with `CONVEX_DEPLOY_KEY` env var
|
|
810
|
+
|
|
811
|
+
---
|
|
812
|
+
|
|
813
|
+
## Contributing
|
|
814
|
+
|
|
815
|
+
### Areas Where Help Is Needed
|
|
816
|
+
|
|
817
|
+
1. **Testing on Windows** - Verify cmd wrapper works correctly
|
|
818
|
+
2. **Performance optimization** - Large schema handling
|
|
819
|
+
3. **Accessibility** - Keyboard navigation, screen reader support
|
|
820
|
+
4. **Documentation** - More examples, video tutorials
|
|
821
|
+
5. **UI polish** - Animations, transitions, edge cases
|
|
822
|
+
|
|
823
|
+
### Development Setup
|
|
824
|
+
|
|
825
|
+
```bash
|
|
826
|
+
git clone https://github.com/your-username/convex-mcp-visual.git
|
|
827
|
+
cd convex-mcp-visual
|
|
828
|
+
npm install
|
|
829
|
+
npm run dev # Watch mode
|
|
830
|
+
```
|
|
831
|
+
|
|
832
|
+
### Submitting Changes
|
|
833
|
+
|
|
834
|
+
1. Fork the repository
|
|
835
|
+
2. Create a feature branch
|
|
836
|
+
3. Make your changes
|
|
837
|
+
4. Run `npm run build` to verify
|
|
838
|
+
5. Submit a pull request
|
|
839
|
+
|
|
840
|
+
---
|
|
841
|
+
|
|
842
|
+
## License
|
|
843
|
+
|
|
844
|
+
MIT
|