@netpad/mcp-server 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/CHANGELOG.md +62 -0
- package/README.md +258 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +17396 -0
- package/dist/index.js.map +1 -0
- package/package.json +62 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [0.1.0] - 2025-01-03
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
#### Form Building Tools (6 tools)
|
|
13
|
+
- `generate_form` - Generate complete form configurations from natural language descriptions
|
|
14
|
+
- `generate_field` - Generate individual field configurations with validation
|
|
15
|
+
- `generate_conditional_logic` - Create show/hide logic based on field values
|
|
16
|
+
- `generate_computed_field` - Create formula-based calculated fields
|
|
17
|
+
- `generate_multipage_config` - Generate multi-page wizard configurations
|
|
18
|
+
- `validate_form_config` - Validate form configurations for errors
|
|
19
|
+
|
|
20
|
+
#### Application Building Tools (5 tools)
|
|
21
|
+
- `scaffold_nextjs_app` - Generate complete Next.js applications with forms
|
|
22
|
+
- `generate_workflow_integration` - Generate workflow integration code (MongoDB, notifications, pipelines)
|
|
23
|
+
- `generate_mongodb_query` - Generate MongoDB queries for form data
|
|
24
|
+
- `generate_api_route` - Generate Next.js API routes
|
|
25
|
+
- `generate_react_code` - Generate React components for forms
|
|
26
|
+
|
|
27
|
+
#### Reference Tools (5 tools)
|
|
28
|
+
- `list_field_types` - List all 28+ supported field types
|
|
29
|
+
- `list_operators` - List conditional logic operators
|
|
30
|
+
- `list_formula_functions` - List formula functions for computed fields
|
|
31
|
+
- `list_validation_options` - List validation rule options
|
|
32
|
+
- `list_theme_options` - List theme customization options
|
|
33
|
+
|
|
34
|
+
#### Helper Tools (6 tools)
|
|
35
|
+
- `get_use_case_template` - Pre-built templates (leadCapture, eventRegistration, feedbackSurvey)
|
|
36
|
+
- `suggest_form_fields` - Field recommendations based on use case and industry
|
|
37
|
+
- `get_best_practices` - Best practices for form design, workflows, security, troubleshooting
|
|
38
|
+
- `debug_form_config` - Analyze form configurations for issues
|
|
39
|
+
- `explain_error` - Explain error codes with solutions
|
|
40
|
+
- `get_documentation` - Access embedded documentation
|
|
41
|
+
|
|
42
|
+
#### Resources (7 resources)
|
|
43
|
+
- `netpad://docs/readme` - Main documentation
|
|
44
|
+
- `netpad://docs/architecture` - Architecture guide
|
|
45
|
+
- `netpad://docs/quick-start` - Quick start guide
|
|
46
|
+
- `netpad://docs/examples` - Code examples
|
|
47
|
+
- `netpad://reference/field-types` - Field type reference
|
|
48
|
+
- `netpad://reference/operators` - Operator reference
|
|
49
|
+
- `netpad://reference/formulas` - Formula function reference
|
|
50
|
+
|
|
51
|
+
#### Prompts (5 prompts)
|
|
52
|
+
- `create-contact-form` - Generate a basic contact form
|
|
53
|
+
- `create-registration-form` - Generate a user registration form
|
|
54
|
+
- `create-survey-form` - Generate a multi-page survey
|
|
55
|
+
- `create-order-form` - Generate an order form with computed totals
|
|
56
|
+
- `explain-conditional-logic` - Explain conditional logic usage
|
|
57
|
+
|
|
58
|
+
### Technical Details
|
|
59
|
+
- Built with TypeScript and tsup
|
|
60
|
+
- Uses @modelcontextprotocol/sdk v1.0.0
|
|
61
|
+
- Requires Node.js 18+
|
|
62
|
+
- Supports Claude Desktop, Cursor, and other MCP-compatible clients
|
package/README.md
ADDED
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
# @netpad/mcp-server
|
|
2
|
+
|
|
3
|
+
An MCP (Model Context Protocol) server that helps developers build form applications with [@netpad/forms](https://www.npmjs.com/package/@netpad/forms) and the NetPad platform.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
### Form Building
|
|
8
|
+
- **Form Generation**: Generate complete form configurations from natural language descriptions
|
|
9
|
+
- **Field Configuration**: Create individual field configs with validation, conditional logic, and computed fields
|
|
10
|
+
- **Multi-Page Wizards**: Generate step-by-step form configurations
|
|
11
|
+
- **Validation**: Configure and validate form schemas
|
|
12
|
+
|
|
13
|
+
### Application Development
|
|
14
|
+
- **Next.js Scaffolding**: Generate complete Next.js applications with forms
|
|
15
|
+
- **Workflow Integration**: Connect forms to NetPad workflows for processing
|
|
16
|
+
- **MongoDB Queries**: Generate queries for form submission data
|
|
17
|
+
- **API Routes**: Generate Next.js API routes for form operations
|
|
18
|
+
|
|
19
|
+
### Developer Experience
|
|
20
|
+
- **Use Case Templates**: Pre-built templates for common form types
|
|
21
|
+
- **Field Suggestions**: Get recommended fields for your use case
|
|
22
|
+
- **Best Practices**: Access guidelines for form design, security, and workflows
|
|
23
|
+
- **Error Debugging**: Explain errors and get solutions
|
|
24
|
+
- **Documentation**: Embedded docs and examples
|
|
25
|
+
|
|
26
|
+
## Installation
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
npm install @netpad/mcp-server
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Or install globally:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
npm install -g @netpad/mcp-server
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Usage with Claude Desktop
|
|
39
|
+
|
|
40
|
+
Add to `~/Library/Application Support/Claude/claude_desktop_config.json`:
|
|
41
|
+
|
|
42
|
+
```json
|
|
43
|
+
{
|
|
44
|
+
"mcpServers": {
|
|
45
|
+
"netpad-forms": {
|
|
46
|
+
"command": "npx",
|
|
47
|
+
"args": ["@netpad/mcp-server"]
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Usage with Cursor
|
|
54
|
+
|
|
55
|
+
Add to `~/.cursor/mcp.json`:
|
|
56
|
+
|
|
57
|
+
```json
|
|
58
|
+
{
|
|
59
|
+
"mcpServers": {
|
|
60
|
+
"netpad-forms": {
|
|
61
|
+
"command": "npx",
|
|
62
|
+
"args": ["@netpad/mcp-server"]
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Available Tools (22 total)
|
|
69
|
+
|
|
70
|
+
### Form Building Tools
|
|
71
|
+
|
|
72
|
+
| Tool | Description |
|
|
73
|
+
|------|-------------|
|
|
74
|
+
| `generate_form` | Generate a complete form from a natural language description |
|
|
75
|
+
| `generate_field` | Generate a single field configuration |
|
|
76
|
+
| `generate_conditional_logic` | Create show/hide logic for fields |
|
|
77
|
+
| `generate_computed_field` | Create formula-based calculated fields |
|
|
78
|
+
| `generate_multipage_config` | Generate multi-page wizard configuration |
|
|
79
|
+
| `validate_form_config` | Validate a form configuration |
|
|
80
|
+
|
|
81
|
+
### Application Building Tools
|
|
82
|
+
|
|
83
|
+
| Tool | Description |
|
|
84
|
+
|------|-------------|
|
|
85
|
+
| `scaffold_nextjs_app` | Generate a complete Next.js application with forms |
|
|
86
|
+
| `generate_workflow_integration` | Generate workflow integration code |
|
|
87
|
+
| `generate_mongodb_query` | Generate MongoDB queries for form data |
|
|
88
|
+
| `generate_api_route` | Generate Next.js API routes |
|
|
89
|
+
| `generate_react_code` | Generate React components for forms |
|
|
90
|
+
|
|
91
|
+
### Reference Tools
|
|
92
|
+
|
|
93
|
+
| Tool | Description |
|
|
94
|
+
|------|-------------|
|
|
95
|
+
| `list_field_types` | List all 28+ supported field types |
|
|
96
|
+
| `list_operators` | List conditional logic operators |
|
|
97
|
+
| `list_formula_functions` | List formula functions for computed fields |
|
|
98
|
+
| `list_validation_options` | List validation rule options |
|
|
99
|
+
| `list_theme_options` | List theme customization options |
|
|
100
|
+
|
|
101
|
+
### Helper Tools
|
|
102
|
+
|
|
103
|
+
| Tool | Description |
|
|
104
|
+
|------|-------------|
|
|
105
|
+
| `get_use_case_template` | Get pre-built templates (leadCapture, eventRegistration, feedbackSurvey) |
|
|
106
|
+
| `suggest_form_fields` | Get field recommendations for your use case |
|
|
107
|
+
| `get_best_practices` | Get best practices (formDesign, workflowPatterns, securityGuidelines, troubleshooting) |
|
|
108
|
+
| `debug_form_config` | Analyze form configuration for issues |
|
|
109
|
+
| `explain_error` | Explain error codes and provide solutions |
|
|
110
|
+
| `get_documentation` | Access documentation topics |
|
|
111
|
+
|
|
112
|
+
## Example Interactions
|
|
113
|
+
|
|
114
|
+
### Create a Form from Description
|
|
115
|
+
|
|
116
|
+
```
|
|
117
|
+
User: Create a lead capture form for a SaaS product
|
|
118
|
+
|
|
119
|
+
Claude: [Uses generate_form and suggest_form_fields tools]
|
|
120
|
+
Here's your lead capture form with recommended fields for SaaS:
|
|
121
|
+
- First Name, Last Name, Work Email, Company, Job Title
|
|
122
|
+
- Company Size dropdown
|
|
123
|
+
- Interest checkboxes (Demo, Pricing, Docs, Partnership)
|
|
124
|
+
- Message field
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### Generate a Complete Application
|
|
128
|
+
|
|
129
|
+
```
|
|
130
|
+
User: Scaffold a Next.js app for this contact form
|
|
131
|
+
|
|
132
|
+
Claude: [Uses scaffold_nextjs_app tool]
|
|
133
|
+
Here's your complete Next.js application:
|
|
134
|
+
- package.json with all dependencies
|
|
135
|
+
- Form page component with submission handling
|
|
136
|
+
- Layout with Material-UI theming
|
|
137
|
+
- Environment variable template
|
|
138
|
+
- Setup instructions
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### Connect Form to Workflow
|
|
142
|
+
|
|
143
|
+
```
|
|
144
|
+
User: I want to save form submissions to MongoDB and send a notification email
|
|
145
|
+
|
|
146
|
+
Claude: [Uses generate_workflow_integration with 'full_pipeline' type]
|
|
147
|
+
Here's the integration code:
|
|
148
|
+
- NetPad client setup
|
|
149
|
+
- Form submission handler
|
|
150
|
+
- Workflow trigger with payload
|
|
151
|
+
- Status polling and error handling
|
|
152
|
+
- Example workflow configuration
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
### Debug a Form Issue
|
|
156
|
+
|
|
157
|
+
```
|
|
158
|
+
User: I'm getting a 401 error when submitting the form
|
|
159
|
+
|
|
160
|
+
Claude: [Uses explain_error tool]
|
|
161
|
+
## Error: 401
|
|
162
|
+
|
|
163
|
+
**Explanation:** Authentication failed. The API key is missing, invalid, or expired.
|
|
164
|
+
|
|
165
|
+
**Solutions:**
|
|
166
|
+
1. Verify your API key is correct in environment variables
|
|
167
|
+
2. Check that the key starts with np_live_ or np_test_
|
|
168
|
+
3. Ensure the key has not been revoked in the NetPad dashboard
|
|
169
|
+
4. For test environments, use np_test_ prefixed keys
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
### Get Field Suggestions
|
|
173
|
+
|
|
174
|
+
```
|
|
175
|
+
User: What fields should I include for a healthcare appointment form?
|
|
176
|
+
|
|
177
|
+
Claude: [Uses suggest_form_fields with industry: 'healthcare']
|
|
178
|
+
Recommended fields:
|
|
179
|
+
- Patient name, email, phone
|
|
180
|
+
- Date of birth, insurance info
|
|
181
|
+
- Preferred appointment date/time
|
|
182
|
+
- Reason for visit
|
|
183
|
+
|
|
184
|
+
Tips:
|
|
185
|
+
- Ensure HIPAA compliance for health data
|
|
186
|
+
- Add clear consent checkboxes for data usage
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
## Available Prompts
|
|
190
|
+
|
|
191
|
+
Pre-built prompts for common form types:
|
|
192
|
+
|
|
193
|
+
| Prompt | Description |
|
|
194
|
+
|--------|-------------|
|
|
195
|
+
| `create-contact-form` | Generate a basic contact form |
|
|
196
|
+
| `create-registration-form` | Generate a user registration form |
|
|
197
|
+
| `create-survey-form` | Generate a multi-page survey |
|
|
198
|
+
| `create-order-form` | Generate an order form with computed totals |
|
|
199
|
+
| `explain-conditional-logic` | Explain how conditional logic works |
|
|
200
|
+
|
|
201
|
+
## Resources
|
|
202
|
+
|
|
203
|
+
The server exposes documentation as MCP resources:
|
|
204
|
+
|
|
205
|
+
- `netpad://docs/readme` - Main documentation
|
|
206
|
+
- `netpad://docs/architecture` - Architecture guide
|
|
207
|
+
- `netpad://docs/quick-start` - Quick start guide
|
|
208
|
+
- `netpad://docs/examples` - Code examples
|
|
209
|
+
- `netpad://reference/field-types` - Field type reference
|
|
210
|
+
- `netpad://reference/operators` - Operator reference
|
|
211
|
+
- `netpad://reference/formulas` - Formula function reference
|
|
212
|
+
|
|
213
|
+
## Development
|
|
214
|
+
|
|
215
|
+
```bash
|
|
216
|
+
# Install dependencies
|
|
217
|
+
npm install
|
|
218
|
+
|
|
219
|
+
# Build
|
|
220
|
+
npm run build
|
|
221
|
+
|
|
222
|
+
# Watch mode
|
|
223
|
+
npm run dev
|
|
224
|
+
|
|
225
|
+
# Type check
|
|
226
|
+
npm run typecheck
|
|
227
|
+
|
|
228
|
+
# Start the server
|
|
229
|
+
npm start
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
## Testing
|
|
233
|
+
|
|
234
|
+
Use the MCP Inspector to test the server:
|
|
235
|
+
|
|
236
|
+
```bash
|
|
237
|
+
npx @modelcontextprotocol/inspector node dist/index.js
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
Or test via command line:
|
|
241
|
+
|
|
242
|
+
```bash
|
|
243
|
+
# List all tools
|
|
244
|
+
echo '{"jsonrpc":"2.0","id":1,"method":"tools/list"}' | node dist/index.js
|
|
245
|
+
|
|
246
|
+
# Call a tool
|
|
247
|
+
echo '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"list_field_types","arguments":{"category":"text"}}}' | node dist/index.js
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
## Related Packages
|
|
251
|
+
|
|
252
|
+
- [@netpad/forms](https://www.npmjs.com/package/@netpad/forms) - React form renderer library
|
|
253
|
+
- [@netpad/workflows](https://www.npmjs.com/package/@netpad/workflows) - Workflow automation client
|
|
254
|
+
- [NetPad Platform](https://netpad.io) - Full form builder platform with database integration
|
|
255
|
+
|
|
256
|
+
## License
|
|
257
|
+
|
|
258
|
+
Apache-2.0
|
package/dist/index.d.ts
ADDED