@frontmcp/skills 0.0.1 → 1.0.0-beta.10
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 +2 -2
- package/catalog/TEMPLATE.md +58 -13
- package/catalog/frontmcp-config/SKILL.md +143 -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 +127 -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} +76 -63
- package/catalog/{deployment/deploy-to-node/references/Dockerfile.example → frontmcp-deployment/references/deploy-to-node-dockerfile.md} +13 -4
- package/catalog/{deployment/deploy-to-node/SKILL.md → frontmcp-deployment/references/deploy-to-node.md} +68 -40
- 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 +121 -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} +96 -22
- 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} +96 -31
- package/catalog/frontmcp-guides/SKILL.md +420 -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-production-readiness/SKILL.md +253 -0
- package/catalog/frontmcp-setup/SKILL.md +130 -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 +127 -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 +39 -378
- package/package.json +2 -2
- package/src/loader.js +0 -1
- package/src/loader.js.map +1 -1
- package/src/manifest.d.ts +3 -3
- package/src/manifest.js +2 -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
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: configure-transport
|
|
3
|
-
description: Choose and configure transport protocols — SSE, Streamable HTTP, stateless API, or legacy. Use when deciding between transport modes, enabling distributed sessions, or configuring event stores.
|
|
4
|
-
tags: [transport, sse, streamable-http, stateless, protocol, session]
|
|
5
|
-
parameters:
|
|
6
|
-
- name: preset
|
|
7
|
-
description: Protocol preset (legacy, modern, stateless-api, full)
|
|
8
|
-
type: string
|
|
9
|
-
default: legacy
|
|
10
|
-
examples:
|
|
11
|
-
- scenario: Use modern SSE + Streamable HTTP for production
|
|
12
|
-
expected-outcome: Server accepts both SSE and streamable HTTP connections
|
|
13
|
-
- scenario: Configure stateless API for serverless
|
|
14
|
-
expected-outcome: No session state, pure request/response
|
|
15
|
-
priority: 8
|
|
16
|
-
visibility: both
|
|
17
|
-
license: Apache-2.0
|
|
18
|
-
metadata:
|
|
19
|
-
docs: https://docs.agentfront.dev/frontmcp/deployment/runtime-modes
|
|
20
|
-
---
|
|
21
|
-
|
|
22
|
-
# Configuring Transport
|
|
23
|
-
|
|
24
|
-
Configure how clients connect to your FrontMCP server — SSE, Streamable HTTP, stateless API, or a combination.
|
|
25
|
-
|
|
26
|
-
## When to Use
|
|
27
|
-
|
|
28
|
-
Configure transport when:
|
|
29
|
-
|
|
30
|
-
- Choosing between SSE and Streamable HTTP protocols
|
|
31
|
-
- Deploying to serverless (needs stateless mode)
|
|
32
|
-
- Running multiple server instances (needs distributed sessions)
|
|
33
|
-
- Enabling SSE event resumability
|
|
34
|
-
|
|
35
|
-
## TransportOptionsInput
|
|
36
|
-
|
|
37
|
-
```typescript
|
|
38
|
-
@FrontMcp({
|
|
39
|
-
info: { name: 'my-server', version: '1.0.0' },
|
|
40
|
-
apps: [MyApp],
|
|
41
|
-
transport: {
|
|
42
|
-
sessionMode: 'stateful', // 'stateful' | 'stateless'
|
|
43
|
-
protocol: 'legacy', // preset or custom ProtocolConfig
|
|
44
|
-
persistence: {
|
|
45
|
-
// false to disable
|
|
46
|
-
redis: { provider: 'redis', host: 'localhost', port: 6379 },
|
|
47
|
-
defaultTtlMs: 3600000,
|
|
48
|
-
},
|
|
49
|
-
distributedMode: 'auto', // boolean | 'auto'
|
|
50
|
-
eventStore: {
|
|
51
|
-
enabled: true,
|
|
52
|
-
provider: 'redis', // 'memory' | 'redis'
|
|
53
|
-
maxEvents: 10000,
|
|
54
|
-
ttlMs: 300000,
|
|
55
|
-
},
|
|
56
|
-
},
|
|
57
|
-
})
|
|
58
|
-
class Server {}
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
## Protocol Presets
|
|
62
|
-
|
|
63
|
-
Choose a preset that matches your deployment:
|
|
64
|
-
|
|
65
|
-
| Preset | SSE | Streamable HTTP | JSON | Stateless | Legacy SSE | Strict Session |
|
|
66
|
-
| -------------------- | --- | --------------- | ---- | --------- | ---------- | -------------- |
|
|
67
|
-
| `'legacy'` (default) | Yes | Yes | No | No | Yes | Yes |
|
|
68
|
-
| `'modern'` | Yes | Yes | No | No | No | Yes |
|
|
69
|
-
| `'stateless-api'` | No | No | No | Yes | No | No |
|
|
70
|
-
| `'full'` | Yes | Yes | Yes | Yes | Yes | No |
|
|
71
|
-
|
|
72
|
-
### When to Use Each
|
|
73
|
-
|
|
74
|
-
- **`'legacy'`** — Default. Maximum compatibility with all MCP clients (Claude Desktop, etc.). Best for Node.js deployments.
|
|
75
|
-
- **`'modern'`** — Drop legacy SSE support. Use when all clients support modern MCP protocol.
|
|
76
|
-
- **`'stateless-api'`** — No sessions, pure request/response. Use for **Vercel**, **Lambda**, and other serverless targets.
|
|
77
|
-
- **`'full'`** — All protocols enabled. Use for development or when you need every transport option.
|
|
78
|
-
|
|
79
|
-
### Custom Protocol Config
|
|
80
|
-
|
|
81
|
-
Override individual protocol flags:
|
|
82
|
-
|
|
83
|
-
```typescript
|
|
84
|
-
transport: {
|
|
85
|
-
protocol: {
|
|
86
|
-
sse: true, // SSE listener endpoint
|
|
87
|
-
streamable: true, // Streamable HTTP POST
|
|
88
|
-
json: false, // JSON-only responses (no streaming)
|
|
89
|
-
stateless: false, // Stateless HTTP (no sessions)
|
|
90
|
-
legacy: false, // Legacy SSE transport
|
|
91
|
-
strictSession: true, // Require session ID for streamable HTTP
|
|
92
|
-
},
|
|
93
|
-
}
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
## Distributed Sessions
|
|
97
|
-
|
|
98
|
-
For multi-instance deployments (load balanced), enable persistence with Redis:
|
|
99
|
-
|
|
100
|
-
```typescript
|
|
101
|
-
transport: {
|
|
102
|
-
distributedMode: true,
|
|
103
|
-
persistence: {
|
|
104
|
-
redis: { provider: 'redis', host: 'redis.internal', port: 6379 },
|
|
105
|
-
defaultTtlMs: 3600000, // 1 hour session TTL
|
|
106
|
-
},
|
|
107
|
-
}
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
- `distributedMode: 'auto'` — auto-detect based on whether Redis is configured
|
|
111
|
-
- `distributedMode: true` — force distributed mode (requires Redis)
|
|
112
|
-
- `distributedMode: false` — single-instance mode (in-memory sessions)
|
|
113
|
-
|
|
114
|
-
## Event Store (SSE Resumability)
|
|
115
|
-
|
|
116
|
-
Enable event store so clients can resume SSE connections after disconnects:
|
|
117
|
-
|
|
118
|
-
```typescript
|
|
119
|
-
transport: {
|
|
120
|
-
eventStore: {
|
|
121
|
-
enabled: true,
|
|
122
|
-
provider: 'redis', // 'memory' for single instance, 'redis' for distributed
|
|
123
|
-
maxEvents: 10000, // max events to store
|
|
124
|
-
ttlMs: 300000, // 5 minute TTL
|
|
125
|
-
redis: { provider: 'redis', host: 'localhost' },
|
|
126
|
-
},
|
|
127
|
-
}
|
|
128
|
-
```
|
|
129
|
-
|
|
130
|
-
## Target-Specific Recommendations
|
|
131
|
-
|
|
132
|
-
| Target | Recommended Preset | Persistence | Event Store |
|
|
133
|
-
| ------------------------ | ------------------ | ----------- | ----------- |
|
|
134
|
-
| Node.js (single) | `'legacy'` | `false` | Memory |
|
|
135
|
-
| Node.js (multi-instance) | `'modern'` | Redis | Redis |
|
|
136
|
-
| Vercel | `'stateless-api'` | `false` | Disabled |
|
|
137
|
-
| Lambda | `'stateless-api'` | `false` | Disabled |
|
|
138
|
-
| Cloudflare | `'stateless-api'` | `false` | Disabled |
|
|
139
|
-
|
|
140
|
-
## Verification
|
|
141
|
-
|
|
142
|
-
```bash
|
|
143
|
-
# Start server and test SSE
|
|
144
|
-
frontmcp dev
|
|
145
|
-
|
|
146
|
-
# Test SSE endpoint
|
|
147
|
-
curl -N http://localhost:3001/sse
|
|
148
|
-
|
|
149
|
-
# Test streamable HTTP
|
|
150
|
-
curl -X POST http://localhost:3001/ -H 'Content-Type: application/json' -d '{"jsonrpc":"2.0","method":"tools/list","id":1}'
|
|
151
|
-
```
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: build-for-browser
|
|
3
|
-
description: Build a FrontMCP server for browser environments. Use when creating browser-compatible MCP clients, embedding MCP in web apps, or building client-side tool interfaces.
|
|
4
|
-
tags: [deployment, browser, client, web, frontend]
|
|
5
|
-
examples:
|
|
6
|
-
- scenario: Build browser bundle for a React web application
|
|
7
|
-
expected-outcome: Browser-compatible JS bundle importable in frontend code
|
|
8
|
-
- scenario: Create a browser-based MCP client
|
|
9
|
-
expected-outcome: Client-side MCP tools running in the browser
|
|
10
|
-
priority: 6
|
|
11
|
-
visibility: both
|
|
12
|
-
license: Apache-2.0
|
|
13
|
-
metadata:
|
|
14
|
-
docs: https://docs.agentfront.dev/frontmcp/deployment/browser-compatibility
|
|
15
|
-
---
|
|
16
|
-
|
|
17
|
-
# Building for Browser
|
|
18
|
-
|
|
19
|
-
Build your FrontMCP server or client for browser environments.
|
|
20
|
-
|
|
21
|
-
## When to Use
|
|
22
|
-
|
|
23
|
-
Use `--target browser` when:
|
|
24
|
-
|
|
25
|
-
- Embedding MCP tools in a web application
|
|
26
|
-
- Building a browser-based MCP client with `@frontmcp/react`
|
|
27
|
-
- Creating client-side tool interfaces that connect to a remote MCP server
|
|
28
|
-
|
|
29
|
-
## Build Command
|
|
30
|
-
|
|
31
|
-
```bash
|
|
32
|
-
frontmcp build --target browser
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
### Options
|
|
36
|
-
|
|
37
|
-
```bash
|
|
38
|
-
frontmcp build --target browser -o ./dist/browser # Custom output directory
|
|
39
|
-
frontmcp build --target browser -e ./src/client.ts # Custom entry file
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
## Browser Limitations
|
|
43
|
-
|
|
44
|
-
Not all FrontMCP features are available in browser environments:
|
|
45
|
-
|
|
46
|
-
| Feature | Browser Support | Notes |
|
|
47
|
-
| --------------------------- | --------------- | ----------------------------------------- |
|
|
48
|
-
| Tools (client-side) | Yes | Can define and run tools |
|
|
49
|
-
| Resources | Yes | Read-only access |
|
|
50
|
-
| Prompts | Yes | Full support |
|
|
51
|
-
| Redis | No | Use in-memory or connect to server |
|
|
52
|
-
| SQLite | No | No filesystem access |
|
|
53
|
-
| File system utilities | No | `@frontmcp/utils` fs ops throw in browser |
|
|
54
|
-
| Crypto (`@frontmcp/utils`) | Yes | Uses WebCrypto API |
|
|
55
|
-
| Direct client (`connect()`) | Yes | In-memory connection |
|
|
56
|
-
|
|
57
|
-
## Usage with @frontmcp/react
|
|
58
|
-
|
|
59
|
-
The browser build is commonly paired with `@frontmcp/react` for React applications:
|
|
60
|
-
|
|
61
|
-
```typescript
|
|
62
|
-
import { FrontMcpProvider, useTools } from '@frontmcp/react';
|
|
63
|
-
|
|
64
|
-
function App() {
|
|
65
|
-
return (
|
|
66
|
-
<FrontMcpProvider config={{ serverUrl: 'https://my-mcp.example.com' }}>
|
|
67
|
-
<ToolUI />
|
|
68
|
-
</FrontMcpProvider>
|
|
69
|
-
);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
function ToolUI() {
|
|
73
|
-
const { tools, callTool } = useTools();
|
|
74
|
-
// Use tools in your React components
|
|
75
|
-
}
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
## Browser vs Node vs SDK Target
|
|
79
|
-
|
|
80
|
-
| Aspect | `--target browser` | `--target node` | `--target sdk` |
|
|
81
|
-
| ----------- | ------------------ | ----------------- | ------------------- |
|
|
82
|
-
| Runtime | Browser | Node.js server | Node.js library |
|
|
83
|
-
| Output | Browser bundle | Server executable | CJS + ESM + types |
|
|
84
|
-
| HTTP server | No | Yes | No (`serve: false`) |
|
|
85
|
-
| Use case | Frontend apps | Standalone server | Embed in Node apps |
|
|
86
|
-
|
|
87
|
-
## Verification
|
|
88
|
-
|
|
89
|
-
```bash
|
|
90
|
-
# Build
|
|
91
|
-
frontmcp build --target browser
|
|
92
|
-
|
|
93
|
-
# Check output
|
|
94
|
-
ls dist/browser/
|
|
95
|
-
```
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: build-for-cli
|
|
3
|
-
description: Build a distributable CLI binary (SEA) or JS bundle from an MCP server. Use when creating standalone executables, CLI tools, or self-contained binaries.
|
|
4
|
-
tags: [deployment, cli, binary, sea, executable]
|
|
5
|
-
parameters:
|
|
6
|
-
- name: output-format
|
|
7
|
-
description: Output as native binary (default) or JS bundle (--js)
|
|
8
|
-
type: string
|
|
9
|
-
default: binary
|
|
10
|
-
examples:
|
|
11
|
-
- scenario: Build a standalone CLI binary for distribution
|
|
12
|
-
expected-outcome: Single executable file that runs without Node.js installed
|
|
13
|
-
- scenario: Build a JS bundle for Node.js execution
|
|
14
|
-
expected-outcome: Bundled JS file runnable with node
|
|
15
|
-
priority: 7
|
|
16
|
-
visibility: both
|
|
17
|
-
license: Apache-2.0
|
|
18
|
-
metadata:
|
|
19
|
-
docs: https://docs.agentfront.dev/frontmcp/deployment/production-build
|
|
20
|
-
---
|
|
21
|
-
|
|
22
|
-
# Building a CLI Binary
|
|
23
|
-
|
|
24
|
-
Build your FrontMCP server as a distributable CLI binary using Node.js Single Executable Applications (SEA) or as a bundled JS file.
|
|
25
|
-
|
|
26
|
-
## When to Use
|
|
27
|
-
|
|
28
|
-
Use `--target cli` when you want to distribute your MCP server as:
|
|
29
|
-
|
|
30
|
-
- A standalone executable that end users run without installing Node.js
|
|
31
|
-
- A CLI tool installable via package managers
|
|
32
|
-
- A self-contained binary for deployment without dependencies
|
|
33
|
-
|
|
34
|
-
## Build Commands
|
|
35
|
-
|
|
36
|
-
### Native Binary (SEA)
|
|
37
|
-
|
|
38
|
-
```bash
|
|
39
|
-
frontmcp build --target cli
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
Produces a Node.js Single Executable Application — a single binary embedding your server code and the Node.js runtime.
|
|
43
|
-
|
|
44
|
-
### JS Bundle Only
|
|
45
|
-
|
|
46
|
-
```bash
|
|
47
|
-
frontmcp build --target cli --js
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
Produces a bundled JS file without the native binary wrapper. Run with `node dist/server.js`.
|
|
51
|
-
|
|
52
|
-
### Options
|
|
53
|
-
|
|
54
|
-
```bash
|
|
55
|
-
frontmcp build --target cli -o ./build # Custom output directory
|
|
56
|
-
frontmcp build --target cli -e ./src/main.ts # Custom entry file
|
|
57
|
-
frontmcp build --target cli --js # JS bundle only (no SEA)
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
## Requirements
|
|
61
|
-
|
|
62
|
-
- **Node.js 22+** required for SEA support
|
|
63
|
-
- The entry file must export or instantiate a `@FrontMcp` decorated class
|
|
64
|
-
- SEA binaries are platform-specific (build on macOS for macOS, Linux for Linux)
|
|
65
|
-
|
|
66
|
-
## CLI Target vs Node Target
|
|
67
|
-
|
|
68
|
-
| Aspect | `--target cli` | `--target node` |
|
|
69
|
-
| -------- | ---------------------------------- | ------------------------------ |
|
|
70
|
-
| Output | Single binary or JS bundle | JS files for server deployment |
|
|
71
|
-
| Runtime | Embedded Node.js (SEA) or external | Requires Node.js installed |
|
|
72
|
-
| Use case | Distribution to end users | Server deployment (Docker, VM) |
|
|
73
|
-
| Includes | Bundled dependencies | External node_modules |
|
|
74
|
-
|
|
75
|
-
## Server Configuration for CLI Mode
|
|
76
|
-
|
|
77
|
-
When building for CLI distribution, configure your server for local/stdin transport:
|
|
78
|
-
|
|
79
|
-
```typescript
|
|
80
|
-
@FrontMcp({
|
|
81
|
-
info: { name: 'my-cli-tool', version: '1.0.0' },
|
|
82
|
-
apps: [MyApp],
|
|
83
|
-
http: { socketPath: '/tmp/my-tool.sock' }, // Unix socket instead of TCP
|
|
84
|
-
sqlite: { path: '~/.my-tool/data.db' }, // Local storage
|
|
85
|
-
})
|
|
86
|
-
class MyCLIServer {}
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
## Verification
|
|
90
|
-
|
|
91
|
-
```bash
|
|
92
|
-
# Build
|
|
93
|
-
frontmcp build --target cli
|
|
94
|
-
|
|
95
|
-
# Test the binary
|
|
96
|
-
./dist/my-server --help
|
|
97
|
-
|
|
98
|
-
# Or test JS bundle
|
|
99
|
-
node dist/my-server.cjs.js
|
|
100
|
-
```
|
|
@@ -1,192 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: deploy-to-cloudflare
|
|
3
|
-
description: Deploy a FrontMCP server to Cloudflare Workers. Use when deploying to Cloudflare, configuring wrangler.toml, or setting up Workers KV storage.
|
|
4
|
-
tags:
|
|
5
|
-
- deployment
|
|
6
|
-
- cloudflare
|
|
7
|
-
- workers
|
|
8
|
-
- serverless
|
|
9
|
-
parameters:
|
|
10
|
-
- name: worker-name
|
|
11
|
-
description: Name for the Cloudflare Worker
|
|
12
|
-
type: string
|
|
13
|
-
required: false
|
|
14
|
-
default: frontmcp-worker
|
|
15
|
-
- name: kv-namespace
|
|
16
|
-
description: KV namespace binding name for session and state storage
|
|
17
|
-
type: string
|
|
18
|
-
required: false
|
|
19
|
-
- name: compatibility-date
|
|
20
|
-
description: Cloudflare Workers compatibility date
|
|
21
|
-
type: string
|
|
22
|
-
required: false
|
|
23
|
-
default: '2024-01-01'
|
|
24
|
-
examples:
|
|
25
|
-
- scenario: Deploy a basic MCP server to Cloudflare Workers
|
|
26
|
-
parameters:
|
|
27
|
-
worker-name: my-mcp-worker
|
|
28
|
-
expectedOutcome: A FrontMCP server running as a Cloudflare Worker with wrangler.toml configured and deployed via wrangler deploy.
|
|
29
|
-
- scenario: Deploy with Workers KV for persistent storage
|
|
30
|
-
parameters:
|
|
31
|
-
worker-name: my-mcp-worker
|
|
32
|
-
kv-namespace: FRONTMCP_KV
|
|
33
|
-
expectedOutcome: A FrontMCP server with Cloudflare KV providing persistent storage for sessions and skill state.
|
|
34
|
-
compatibility: Wrangler CLI required. Cloudflare Workers support is experimental.
|
|
35
|
-
license: Apache-2.0
|
|
36
|
-
visibility: both
|
|
37
|
-
priority: 10
|
|
38
|
-
metadata:
|
|
39
|
-
category: deployment
|
|
40
|
-
difficulty: intermediate
|
|
41
|
-
platform: cloudflare
|
|
42
|
-
docs: https://docs.agentfront.dev/frontmcp/deployment/serverless
|
|
43
|
-
---
|
|
44
|
-
|
|
45
|
-
# Deploy a FrontMCP Server to Cloudflare Workers
|
|
46
|
-
|
|
47
|
-
This skill guides you through deploying a FrontMCP server to Cloudflare Workers.
|
|
48
|
-
|
|
49
|
-
<Warning>
|
|
50
|
-
Cloudflare Workers support is **experimental**. The Express-to-Workers adapter has limitations with streaming, certain middleware, and some response methods. For production Cloudflare deployments, consider using Hono or native Workers APIs.
|
|
51
|
-
</Warning>
|
|
52
|
-
|
|
53
|
-
## Prerequisites
|
|
54
|
-
|
|
55
|
-
- A Cloudflare account (https://dash.cloudflare.com)
|
|
56
|
-
- Wrangler CLI installed: `npm install -g wrangler`
|
|
57
|
-
- A built FrontMCP project
|
|
58
|
-
|
|
59
|
-
## Step 1: Create a Cloudflare-targeted Project
|
|
60
|
-
|
|
61
|
-
```bash
|
|
62
|
-
npx frontmcp create my-app --target cloudflare
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
This generates the project with a `wrangler.toml` and a deploy script (`npm run deploy` runs `wrangler deploy`).
|
|
66
|
-
|
|
67
|
-
## Step 2: Build for Cloudflare
|
|
68
|
-
|
|
69
|
-
```bash
|
|
70
|
-
frontmcp build --target cloudflare
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
This produces:
|
|
74
|
-
|
|
75
|
-
```
|
|
76
|
-
dist/
|
|
77
|
-
main.js # Your compiled server (CommonJS)
|
|
78
|
-
index.js # Cloudflare handler wrapper
|
|
79
|
-
wrangler.toml # Wrangler configuration
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
Cloudflare Workers use CommonJS (not ESM). The build command sets `--module commonjs` automatically.
|
|
83
|
-
|
|
84
|
-
## Step 3: Configure wrangler.toml
|
|
85
|
-
|
|
86
|
-
The generated `wrangler.toml`:
|
|
87
|
-
|
|
88
|
-
```toml
|
|
89
|
-
name = "frontmcp-worker"
|
|
90
|
-
main = "dist/index.js"
|
|
91
|
-
compatibility_date = "2024-01-01"
|
|
92
|
-
|
|
93
|
-
[vars]
|
|
94
|
-
NODE_ENV = "production"
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
To add KV storage for sessions and state:
|
|
98
|
-
|
|
99
|
-
```toml
|
|
100
|
-
name = "frontmcp-worker"
|
|
101
|
-
main = "dist/index.js"
|
|
102
|
-
compatibility_date = "2024-01-01"
|
|
103
|
-
|
|
104
|
-
[[kv_namespaces]]
|
|
105
|
-
binding = "FRONTMCP_KV"
|
|
106
|
-
id = "your-kv-namespace-id"
|
|
107
|
-
|
|
108
|
-
[vars]
|
|
109
|
-
NODE_ENV = "production"
|
|
110
|
-
```
|
|
111
|
-
|
|
112
|
-
Create the KV namespace via the dashboard or CLI:
|
|
113
|
-
|
|
114
|
-
```bash
|
|
115
|
-
wrangler kv:namespace create FRONTMCP_KV
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
Copy the returned `id` into your `wrangler.toml`.
|
|
119
|
-
|
|
120
|
-
## Step 4: Configure the Server
|
|
121
|
-
|
|
122
|
-
```typescript
|
|
123
|
-
import { FrontMcp, App } from '@frontmcp/sdk';
|
|
124
|
-
|
|
125
|
-
@App()
|
|
126
|
-
class MyApp {}
|
|
127
|
-
|
|
128
|
-
@FrontMcp({
|
|
129
|
-
info: { name: 'my-worker', version: '1.0.0' },
|
|
130
|
-
apps: [MyApp],
|
|
131
|
-
transport: {
|
|
132
|
-
type: 'sse',
|
|
133
|
-
},
|
|
134
|
-
})
|
|
135
|
-
class MyServer {}
|
|
136
|
-
|
|
137
|
-
export default MyServer;
|
|
138
|
-
```
|
|
139
|
-
|
|
140
|
-
For KV-backed session storage, use the Cloudflare KV or Upstash Redis provider.
|
|
141
|
-
|
|
142
|
-
## Step 5: Deploy
|
|
143
|
-
|
|
144
|
-
```bash
|
|
145
|
-
# Preview deployment
|
|
146
|
-
wrangler dev
|
|
147
|
-
|
|
148
|
-
# Production deployment
|
|
149
|
-
wrangler deploy
|
|
150
|
-
```
|
|
151
|
-
|
|
152
|
-
### Custom Domain
|
|
153
|
-
|
|
154
|
-
Configure a custom domain in the Cloudflare dashboard under **Workers & Pages > your worker > Settings > Domains & Routes**, or via wrangler:
|
|
155
|
-
|
|
156
|
-
```bash
|
|
157
|
-
wrangler domains add mcp.example.com
|
|
158
|
-
```
|
|
159
|
-
|
|
160
|
-
## Step 6: Verify
|
|
161
|
-
|
|
162
|
-
```bash
|
|
163
|
-
# Health check
|
|
164
|
-
curl https://frontmcp-worker.your-subdomain.workers.dev/health
|
|
165
|
-
|
|
166
|
-
# Test MCP endpoint
|
|
167
|
-
curl -X POST https://frontmcp-worker.your-subdomain.workers.dev/mcp \
|
|
168
|
-
-H "Content-Type: application/json" \
|
|
169
|
-
-d '{"jsonrpc":"2.0","method":"tools/list","id":1}'
|
|
170
|
-
```
|
|
171
|
-
|
|
172
|
-
## Workers Limitations
|
|
173
|
-
|
|
174
|
-
- **Bundle size**: Workers have a 1 MB compressed / 10 MB uncompressed limit (paid plan: 10 MB / 30 MB). Use `frontmcp build --target cloudflare --analyze` to inspect the bundle.
|
|
175
|
-
- **CPU time**: 10 ms CPU time on free plan, 30 seconds on paid. Long-running operations must be optimized or use Durable Objects.
|
|
176
|
-
- **No native modules**: `better-sqlite3` and other native Node.js modules are not available. Use KV, D1, or Upstash Redis for storage.
|
|
177
|
-
- **Streaming**: SSE streaming may have limitations through the Workers adapter. Test thoroughly.
|
|
178
|
-
|
|
179
|
-
## Storage Options
|
|
180
|
-
|
|
181
|
-
| Storage | Use Case | Notes |
|
|
182
|
-
| ------------- | ----------------------------- | --------------------------------- |
|
|
183
|
-
| Cloudflare KV | Simple key-value, low write | Eventually consistent, fast reads |
|
|
184
|
-
| Upstash Redis | Sessions, pub/sub, high write | Redis-compatible REST API |
|
|
185
|
-
| Cloudflare D1 | Relational data | SQLite-based, serverless |
|
|
186
|
-
|
|
187
|
-
## Troubleshooting
|
|
188
|
-
|
|
189
|
-
- **Worker exceeds size limit**: Minimize dependencies. Run `frontmcp build --target cloudflare --analyze` and remove unused packages.
|
|
190
|
-
- **Module format errors**: Ensure `wrangler.toml` does not set `type = "module"`. FrontMCP Cloudflare builds use CommonJS.
|
|
191
|
-
- **KV binding errors**: Verify the KV namespace is created and the binding name in `wrangler.toml` matches your code.
|
|
192
|
-
- **Timeout errors**: Check CPU time limits for your Cloudflare plan. Optimize or offload heavy computation.
|