@hellocrossman/mcp-sdk 0.1.2 → 0.3.1
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 +99 -28
- package/dist/cjs/cli.d.ts +3 -0
- package/dist/cjs/cli.d.ts.map +1 -0
- package/dist/cjs/cli.js +610 -0
- package/dist/cjs/cli.js.map +1 -0
- package/dist/cjs/db-executor.d.ts +4 -0
- package/dist/cjs/db-executor.d.ts.map +1 -0
- package/dist/cjs/db-executor.js +152 -0
- package/dist/cjs/db-executor.js.map +1 -0
- package/dist/cjs/db-introspect.d.ts +18 -0
- package/dist/cjs/db-introspect.d.ts.map +1 -0
- package/dist/cjs/db-introspect.js +145 -0
- package/dist/cjs/db-introspect.js.map +1 -0
- package/dist/cjs/db-tool-generator.d.ts +9 -0
- package/dist/cjs/db-tool-generator.d.ts.map +1 -0
- package/dist/cjs/db-tool-generator.js +167 -0
- package/dist/cjs/db-tool-generator.js.map +1 -0
- package/dist/cjs/enrichment.d.ts +13 -0
- package/dist/cjs/enrichment.d.ts.map +1 -0
- package/dist/cjs/enrichment.js +36 -0
- package/dist/cjs/enrichment.js.map +1 -0
- package/dist/cjs/index.d.ts +2 -0
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +4 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/introspect.d.ts.map +1 -1
- package/dist/cjs/introspect.js +10 -4
- package/dist/cjs/introspect.js.map +1 -1
- package/dist/cjs/route-scan.d.ts +9 -0
- package/dist/cjs/route-scan.d.ts.map +1 -0
- package/dist/cjs/route-scan.js +140 -0
- package/dist/cjs/route-scan.js.map +1 -0
- package/dist/cjs/server.d.ts +1 -0
- package/dist/cjs/server.d.ts.map +1 -1
- package/dist/cjs/server.js +113 -15
- package/dist/cjs/server.js.map +1 -1
- package/dist/cjs/types.d.ts +6 -0
- package/dist/cjs/types.d.ts.map +1 -1
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +582 -0
- package/dist/cli.js.map +1 -0
- package/dist/db-executor.d.ts +4 -0
- package/dist/db-executor.d.ts.map +1 -0
- package/dist/db-executor.js +125 -0
- package/dist/db-executor.js.map +1 -0
- package/dist/db-introspect.d.ts +18 -0
- package/dist/db-introspect.d.ts.map +1 -0
- package/dist/db-introspect.js +118 -0
- package/dist/db-introspect.js.map +1 -0
- package/dist/db-tool-generator.d.ts +9 -0
- package/dist/db-tool-generator.d.ts.map +1 -0
- package/dist/db-tool-generator.js +163 -0
- package/dist/db-tool-generator.js.map +1 -0
- package/dist/enrichment.d.ts +13 -0
- package/dist/enrichment.d.ts.map +1 -0
- package/dist/enrichment.js +33 -0
- package/dist/enrichment.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/introspect.d.ts.map +1 -1
- package/dist/introspect.js +10 -4
- package/dist/introspect.js.map +1 -1
- package/dist/route-scan.d.ts +9 -0
- package/dist/route-scan.d.ts.map +1 -0
- package/dist/route-scan.js +133 -0
- package/dist/route-scan.js.map +1 -0
- package/dist/server.d.ts +1 -0
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +113 -15
- package/dist/server.js.map +1 -1
- package/dist/types.d.ts +6 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +13 -3
package/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# @hellocrossman/mcp-sdk
|
|
2
2
|
|
|
3
|
-
Turn your Express API into an MCP server with
|
|
3
|
+
Turn your Express API into an MCP server with zero configuration.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Auto-discovers your routes, database tables, and generates AI-enhanced tools so your customers can access your business data through AI assistants (Claude, ChatGPT, Cursor).
|
|
6
6
|
|
|
7
7
|
## Install
|
|
8
8
|
|
|
@@ -10,7 +10,15 @@ Your customers can access your business data and logic through AI assistants (Cl
|
|
|
10
10
|
npm install @hellocrossman/mcp-sdk
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
##
|
|
13
|
+
## Zero-Config Setup
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npx @hellocrossman/mcp-sdk init
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
This automatically finds your Express app file, adds the MCP setup, and you're done. Restart your app and visit `/mcp` to see your tools.
|
|
20
|
+
|
|
21
|
+
## Manual Setup
|
|
14
22
|
|
|
15
23
|
```typescript
|
|
16
24
|
import express from 'express';
|
|
@@ -21,7 +29,6 @@ const app = express();
|
|
|
21
29
|
// Your existing routes
|
|
22
30
|
app.get('/api/customers', (req, res) => { /* ... */ });
|
|
23
31
|
app.post('/api/orders', (req, res) => { /* ... */ });
|
|
24
|
-
app.get('/api/orders/:id', (req, res) => { /* ... */ });
|
|
25
32
|
|
|
26
33
|
// Add MCP in one line
|
|
27
34
|
createMcpServer({ app });
|
|
@@ -29,14 +36,55 @@ createMcpServer({ app });
|
|
|
29
36
|
app.listen(3000);
|
|
30
37
|
```
|
|
31
38
|
|
|
32
|
-
|
|
39
|
+
## What Gets Discovered
|
|
40
|
+
|
|
41
|
+
The SDK automatically finds and exposes:
|
|
42
|
+
|
|
43
|
+
### Express Routes
|
|
44
|
+
Every API route becomes a callable tool:
|
|
45
|
+
|
|
46
|
+
| HTTP Method | Tool Name Example | Description |
|
|
47
|
+
|---|---|---|
|
|
48
|
+
| GET | `get_customers_by_id` | Fetches a record by ID |
|
|
49
|
+
| POST | `create_orders` | Creates a new record |
|
|
50
|
+
| PUT/PATCH | `update_orders_by_id` | Updates a record |
|
|
51
|
+
| DELETE | `delete_orders_by_id` | Deletes a record |
|
|
33
52
|
|
|
34
|
-
|
|
53
|
+
### Database Tables
|
|
54
|
+
If `DATABASE_URL` is in your environment (PostgreSQL), the SDK auto-discovers every table and generates tools:
|
|
35
55
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
56
|
+
- **`list_<table>`** -- Query all records with filtering and pagination
|
|
57
|
+
- **`get_<table>_by_id`** -- Fetch a single record by primary key
|
|
58
|
+
|
|
59
|
+
No extra configuration needed. The SDK detects the database connection from your environment variables automatically.
|
|
60
|
+
|
|
61
|
+
### Smart Security
|
|
62
|
+
Sensitive tables are **auto-hidden** by default:
|
|
63
|
+
- `users`, `accounts`, `sessions`, `tokens`, `passwords`, `api_keys`, `migrations`
|
|
64
|
+
|
|
65
|
+
Sensitive columns are redacted in query results:
|
|
66
|
+
- `password`, `password_hash`, `secret`, `api_key`, `access_token`, `credit_card`
|
|
67
|
+
|
|
68
|
+
### AI-Enhanced Descriptions
|
|
69
|
+
Tool names and descriptions are automatically enriched by AI to be clear and business-oriented. Instead of `list_scans`, you get `browse_scan_history` with a description like "Retrieve all scan records to review analysis results and status."
|
|
70
|
+
|
|
71
|
+
## Discovery Report
|
|
72
|
+
|
|
73
|
+
On startup, you'll see a clean summary in your console:
|
|
74
|
+
|
|
75
|
+
```
|
|
76
|
+
[mcp-sdk] ---- Discovery Report ----
|
|
77
|
+
[mcp-sdk] Express routes: 4 found, 4 tools generated
|
|
78
|
+
[mcp-sdk] + create_scans (POST /api/scans)
|
|
79
|
+
[mcp-sdk] + get_scan_details (GET /api/scans/:id)
|
|
80
|
+
[mcp-sdk] Database: 8 tables found, 12 tools generated
|
|
81
|
+
[mcp-sdk] + list_roadmap_items (DB_QUERY)
|
|
82
|
+
[mcp-sdk] + get_feature_details (DB_QUERY)
|
|
83
|
+
[mcp-sdk] Auto-hidden (sensitive): users, sessions
|
|
84
|
+
[mcp-sdk] AI enrichment: applied
|
|
85
|
+
[mcp-sdk] Total tools: 16
|
|
86
|
+
[mcp-sdk] ----------------------------
|
|
87
|
+
```
|
|
40
88
|
|
|
41
89
|
## Options
|
|
42
90
|
|
|
@@ -44,35 +92,57 @@ That's it. Visit `localhost:3000/mcp` to see your auto-discovered tools.
|
|
|
44
92
|
createMcpServer({
|
|
45
93
|
app, // Your Express app (required)
|
|
46
94
|
path: '/mcp', // MCP endpoint path (default: '/mcp')
|
|
47
|
-
name: 'my-app', // Server name shown to AI clients
|
|
48
|
-
version: '1.0.0', // Server version
|
|
95
|
+
name: 'my-app', // Server name shown to AI clients
|
|
96
|
+
version: '1.0.0', // Server version
|
|
49
97
|
description: 'My MCP server', // Server description
|
|
50
|
-
routePrefix: '/api', // Only expose routes starting with this
|
|
51
|
-
excludeRoutes: ['/api/admin/*'], // Hide specific routes (supports
|
|
98
|
+
routePrefix: '/api', // Only expose routes starting with this
|
|
99
|
+
excludeRoutes: ['/api/admin/*'], // Hide specific routes (supports wildcards)
|
|
100
|
+
|
|
101
|
+
// Database options
|
|
102
|
+
database: true, // Auto-detect database (default: true)
|
|
103
|
+
excludeTables: ['internal_logs'], // Hide specific tables
|
|
104
|
+
includeTables: ['products'], // Only expose these tables (overrides exclude)
|
|
105
|
+
includeWrites: false, // Generate create tools for tables (default: false)
|
|
106
|
+
|
|
107
|
+
// AI enrichment
|
|
108
|
+
enrichment: true, // Auto-enrich tool descriptions (default: true)
|
|
52
109
|
});
|
|
53
110
|
```
|
|
54
111
|
|
|
55
|
-
## What
|
|
112
|
+
## Controlling What's Exposed
|
|
113
|
+
|
|
114
|
+
**Hide specific tables:**
|
|
115
|
+
```typescript
|
|
116
|
+
createMcpServer({ app, excludeTables: ['internal_logs', 'analytics'] });
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
**Only expose specific tables:**
|
|
120
|
+
```typescript
|
|
121
|
+
createMcpServer({ app, includeTables: ['products', 'orders'] });
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
**Enable write operations:**
|
|
125
|
+
```typescript
|
|
126
|
+
createMcpServer({ app, includeWrites: true });
|
|
127
|
+
```
|
|
56
128
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
| PUT/PATCH | `update_` | `/api/orders/:id` | `update_orders_by_id` |
|
|
62
|
-
| DELETE | `delete_` | `/api/orders/:id` | `delete_orders_by_id` |
|
|
129
|
+
**Disable database discovery:**
|
|
130
|
+
```typescript
|
|
131
|
+
createMcpServer({ app, database: false });
|
|
132
|
+
```
|
|
63
133
|
|
|
64
134
|
## Security
|
|
65
135
|
|
|
66
136
|
- Only routes matching `routePrefix` are exposed (default: `/api`)
|
|
67
|
-
-
|
|
68
|
-
-
|
|
69
|
-
-
|
|
137
|
+
- Sensitive tables are auto-hidden (users, sessions, tokens, migrations, etc.)
|
|
138
|
+
- Sensitive columns are redacted in all query results
|
|
139
|
+
- Database tools are read-only by default (opt-in for writes)
|
|
140
|
+
- Route-based tools go through your existing Express middleware (auth, rate limiting, validation)
|
|
141
|
+
- Use `excludeRoutes` and `excludeTables` for additional control
|
|
70
142
|
|
|
71
143
|
## Connecting AI Clients
|
|
72
144
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
**Claude Desktop** -- Add to your MCP settings:
|
|
145
|
+
**Claude Desktop:**
|
|
76
146
|
```json
|
|
77
147
|
{
|
|
78
148
|
"mcpServers": {
|
|
@@ -83,13 +153,14 @@ Once your MCP server is running, AI assistants can connect to it:
|
|
|
83
153
|
}
|
|
84
154
|
```
|
|
85
155
|
|
|
86
|
-
**Cursor
|
|
156
|
+
**Cursor:** Add the MCP server URL in Cursor settings under MCP Servers.
|
|
87
157
|
|
|
88
158
|
## Requirements
|
|
89
159
|
|
|
90
160
|
- Node.js >= 18
|
|
91
161
|
- Express >= 4
|
|
92
162
|
- Zod >= 3
|
|
163
|
+
- pg >= 8 (optional, for database discovery)
|
|
93
164
|
|
|
94
165
|
## License
|
|
95
166
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/cli.ts"],"names":[],"mappings":""}
|