@frontmcp/skills 0.0.1 → 1.0.0-beta.9
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/catalog/TEMPLATE.md +58 -13
- package/catalog/frontmcp-config/SKILL.md +140 -0
- package/catalog/frontmcp-config/references/configure-auth.md +238 -0
- package/catalog/frontmcp-config/references/configure-elicitation.md +178 -0
- package/catalog/frontmcp-config/references/configure-http.md +205 -0
- package/catalog/frontmcp-config/references/configure-session.md +205 -0
- package/catalog/frontmcp-config/references/configure-throttle.md +229 -0
- package/catalog/frontmcp-config/references/configure-transport.md +195 -0
- package/catalog/frontmcp-config/references/setup-redis.md +4 -0
- package/catalog/frontmcp-config/references/setup-sqlite.md +4 -0
- package/catalog/frontmcp-deployment/SKILL.md +124 -0
- package/catalog/frontmcp-deployment/references/build-for-browser.md +138 -0
- package/catalog/frontmcp-deployment/references/build-for-cli.md +138 -0
- package/catalog/{deployment/build-for-sdk/SKILL.md → frontmcp-deployment/references/build-for-sdk.md} +65 -24
- package/catalog/frontmcp-deployment/references/deploy-to-cloudflare.md +213 -0
- package/catalog/{deployment/deploy-to-lambda/SKILL.md → frontmcp-deployment/references/deploy-to-lambda.md} +73 -60
- package/catalog/{deployment/deploy-to-node/references/Dockerfile.example → frontmcp-deployment/references/deploy-to-node-dockerfile.md} +11 -2
- package/catalog/{deployment/deploy-to-node/SKILL.md → frontmcp-deployment/references/deploy-to-node.md} +65 -37
- package/catalog/frontmcp-deployment/references/deploy-to-vercel-config.md +60 -0
- package/catalog/frontmcp-deployment/references/deploy-to-vercel.md +224 -0
- package/catalog/frontmcp-development/SKILL.md +118 -0
- package/catalog/frontmcp-development/references/create-adapter.md +165 -0
- package/catalog/{development/create-agent/references/llm-config.md → frontmcp-development/references/create-agent-llm-config.md} +5 -5
- package/catalog/{development/create-agent/SKILL.md → frontmcp-development/references/create-agent.md} +82 -44
- package/catalog/{development/create-job/SKILL.md → frontmcp-development/references/create-job.md} +61 -19
- package/catalog/{plugins/create-plugin-hooks/SKILL.md → frontmcp-development/references/create-plugin-hooks.md} +63 -11
- package/catalog/{plugins/create-plugin/SKILL.md → frontmcp-development/references/create-plugin.md} +65 -60
- package/catalog/{development/create-prompt/SKILL.md → frontmcp-development/references/create-prompt.md} +62 -26
- package/catalog/{development/create-provider/SKILL.md → frontmcp-development/references/create-provider.md} +62 -27
- package/catalog/{development/create-resource/SKILL.md → frontmcp-development/references/create-resource.md} +62 -30
- package/catalog/{development/create-skill-with-tools/SKILL.md → frontmcp-development/references/create-skill-with-tools.md} +69 -24
- package/catalog/{development/create-skill/SKILL.md → frontmcp-development/references/create-skill.md} +71 -20
- package/catalog/{development/create-tool/SKILL.md → frontmcp-development/references/create-tool.md} +62 -26
- package/catalog/{development/create-workflow/SKILL.md → frontmcp-development/references/create-workflow.md} +60 -18
- package/catalog/{development/decorators-guide/SKILL.md → frontmcp-development/references/decorators-guide.md} +123 -34
- package/catalog/frontmcp-development/references/official-adapters.md +194 -0
- package/catalog/{plugins/official-plugins/SKILL.md → frontmcp-development/references/official-plugins.md} +68 -22
- package/catalog/frontmcp-guides/SKILL.md +417 -0
- package/catalog/frontmcp-guides/references/example-knowledge-base.md +636 -0
- package/catalog/frontmcp-guides/references/example-task-manager.md +512 -0
- package/catalog/frontmcp-guides/references/example-weather-api.md +292 -0
- package/catalog/frontmcp-setup/SKILL.md +127 -0
- package/catalog/frontmcp-setup/references/frontmcp-skills-usage.md +265 -0
- package/catalog/{setup/multi-app-composition/SKILL.md → frontmcp-setup/references/multi-app-composition.md} +65 -23
- package/catalog/{setup/nx-workflow/SKILL.md → frontmcp-setup/references/nx-workflow.md} +78 -21
- package/catalog/frontmcp-setup/references/project-structure-nx.md +246 -0
- package/catalog/frontmcp-setup/references/project-structure-standalone.md +212 -0
- package/catalog/{setup/setup-project/SKILL.md → frontmcp-setup/references/setup-project.md} +62 -62
- package/catalog/{setup/setup-redis/SKILL.md → frontmcp-setup/references/setup-redis.md} +59 -86
- package/catalog/{setup/setup-sqlite/SKILL.md → frontmcp-setup/references/setup-sqlite.md} +64 -76
- package/catalog/frontmcp-testing/SKILL.md +121 -0
- package/catalog/{testing/setup-testing/SKILL.md → frontmcp-testing/references/setup-testing.md} +78 -67
- package/catalog/{testing/setup-testing → frontmcp-testing}/references/test-tool-unit.md +1 -0
- package/catalog/skills-manifest.json +34 -383
- package/package.json +1 -1
- package/src/manifest.d.ts +3 -3
- package/src/manifest.js +1 -3
- package/src/manifest.js.map +1 -1
- package/catalog/adapters/create-adapter/SKILL.md +0 -127
- package/catalog/adapters/official-adapters/SKILL.md +0 -136
- package/catalog/auth/configure-auth/SKILL.md +0 -250
- package/catalog/auth/configure-session/SKILL.md +0 -201
- package/catalog/config/configure-elicitation/SKILL.md +0 -136
- package/catalog/config/configure-http/SKILL.md +0 -167
- package/catalog/config/configure-throttle/SKILL.md +0 -189
- package/catalog/config/configure-transport/SKILL.md +0 -151
- package/catalog/deployment/build-for-browser/SKILL.md +0 -95
- package/catalog/deployment/build-for-cli/SKILL.md +0 -100
- package/catalog/deployment/deploy-to-cloudflare/SKILL.md +0 -192
- package/catalog/deployment/deploy-to-vercel/SKILL.md +0 -196
- package/catalog/deployment/deploy-to-vercel/references/vercel.json.example +0 -60
- package/catalog/setup/frontmcp-skills-usage/SKILL.md +0 -200
- package/catalog/setup/project-structure-nx/SKILL.md +0 -186
- package/catalog/setup/project-structure-standalone/SKILL.md +0 -153
- /package/catalog/{auth/configure-auth/references/auth-modes.md → frontmcp-config/references/configure-auth-modes.md} +0 -0
- /package/catalog/{config/configure-throttle/references/guard-config.md → frontmcp-config/references/configure-throttle-guard-config.md} +0 -0
- /package/catalog/{config/configure-transport/references/protocol-presets.md → frontmcp-config/references/configure-transport-protocol-presets.md} +0 -0
- /package/catalog/{development/create-tool/references/tool-annotations.md → frontmcp-development/references/create-tool-annotations.md} +0 -0
- /package/catalog/{development/create-tool/references/output-schema-types.md → frontmcp-development/references/create-tool-output-schema-types.md} +0 -0
- /package/catalog/{testing/setup-testing → frontmcp-testing}/references/test-auth.md +0 -0
- /package/catalog/{testing/setup-testing → frontmcp-testing}/references/test-browser-build.md +0 -0
- /package/catalog/{testing/setup-testing → frontmcp-testing}/references/test-cli-binary.md +0 -0
- /package/catalog/{testing/setup-testing → frontmcp-testing}/references/test-direct-client.md +0 -0
- /package/catalog/{testing/setup-testing → frontmcp-testing}/references/test-e2e-handler.md +0 -0
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
# Configuring Transport
|
|
2
|
+
|
|
3
|
+
Configure how clients connect to your FrontMCP server — SSE, Streamable HTTP, stateless API, or a combination.
|
|
4
|
+
|
|
5
|
+
## When to Use This Skill
|
|
6
|
+
|
|
7
|
+
### Must Use
|
|
8
|
+
|
|
9
|
+
- Setting up a new FrontMCP server and need to decide on a transport protocol (SSE, Streamable HTTP, or stateless)
|
|
10
|
+
- Deploying to serverless targets (Vercel, Lambda, Cloudflare) that require stateless transport mode
|
|
11
|
+
- Running multiple server instances behind a load balancer that require distributed sessions via Redis
|
|
12
|
+
|
|
13
|
+
### Recommended
|
|
14
|
+
|
|
15
|
+
- Migrating an existing server from legacy SSE to modern Streamable HTTP
|
|
16
|
+
- Enabling SSE event resumability so clients can reconnect after network interruptions
|
|
17
|
+
- Fine-tuning protocol flags beyond what the built-in presets provide
|
|
18
|
+
|
|
19
|
+
### Skip When
|
|
20
|
+
|
|
21
|
+
- You are configuring authentication or session tokens (use `configure-auth` instead)
|
|
22
|
+
- You need to set up plugin middleware without changing the transport layer (use `create-plugin` reference instead)
|
|
23
|
+
|
|
24
|
+
> **Decision:** Use this skill whenever you need to choose, combine, or customize the protocol(s) your MCP server exposes to clients.
|
|
25
|
+
|
|
26
|
+
## TransportOptionsInput
|
|
27
|
+
|
|
28
|
+
```typescript
|
|
29
|
+
@FrontMcp({
|
|
30
|
+
info: { name: 'my-server', version: '1.0.0' },
|
|
31
|
+
apps: [MyApp],
|
|
32
|
+
transport: {
|
|
33
|
+
sessionMode: 'stateful', // 'stateful' | 'stateless'
|
|
34
|
+
protocol: 'legacy', // preset or custom ProtocolConfig
|
|
35
|
+
persistence: {
|
|
36
|
+
// false to disable
|
|
37
|
+
redis: { provider: 'redis', host: 'localhost', port: 6379 },
|
|
38
|
+
defaultTtlMs: 3600000,
|
|
39
|
+
},
|
|
40
|
+
distributedMode: 'auto', // boolean | 'auto'
|
|
41
|
+
eventStore: {
|
|
42
|
+
enabled: true,
|
|
43
|
+
provider: 'redis', // 'memory' | 'redis'
|
|
44
|
+
maxEvents: 10000,
|
|
45
|
+
ttlMs: 300000,
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
})
|
|
49
|
+
class Server {}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Protocol Presets
|
|
53
|
+
|
|
54
|
+
Choose a preset that matches your deployment:
|
|
55
|
+
|
|
56
|
+
| Preset | SSE | Streamable HTTP | JSON | Stateless | Legacy SSE | Strict Session |
|
|
57
|
+
| -------------------- | --- | --------------- | ---- | --------- | ---------- | -------------- |
|
|
58
|
+
| `'legacy'` (default) | Yes | Yes | No | No | Yes | Yes |
|
|
59
|
+
| `'modern'` | Yes | Yes | No | No | No | Yes |
|
|
60
|
+
| `'stateless-api'` | No | No | No | Yes | No | No |
|
|
61
|
+
| `'full'` | Yes | Yes | Yes | Yes | Yes | No |
|
|
62
|
+
|
|
63
|
+
### When to Use Each
|
|
64
|
+
|
|
65
|
+
- **`'legacy'`** — Default. Maximum compatibility with all MCP clients (Claude Desktop, etc.). Best for Node.js deployments.
|
|
66
|
+
- **`'modern'`** — Drop legacy SSE support. Use when all clients support modern MCP protocol.
|
|
67
|
+
- **`'stateless-api'`** — No sessions, pure request/response. Use for **Vercel**, **Lambda**, and other serverless targets.
|
|
68
|
+
- **`'full'`** — All protocols enabled. Use for development or when you need every transport option.
|
|
69
|
+
|
|
70
|
+
### Custom Protocol Config
|
|
71
|
+
|
|
72
|
+
Override individual protocol flags:
|
|
73
|
+
|
|
74
|
+
```typescript
|
|
75
|
+
transport: {
|
|
76
|
+
protocol: {
|
|
77
|
+
sse: true, // SSE listener endpoint
|
|
78
|
+
streamable: true, // Streamable HTTP POST
|
|
79
|
+
json: false, // JSON-only responses (no streaming)
|
|
80
|
+
stateless: false, // Stateless HTTP (no sessions)
|
|
81
|
+
legacy: false, // Legacy SSE transport
|
|
82
|
+
strictSession: true, // Require session ID for streamable HTTP
|
|
83
|
+
},
|
|
84
|
+
}
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Distributed Sessions
|
|
88
|
+
|
|
89
|
+
For multi-instance deployments (load balanced), enable persistence with Redis:
|
|
90
|
+
|
|
91
|
+
```typescript
|
|
92
|
+
transport: {
|
|
93
|
+
distributedMode: true,
|
|
94
|
+
persistence: {
|
|
95
|
+
redis: { provider: 'redis', host: 'redis.internal', port: 6379 },
|
|
96
|
+
defaultTtlMs: 3600000, // 1 hour session TTL
|
|
97
|
+
},
|
|
98
|
+
}
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
- `distributedMode: 'auto'` — auto-detect based on whether Redis is configured
|
|
102
|
+
- `distributedMode: true` — force distributed mode (requires Redis)
|
|
103
|
+
- `distributedMode: false` — single-instance mode (in-memory sessions)
|
|
104
|
+
|
|
105
|
+
## Event Store (SSE Resumability)
|
|
106
|
+
|
|
107
|
+
Enable event store so clients can resume SSE connections after disconnects:
|
|
108
|
+
|
|
109
|
+
```typescript
|
|
110
|
+
transport: {
|
|
111
|
+
eventStore: {
|
|
112
|
+
enabled: true,
|
|
113
|
+
provider: 'redis', // 'memory' for single instance, 'redis' for distributed
|
|
114
|
+
maxEvents: 10000, // max events to store
|
|
115
|
+
ttlMs: 300000, // 5 minute TTL
|
|
116
|
+
redis: { provider: 'redis', host: 'localhost' },
|
|
117
|
+
},
|
|
118
|
+
}
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## Target-Specific Recommendations
|
|
122
|
+
|
|
123
|
+
| Target | Recommended Preset | Persistence | Event Store |
|
|
124
|
+
| ------------------------ | ------------------ | ----------- | ----------- |
|
|
125
|
+
| Node.js (single) | `'legacy'` | `false` | Memory |
|
|
126
|
+
| Node.js (multi-instance) | `'modern'` | Redis | Redis |
|
|
127
|
+
| Vercel | `'stateless-api'` | `false` | Disabled |
|
|
128
|
+
| Lambda | `'stateless-api'` | `false` | Disabled |
|
|
129
|
+
| Cloudflare | `'stateless-api'` | `false` | Disabled |
|
|
130
|
+
|
|
131
|
+
## Verification
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
# Start server and test SSE
|
|
135
|
+
frontmcp dev
|
|
136
|
+
|
|
137
|
+
# Test SSE endpoint
|
|
138
|
+
curl -N http://localhost:3001/sse
|
|
139
|
+
|
|
140
|
+
# Test streamable HTTP
|
|
141
|
+
curl -X POST http://localhost:3001/ -H 'Content-Type: application/json' -d '{"jsonrpc":"2.0","method":"tools/list","id":1}'
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
## Common Patterns
|
|
145
|
+
|
|
146
|
+
| Pattern | Correct | Incorrect | Why |
|
|
147
|
+
| -------------------- | -------------------------------------------------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------------------------------- |
|
|
148
|
+
| Choosing a preset | `protocol: 'modern'` | `protocol: { sse: true, streamable: true, legacy: false }` | Use a preset when it matches your needs; custom config is for overrides only |
|
|
149
|
+
| Serverless transport | `protocol: 'stateless-api'` with `sessionMode: 'stateless'` | `protocol: 'legacy'` on Lambda | Legacy preset creates sessions that serverless cannot maintain between invocations |
|
|
150
|
+
| Distributed sessions | `distributedMode: true` with Redis `persistence` configured | `distributedMode: true` without Redis | Distributed mode requires Redis; omitting it causes a startup error |
|
|
151
|
+
| Event store provider | `provider: 'redis'` for multi-instance, `provider: 'memory'` for single instance | `provider: 'memory'` behind a load balancer | In-memory event store is not shared across instances, breaking SSE resumability |
|
|
152
|
+
| Session TTL | Set `defaultTtlMs` to match your expected session duration | Omitting `defaultTtlMs` when using Redis persistence | Missing TTL can cause sessions to accumulate indefinitely in Redis |
|
|
153
|
+
|
|
154
|
+
## Verification Checklist
|
|
155
|
+
|
|
156
|
+
### Transport Protocol
|
|
157
|
+
|
|
158
|
+
- [ ] Correct preset is chosen for the deployment target (see Target-Specific Recommendations table)
|
|
159
|
+
- [ ] Custom protocol flags, if used, do not conflict with the selected `sessionMode`
|
|
160
|
+
- [ ] Legacy SSE is disabled when all clients support modern MCP protocol
|
|
161
|
+
|
|
162
|
+
### Session and Persistence
|
|
163
|
+
|
|
164
|
+
- [ ] `sessionMode` is `'stateless'` for serverless deployments
|
|
165
|
+
- [ ] `distributedMode` is enabled and Redis is configured for multi-instance deployments
|
|
166
|
+
- [ ] `defaultTtlMs` is set to a reasonable value when persistence is enabled
|
|
167
|
+
|
|
168
|
+
### Event Store
|
|
169
|
+
|
|
170
|
+
- [ ] Event store provider matches the deployment topology (memory for single, Redis for distributed)
|
|
171
|
+
- [ ] `maxEvents` and `ttlMs` are tuned for expected traffic volume
|
|
172
|
+
- [ ] Event store is disabled for stateless-api deployments
|
|
173
|
+
|
|
174
|
+
### Runtime Validation
|
|
175
|
+
|
|
176
|
+
- [ ] Server starts without transport-related errors
|
|
177
|
+
- [ ] SSE endpoint (`/sse`) responds with `text/event-stream` when SSE is enabled
|
|
178
|
+
- [ ] Streamable HTTP endpoint (`/`) accepts JSON-RPC POST requests when streamable is enabled
|
|
179
|
+
- [ ] Clients can reconnect and resume SSE streams when event store is enabled
|
|
180
|
+
|
|
181
|
+
## Troubleshooting
|
|
182
|
+
|
|
183
|
+
| Problem | Cause | Solution |
|
|
184
|
+
| -------------------------------------- | -------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------ |
|
|
185
|
+
| Server rejects SSE connections | SSE is disabled in the protocol config or preset | Switch to `'legacy'`, `'modern'`, or `'full'` preset, or set `sse: true` in custom config |
|
|
186
|
+
| `distributedMode` startup error | Redis persistence is not configured | Add a `persistence.redis` block with valid connection details |
|
|
187
|
+
| Clients lose state after reconnect | Event store is disabled or using in-memory provider behind a load balancer | Enable event store with `provider: 'redis'` for distributed deployments |
|
|
188
|
+
| Serverless function times out on SSE | Using a stateful preset on a serverless target | Switch to `'stateless-api'` preset and set `sessionMode: 'stateless'` |
|
|
189
|
+
| Session not found after server restart | In-memory sessions do not survive restarts | Enable Redis persistence with `distributedMode: true` |
|
|
190
|
+
| Streamable HTTP returns 404 | Streamable HTTP is not enabled in the current preset | Use `'modern'`, `'legacy'`, or `'full'` preset, or set `streamable: true` in custom config |
|
|
191
|
+
|
|
192
|
+
## Reference
|
|
193
|
+
|
|
194
|
+
- **Docs:** [Runtime Modes and Transport Configuration](https://docs.agentfront.dev/frontmcp/deployment/runtime-modes)
|
|
195
|
+
- **Related skills:** `configure-auth`, `create-plugin`
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: frontmcp-deployment
|
|
3
|
+
description: "Domain router for shipping MCP servers \u2014 deploy to Node, Vercel, Lambda, Cloudflare, or build for CLI, browser, and SDK. Use when choosing a deployment target or build format."
|
|
4
|
+
tags: [router, deployment, node, vercel, lambda, cloudflare, cli, browser, sdk, guide]
|
|
5
|
+
priority: 10
|
|
6
|
+
visibility: both
|
|
7
|
+
license: Apache-2.0
|
|
8
|
+
metadata:
|
|
9
|
+
docs: https://docs.agentfront.dev/frontmcp/deployment/overview
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# FrontMCP Deployment Router
|
|
13
|
+
|
|
14
|
+
Entry point for deploying and building FrontMCP servers. This skill helps you choose the right deployment target or build format based on your infrastructure requirements.
|
|
15
|
+
|
|
16
|
+
## When to Use This Skill
|
|
17
|
+
|
|
18
|
+
### Must Use
|
|
19
|
+
|
|
20
|
+
- Choosing between deployment targets (Node vs Vercel vs Lambda vs Cloudflare) for a new project
|
|
21
|
+
- Deciding on a build format (server vs CLI vs browser vs SDK) for distribution
|
|
22
|
+
- Planning infrastructure and need to understand trade-offs between deployment options
|
|
23
|
+
|
|
24
|
+
### Recommended
|
|
25
|
+
|
|
26
|
+
- Comparing serverless platforms for cost, cold-start, and feature support
|
|
27
|
+
- Understanding which transport protocol and storage provider each target requires
|
|
28
|
+
- Migrating from one deployment target to another
|
|
29
|
+
|
|
30
|
+
### Skip When
|
|
31
|
+
|
|
32
|
+
- You already know your deployment target (go directly to `deploy-to-node`, `deploy-to-vercel`, etc.)
|
|
33
|
+
- You need to configure server settings, not deploy (see `frontmcp-config`)
|
|
34
|
+
- You need to build components, not ship them (see `frontmcp-development`)
|
|
35
|
+
|
|
36
|
+
> **Decision:** Use this skill when you need to figure out WHERE to deploy. Use the specific skill when you already know.
|
|
37
|
+
|
|
38
|
+
## Prerequisites
|
|
39
|
+
|
|
40
|
+
- A working FrontMCP server with at least one `@App` and one `@Tool` (see `frontmcp-development`)
|
|
41
|
+
- Server configuration completed (see `frontmcp-config`)
|
|
42
|
+
- Tests passing locally (see `frontmcp-testing`)
|
|
43
|
+
|
|
44
|
+
## Steps
|
|
45
|
+
|
|
46
|
+
1. Review the Scenario Routing Table and Target Comparison below to choose a deployment target
|
|
47
|
+
2. Run `frontmcp build --target <target>` to produce the build output
|
|
48
|
+
3. Follow the specific deployment skill (e.g., `deploy-to-node`, `deploy-to-vercel`) for platform instructions
|
|
49
|
+
4. Verify with the Post-Deployment checklist at the end of this skill
|
|
50
|
+
|
|
51
|
+
## Scenario Routing Table
|
|
52
|
+
|
|
53
|
+
| Scenario | Skill | Description |
|
|
54
|
+
| ------------------------------------------------- | ---------------------- | ----------------------------------------------------------------------- |
|
|
55
|
+
| Long-running server on VPS, Docker, or bare metal | `deploy-to-node` | Node.js with stdio or HTTP transport, PM2/Docker for process management |
|
|
56
|
+
| Serverless with zero config and Vercel KV | `deploy-to-vercel` | Vercel Functions with Streamable HTTP, Vercel KV for storage |
|
|
57
|
+
| AWS serverless with API Gateway | `deploy-to-lambda` | Lambda + API Gateway with Streamable HTTP, DynamoDB or ElastiCache |
|
|
58
|
+
| Edge computing with global distribution | `deploy-to-cloudflare` | Cloudflare Workers with KV or Durable Objects for storage |
|
|
59
|
+
| Standalone executable binary for distribution | `build-for-cli` | Single-binary CLI with stdio transport, embedded storage |
|
|
60
|
+
| Run MCP in a web browser | `build-for-browser` | Browser-compatible bundle with in-memory transport |
|
|
61
|
+
| Embed MCP into an existing Node.js application | `build-for-sdk` | Library build for programmatic usage without standalone server |
|
|
62
|
+
|
|
63
|
+
## Target Comparison
|
|
64
|
+
|
|
65
|
+
| Target | Transport | Storage | Cold Start | Stateful | Best For |
|
|
66
|
+
| ---------- | --------------------------- | --------------------- | ---------- | -------- | -------------------------------- |
|
|
67
|
+
| Node | stdio, SSE, Streamable HTTP | Redis, SQLite, memory | None | Yes | Full-featured production servers |
|
|
68
|
+
| Vercel | Streamable HTTP (stateless) | Vercel KV | ~250ms | No | Rapid deployment, hobby/startup |
|
|
69
|
+
| Lambda | Streamable HTTP (stateless) | DynamoDB, ElastiCache | ~500ms | No | AWS ecosystem, event-driven |
|
|
70
|
+
| Cloudflare | Streamable HTTP (stateless) | KV, Durable Objects | ~5ms | Limited | Edge-first, global latency |
|
|
71
|
+
| CLI | stdio | SQLite, memory | None | Yes | Desktop tools, local agents |
|
|
72
|
+
| Browser | In-memory | memory | None | Yes | Client-side AI, demos |
|
|
73
|
+
| SDK | Programmatic | Configurable | None | Yes | Embedding in existing apps |
|
|
74
|
+
|
|
75
|
+
> **Note on storage:** The FrontMCP SDK's `StorageProvider` type supports `'redis'` and `'vercel-kv'` as built-in providers. References to DynamoDB, Cloudflare KV, D1, and Durable Objects in the table above refer to platform-native storage that you configure outside the SDK (e.g., via AWS SDK, Cloudflare bindings). The SDK does not provide a built-in adapter for these — use them directly in your tools/providers.
|
|
76
|
+
|
|
77
|
+
## Cross-Cutting Patterns
|
|
78
|
+
|
|
79
|
+
| Pattern | Rule |
|
|
80
|
+
| --------------------- | -------------------------------------------------------------------------------------------------------- |
|
|
81
|
+
| Transport selection | Stateful servers (Node, CLI) can use stdio or SSE; serverless must use Streamable HTTP (stateless) |
|
|
82
|
+
| Storage mapping | Node: Redis or SQLite; Vercel: Vercel KV; Lambda: DynamoDB; Cloudflare: KV; CLI: SQLite; Browser: memory |
|
|
83
|
+
| Environment variables | Never hardcode secrets; use `.env` locally, platform secrets in production |
|
|
84
|
+
| Build command | All targets: `frontmcp build --target <target>` produces optimized output |
|
|
85
|
+
| Entry point | All targets require `export default` of the `@FrontMcp` class from `main.ts` |
|
|
86
|
+
|
|
87
|
+
## Common Patterns
|
|
88
|
+
|
|
89
|
+
| Pattern | Correct | Incorrect | Why |
|
|
90
|
+
| ------------------ | ------------------------------------------------------- | --------------------------- | ---------------------------------------------------------------------------- |
|
|
91
|
+
| Target selection | Choose based on infrastructure constraints | Choose based on familiarity | Each target has different transport, storage, and cold-start characteristics |
|
|
92
|
+
| Serverless storage | Use platform-native storage (Vercel KV, DynamoDB) | Use Redis on serverless | Platform-native storage avoids VPC/connection overhead on cold starts |
|
|
93
|
+
| Environment config | Platform secrets (Vercel env, AWS SSM) | `.env` files in production | Platform secrets are encrypted, rotatable, and not committed to git |
|
|
94
|
+
| Build verification | Run `frontmcp build --target <target>` before deploying | Deploy source code directly | Build step validates config, bundles dependencies, and optimizes output |
|
|
95
|
+
|
|
96
|
+
## Verification Checklist
|
|
97
|
+
|
|
98
|
+
### Pre-Deployment
|
|
99
|
+
|
|
100
|
+
- [ ] `frontmcp build --target <target>` completes without errors
|
|
101
|
+
- [ ] Environment variables configured for the target platform
|
|
102
|
+
- [ ] Storage provider configured and accessible (Redis, KV, DynamoDB, etc.)
|
|
103
|
+
- [ ] Transport protocol matches target requirements (stateless for serverless)
|
|
104
|
+
|
|
105
|
+
### Post-Deployment
|
|
106
|
+
|
|
107
|
+
- [ ] Health check endpoint responds
|
|
108
|
+
- [ ] `tools/list` returns expected tools
|
|
109
|
+
- [ ] Tool execution works end-to-end
|
|
110
|
+
- [ ] Storage persistence verified (create, read, restart, read again)
|
|
111
|
+
|
|
112
|
+
## Troubleshooting
|
|
113
|
+
|
|
114
|
+
| Problem | Cause | Solution |
|
|
115
|
+
| ---------------------------------- | -------------------------------------------- | ------------------------------------------------------------------------------- |
|
|
116
|
+
| Cold start timeout on serverless | Bundle too large or heavy initialization | Lazy-load providers; reduce bundle with tree shaking; increase function timeout |
|
|
117
|
+
| Session lost between requests | Using memory storage on stateless serverless | Switch to platform-native storage (Vercel KV, DynamoDB, etc.) |
|
|
118
|
+
| CORS errors on browser/web clients | HTTP CORS not configured | Add CORS config via `configure-http` skill |
|
|
119
|
+
| Build fails with missing module | Node-only module in browser/edge build | Use conditional imports or `@frontmcp/utils` cross-platform utilities |
|
|
120
|
+
|
|
121
|
+
## Reference
|
|
122
|
+
|
|
123
|
+
- [Deployment Overview](https://docs.agentfront.dev/frontmcp/deployment/overview)
|
|
124
|
+
- Related skills: `deploy-to-node`, `deploy-to-vercel`, `deploy-to-lambda`, `deploy-to-cloudflare`, `build-for-cli`, `build-for-browser`, `build-for-sdk`, `configure-transport`
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
# Building for Browser
|
|
2
|
+
|
|
3
|
+
Build your FrontMCP server or client for browser environments.
|
|
4
|
+
|
|
5
|
+
## When to Use This Skill
|
|
6
|
+
|
|
7
|
+
### Must Use
|
|
8
|
+
|
|
9
|
+
- Building a browser-compatible MCP client or tool interface for a web application
|
|
10
|
+
- Embedding MCP tools in a React, Vue, or other frontend framework using `@frontmcp/react`
|
|
11
|
+
- Creating a client-side bundle that connects to a remote MCP server
|
|
12
|
+
|
|
13
|
+
### Recommended
|
|
14
|
+
|
|
15
|
+
- Prototyping MCP tool UIs in the browser before building a full backend
|
|
16
|
+
- Shipping a web-based admin dashboard that lists and invokes MCP tools
|
|
17
|
+
- Building a PWA or single-page app that consumes MCP resources
|
|
18
|
+
|
|
19
|
+
### Skip When
|
|
20
|
+
|
|
21
|
+
- Running MCP tools on a Node.js server -- use `--target node` or `build-for-cli`
|
|
22
|
+
- Embedding MCP in an existing Node.js app without HTTP -- use `build-for-sdk`
|
|
23
|
+
- Deploying to Cloudflare Workers or other edge runtimes -- use `deploy-to-cloudflare`
|
|
24
|
+
|
|
25
|
+
> **Decision:** Choose this skill when the MCP consumer runs in a browser; use server-side build targets for Node.js environments.
|
|
26
|
+
|
|
27
|
+
## Build Command
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
frontmcp build --target browser
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Options
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
frontmcp build --target browser -o ./dist/browser # Custom output directory
|
|
37
|
+
frontmcp build --target browser -e ./src/client.ts # Custom entry file
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Browser Limitations
|
|
41
|
+
|
|
42
|
+
Not all FrontMCP features are available in browser environments:
|
|
43
|
+
|
|
44
|
+
| Feature | Browser Support | Notes |
|
|
45
|
+
| --------------------------- | --------------- | ----------------------------------------- |
|
|
46
|
+
| Tools (client-side) | Yes | Can define and run tools |
|
|
47
|
+
| Resources | Yes | Read-only access |
|
|
48
|
+
| Prompts | Yes | Full support |
|
|
49
|
+
| Redis | No | Use in-memory or connect to server |
|
|
50
|
+
| SQLite | No | No filesystem access |
|
|
51
|
+
| File system utilities | No | `@frontmcp/utils` fs ops throw in browser |
|
|
52
|
+
| Crypto (`@frontmcp/utils`) | Yes | Uses WebCrypto API |
|
|
53
|
+
| Direct client (`connect()`) | Yes | In-memory connection |
|
|
54
|
+
|
|
55
|
+
## Usage with @frontmcp/react
|
|
56
|
+
|
|
57
|
+
The browser build is commonly paired with `@frontmcp/react` for React applications:
|
|
58
|
+
|
|
59
|
+
```typescript
|
|
60
|
+
import { FrontMcpProvider, useTools } from '@frontmcp/react';
|
|
61
|
+
|
|
62
|
+
function App() {
|
|
63
|
+
return (
|
|
64
|
+
<FrontMcpProvider config={{ serverUrl: 'https://my-mcp.example.com' }}>
|
|
65
|
+
<ToolUI />
|
|
66
|
+
</FrontMcpProvider>
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function ToolUI() {
|
|
71
|
+
const { tools, callTool } = useTools();
|
|
72
|
+
// Use tools in your React components
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Browser vs Node vs SDK Target
|
|
77
|
+
|
|
78
|
+
| Aspect | `--target browser` | `--target node` | `--target sdk` |
|
|
79
|
+
| ----------- | ------------------ | ----------------- | ------------------- |
|
|
80
|
+
| Runtime | Browser | Node.js server | Node.js library |
|
|
81
|
+
| Output | Browser bundle | Server executable | CJS + ESM + types |
|
|
82
|
+
| HTTP server | No | Yes | No (`serve: false`) |
|
|
83
|
+
| Use case | Frontend apps | Standalone server | Embed in Node apps |
|
|
84
|
+
|
|
85
|
+
## Verification
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
# Build
|
|
89
|
+
frontmcp build --target browser
|
|
90
|
+
|
|
91
|
+
# Check output
|
|
92
|
+
ls dist/browser/
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## Common Patterns
|
|
96
|
+
|
|
97
|
+
| Pattern | Correct | Incorrect | Why |
|
|
98
|
+
| ----------------- | ---------------------------------------- | --------------------------------- | ------------------------------------------ |
|
|
99
|
+
| Crypto usage | `@frontmcp/utils` (uses WebCrypto) | `node:crypto` | `node:crypto` is not available in browsers |
|
|
100
|
+
| Storage | In-memory stores or remote API | SQLite / Redis directly | No filesystem or native TCP in browsers |
|
|
101
|
+
| File system ops | Avoid `@frontmcp/utils` fs functions | `readFile()`, `writeFile()` | fs utilities throw in browser environments |
|
|
102
|
+
| Entry file | Separate browser entry (`src/client.ts`) | Reusing server entry point | Server entry may import Node-only modules |
|
|
103
|
+
| Server connection | `FrontMcpProvider` with `serverUrl` | Direct `connect()` with localhost | Browser needs a remote URL, not localhost |
|
|
104
|
+
|
|
105
|
+
## Verification Checklist
|
|
106
|
+
|
|
107
|
+
**Build**
|
|
108
|
+
|
|
109
|
+
- [ ] `frontmcp build --target browser` completes without errors
|
|
110
|
+
- [ ] Output directory contains browser-compatible JS bundle
|
|
111
|
+
- [ ] No Node.js-only modules are included in the bundle
|
|
112
|
+
|
|
113
|
+
**Runtime**
|
|
114
|
+
|
|
115
|
+
- [ ] Bundle loads in the browser without console errors
|
|
116
|
+
- [ ] MCP tools are listed and callable from the frontend
|
|
117
|
+
- [ ] WebCrypto-based operations (auth, PKCE) work correctly
|
|
118
|
+
|
|
119
|
+
**Integration**
|
|
120
|
+
|
|
121
|
+
- [ ] `@frontmcp/react` provider connects to the remote MCP server
|
|
122
|
+
- [ ] Tool invocations return expected results in the UI
|
|
123
|
+
- [ ] Resources and prompts render correctly in browser components
|
|
124
|
+
|
|
125
|
+
## Troubleshooting
|
|
126
|
+
|
|
127
|
+
| Problem | Cause | Solution |
|
|
128
|
+
| --------------------------- | ----------------------------------------- | ---------------------------------------------------------------- |
|
|
129
|
+
| `Module not found: fs` | Node.js module imported in browser bundle | Use a separate browser entry point that avoids Node-only imports |
|
|
130
|
+
| `crypto is not defined` | Using `node:crypto` instead of WebCrypto | Switch to `@frontmcp/utils` crypto functions |
|
|
131
|
+
| CORS errors on tool calls | MCP server missing CORS headers | Configure CORS middleware on the MCP server |
|
|
132
|
+
| Bundle too large | All server-side code included | Use `--target browser` and a dedicated client entry file |
|
|
133
|
+
| `@frontmcp/utils` fs throws | File system ops called in browser | Remove fs calls; use API endpoints or in-memory alternatives |
|
|
134
|
+
|
|
135
|
+
## Reference
|
|
136
|
+
|
|
137
|
+
- **Docs:** <https://docs.agentfront.dev/frontmcp/deployment/browser-compatibility>
|
|
138
|
+
- **Related skills:** `build-for-sdk`, `build-for-cli`, `deploy-to-cloudflare`
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
# Building a CLI Binary
|
|
2
|
+
|
|
3
|
+
Build your FrontMCP server as a distributable CLI binary using Node.js Single Executable Applications (SEA) or as a bundled JS file.
|
|
4
|
+
|
|
5
|
+
## When to Use This Skill
|
|
6
|
+
|
|
7
|
+
### Must Use
|
|
8
|
+
|
|
9
|
+
- Distributing your MCP server as a standalone executable that runs without Node.js
|
|
10
|
+
- Creating a CLI tool installable via package managers (Homebrew, apt, etc.)
|
|
11
|
+
- Producing a self-contained binary for air-gapped or dependency-free deployment
|
|
12
|
+
|
|
13
|
+
### Recommended
|
|
14
|
+
|
|
15
|
+
- Shipping an MCP-powered developer tool to end users who may not have Node.js
|
|
16
|
+
- Building platform-specific binaries for CI/CD artifact pipelines
|
|
17
|
+
- Creating a single-file JS bundle for lightweight Node.js execution
|
|
18
|
+
|
|
19
|
+
### Skip When
|
|
20
|
+
|
|
21
|
+
- Deploying to a server environment with Node.js available -- use `--target node`
|
|
22
|
+
- Embedding tools in an existing Node.js application -- use `build-for-sdk`
|
|
23
|
+
- Targeting browser environments -- use `build-for-browser`
|
|
24
|
+
|
|
25
|
+
> **Decision:** Choose this skill when your goal is a distributable binary or bundled JS file; use other build targets for server or library deployments.
|
|
26
|
+
|
|
27
|
+
## Build Commands
|
|
28
|
+
|
|
29
|
+
### Native Binary (SEA)
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
frontmcp build --target cli
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Produces a Node.js Single Executable Application — a single binary embedding your server code and the Node.js runtime.
|
|
36
|
+
|
|
37
|
+
### JS Bundle Only
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
frontmcp build --target cli --js
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Produces a bundled JS file without the native binary wrapper. Run with `node dist/server.js`.
|
|
44
|
+
|
|
45
|
+
### Options
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
frontmcp build --target cli -o ./build # Custom output directory
|
|
49
|
+
frontmcp build --target cli -e ./src/main.ts # Custom entry file
|
|
50
|
+
frontmcp build --target cli --js # JS bundle only (no SEA)
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Requirements
|
|
54
|
+
|
|
55
|
+
- **Node.js 22+** required for SEA support
|
|
56
|
+
- The entry file must export or instantiate a `@FrontMcp` decorated class
|
|
57
|
+
- SEA binaries are platform-specific (build on macOS for macOS, Linux for Linux)
|
|
58
|
+
|
|
59
|
+
## CLI Target vs Node Target
|
|
60
|
+
|
|
61
|
+
| Aspect | `--target cli` | `--target node` |
|
|
62
|
+
| -------- | ---------------------------------- | ------------------------------ |
|
|
63
|
+
| Output | Single binary or JS bundle | JS files for server deployment |
|
|
64
|
+
| Runtime | Embedded Node.js (SEA) or external | Requires Node.js installed |
|
|
65
|
+
| Use case | Distribution to end users | Server deployment (Docker, VM) |
|
|
66
|
+
| Includes | Bundled dependencies | External node_modules |
|
|
67
|
+
|
|
68
|
+
## Server Configuration for CLI Mode
|
|
69
|
+
|
|
70
|
+
When building for CLI distribution, configure your server for local/stdin transport:
|
|
71
|
+
|
|
72
|
+
```typescript
|
|
73
|
+
@FrontMcp({
|
|
74
|
+
info: { name: 'my-cli-tool', version: '1.0.0' },
|
|
75
|
+
apps: [MyApp],
|
|
76
|
+
http: { socketPath: '/tmp/my-tool.sock' }, // Unix socket instead of TCP
|
|
77
|
+
sqlite: { path: '~/.my-tool/data.db' }, // Local storage
|
|
78
|
+
})
|
|
79
|
+
class MyCLIServer {}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Verification
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
# Build
|
|
86
|
+
frontmcp build --target cli
|
|
87
|
+
|
|
88
|
+
# Test the binary
|
|
89
|
+
./dist/my-server --help
|
|
90
|
+
|
|
91
|
+
# Or test JS bundle
|
|
92
|
+
node dist/my-server.cjs.js
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## Common Patterns
|
|
96
|
+
|
|
97
|
+
| Pattern | Correct | Incorrect | Why |
|
|
98
|
+
| --------------------- | --------------------------------------------------- | -------------------------------- | ----------------------------------------------------------- |
|
|
99
|
+
| Node.js version | Node.js 22+ for SEA builds | Node.js 18 or 20 | SEA support requires Node.js 22+ |
|
|
100
|
+
| Entry file | Export or instantiate a `@FrontMcp` decorated class | Export a plain function | The build expects a FrontMcp entry point |
|
|
101
|
+
| Transport for CLI | `socketPath` or stdin/stdout | TCP port binding | CLI tools run locally; ports may conflict |
|
|
102
|
+
| Cross-platform binary | Build on each target OS separately | Build on macOS and ship to Linux | SEA binaries are platform-specific |
|
|
103
|
+
| JS-only bundle | `frontmcp build --target cli --js` | `frontmcp build --target node` | `--target node` assumes server deployment with node_modules |
|
|
104
|
+
|
|
105
|
+
## Verification Checklist
|
|
106
|
+
|
|
107
|
+
**Build**
|
|
108
|
+
|
|
109
|
+
- [ ] `frontmcp build --target cli` completes without errors
|
|
110
|
+
- [ ] Output directory contains the expected binary or `.cjs.js` file
|
|
111
|
+
- [ ] Binary file size is reasonable (no unexpected bloat)
|
|
112
|
+
|
|
113
|
+
**Runtime**
|
|
114
|
+
|
|
115
|
+
- [ ] Binary runs without Node.js installed on a clean machine
|
|
116
|
+
- [ ] `--help` flag prints usage information
|
|
117
|
+
- [ ] JS bundle runs correctly with `node dist/my-server.cjs.js`
|
|
118
|
+
|
|
119
|
+
**Distribution**
|
|
120
|
+
|
|
121
|
+
- [ ] Binary is tested on the target platform (macOS, Linux, Windows)
|
|
122
|
+
- [ ] Exit codes are correct (0 for success, non-zero for errors)
|
|
123
|
+
- [ ] No hard-coded absolute paths in the bundled output
|
|
124
|
+
|
|
125
|
+
## Troubleshooting
|
|
126
|
+
|
|
127
|
+
| Problem | Cause | Solution |
|
|
128
|
+
| ---------------------------- | ------------------------------------------- | ----------------------------------------------------------- |
|
|
129
|
+
| SEA build fails | Node.js version below 22 | Upgrade to Node.js 22+ |
|
|
130
|
+
| Binary crashes on startup | Missing `@FrontMcp` decorated entry | Ensure entry file exports or instantiates a decorated class |
|
|
131
|
+
| Binary too large | All dependencies bundled including dev deps | Review dependencies and remove unused packages from bundle |
|
|
132
|
+
| Permission denied on binary | Missing execute permission | Run `chmod +x dist/my-server` |
|
|
133
|
+
| Binary fails on different OS | SEA binaries are platform-specific | Build on the target OS or use CI matrix builds |
|
|
134
|
+
|
|
135
|
+
## Reference
|
|
136
|
+
|
|
137
|
+
- **Docs:** <https://docs.agentfront.dev/frontmcp/deployment/production-build>
|
|
138
|
+
- **Related skills:** `build-for-sdk`, `build-for-browser`, `deploy-to-cloudflare`
|