@frontmcp/skills 0.0.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.
Files changed (65) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +135 -0
  3. package/catalog/TEMPLATE.md +49 -0
  4. package/catalog/adapters/create-adapter/SKILL.md +127 -0
  5. package/catalog/adapters/official-adapters/SKILL.md +136 -0
  6. package/catalog/auth/configure-auth/SKILL.md +250 -0
  7. package/catalog/auth/configure-auth/references/auth-modes.md +77 -0
  8. package/catalog/auth/configure-session/SKILL.md +201 -0
  9. package/catalog/config/configure-elicitation/SKILL.md +136 -0
  10. package/catalog/config/configure-http/SKILL.md +167 -0
  11. package/catalog/config/configure-throttle/SKILL.md +189 -0
  12. package/catalog/config/configure-throttle/references/guard-config.md +68 -0
  13. package/catalog/config/configure-transport/SKILL.md +151 -0
  14. package/catalog/config/configure-transport/references/protocol-presets.md +57 -0
  15. package/catalog/deployment/build-for-browser/SKILL.md +95 -0
  16. package/catalog/deployment/build-for-cli/SKILL.md +100 -0
  17. package/catalog/deployment/build-for-sdk/SKILL.md +218 -0
  18. package/catalog/deployment/deploy-to-cloudflare/SKILL.md +192 -0
  19. package/catalog/deployment/deploy-to-lambda/SKILL.md +304 -0
  20. package/catalog/deployment/deploy-to-node/SKILL.md +229 -0
  21. package/catalog/deployment/deploy-to-node/references/Dockerfile.example +45 -0
  22. package/catalog/deployment/deploy-to-vercel/SKILL.md +196 -0
  23. package/catalog/deployment/deploy-to-vercel/references/vercel.json.example +60 -0
  24. package/catalog/development/create-agent/SKILL.md +563 -0
  25. package/catalog/development/create-agent/references/llm-config.md +46 -0
  26. package/catalog/development/create-job/SKILL.md +566 -0
  27. package/catalog/development/create-prompt/SKILL.md +400 -0
  28. package/catalog/development/create-provider/SKILL.md +233 -0
  29. package/catalog/development/create-resource/SKILL.md +437 -0
  30. package/catalog/development/create-skill/SKILL.md +526 -0
  31. package/catalog/development/create-skill-with-tools/SKILL.md +579 -0
  32. package/catalog/development/create-tool/SKILL.md +418 -0
  33. package/catalog/development/create-tool/references/output-schema-types.md +56 -0
  34. package/catalog/development/create-tool/references/tool-annotations.md +34 -0
  35. package/catalog/development/create-workflow/SKILL.md +709 -0
  36. package/catalog/development/decorators-guide/SKILL.md +598 -0
  37. package/catalog/plugins/create-plugin/SKILL.md +336 -0
  38. package/catalog/plugins/create-plugin-hooks/SKILL.md +282 -0
  39. package/catalog/plugins/official-plugins/SKILL.md +667 -0
  40. package/catalog/setup/frontmcp-skills-usage/SKILL.md +200 -0
  41. package/catalog/setup/multi-app-composition/SKILL.md +358 -0
  42. package/catalog/setup/nx-workflow/SKILL.md +357 -0
  43. package/catalog/setup/project-structure-nx/SKILL.md +186 -0
  44. package/catalog/setup/project-structure-standalone/SKILL.md +153 -0
  45. package/catalog/setup/setup-project/SKILL.md +493 -0
  46. package/catalog/setup/setup-redis/SKILL.md +385 -0
  47. package/catalog/setup/setup-sqlite/SKILL.md +359 -0
  48. package/catalog/skills-manifest.json +414 -0
  49. package/catalog/testing/setup-testing/SKILL.md +539 -0
  50. package/catalog/testing/setup-testing/references/test-auth.md +88 -0
  51. package/catalog/testing/setup-testing/references/test-browser-build.md +57 -0
  52. package/catalog/testing/setup-testing/references/test-cli-binary.md +48 -0
  53. package/catalog/testing/setup-testing/references/test-direct-client.md +62 -0
  54. package/catalog/testing/setup-testing/references/test-e2e-handler.md +51 -0
  55. package/catalog/testing/setup-testing/references/test-tool-unit.md +41 -0
  56. package/package.json +34 -0
  57. package/src/index.d.ts +3 -0
  58. package/src/index.js +16 -0
  59. package/src/index.js.map +1 -0
  60. package/src/loader.d.ts +46 -0
  61. package/src/loader.js +75 -0
  62. package/src/loader.js.map +1 -0
  63. package/src/manifest.d.ts +81 -0
  64. package/src/manifest.js +26 -0
  65. package/src/manifest.js.map +1 -0
@@ -0,0 +1,95 @@
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
+ ```
@@ -0,0 +1,100 @@
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
+ ```
@@ -0,0 +1,218 @@
1
+ ---
2
+ name: build-for-sdk
3
+ description: Build a FrontMCP server as an embeddable SDK library for Node.js applications without HTTP serving. Use when embedding MCP in existing apps, using connect()/connectOpenAI()/connectClaude(), or distributing as an npm package.
4
+ tags: [deployment, sdk, library, embed, programmatic, connect]
5
+ examples:
6
+ - scenario: Embed MCP tools in an existing Express app
7
+ expected-outcome: Tools callable programmatically without HTTP server
8
+ - scenario: Build SDK for npm distribution
9
+ expected-outcome: CJS + ESM + TypeScript declarations package
10
+ - scenario: Connect tools to OpenAI function calling
11
+ expected-outcome: Tools formatted for OpenAI API consumption
12
+ priority: 8
13
+ visibility: both
14
+ license: Apache-2.0
15
+ metadata:
16
+ docs: https://docs.agentfront.dev/frontmcp/deployment/direct-client
17
+ ---
18
+
19
+ # Building as an SDK Library
20
+
21
+ Build your FrontMCP server as an embeddable library that runs without an HTTP server. Use `create()` for flat-config setup or `connect()` for platform-specific tool formatting (OpenAI, Claude, LangChain, Vercel AI).
22
+
23
+ ## When to Use
24
+
25
+ Use `--target sdk` when:
26
+
27
+ - Embedding MCP tools in an existing Node.js application
28
+ - Distributing your tools as an npm package
29
+ - Connecting tools to LLM platforms (OpenAI, Claude, LangChain, Vercel AI) programmatically
30
+ - Running tools in-memory without network overhead
31
+
32
+ ## Build Command
33
+
34
+ ```bash
35
+ frontmcp build --target sdk
36
+ ```
37
+
38
+ Produces dual-format output:
39
+
40
+ - `{name}.cjs.js` — CommonJS format
41
+ - `{name}.esm.mjs` — ES Module format
42
+ - `*.d.ts` — TypeScript declarations
43
+
44
+ All `@frontmcp/*` dependencies are marked as external (not bundled).
45
+
46
+ ## Disable HTTP Server
47
+
48
+ Set `serve: false` in your `@FrontMcp` decorator to prevent the HTTP listener from starting:
49
+
50
+ ```typescript
51
+ @FrontMcp({
52
+ info: { name: 'my-sdk', version: '1.0.0' },
53
+ apps: [MyApp],
54
+ serve: false, // No HTTP server — library mode only
55
+ })
56
+ class MySDK {}
57
+ ```
58
+
59
+ ## Programmatic Usage with `create()`
60
+
61
+ The `create()` factory spins up a server from a flat config object — no decorators or classes needed:
62
+
63
+ ```typescript
64
+ import { create } from '@frontmcp/sdk';
65
+ import { z } from 'zod';
66
+
67
+ const server = await create({
68
+ info: { name: 'my-service', version: '1.0.0' },
69
+ tools: [
70
+ tool({
71
+ name: 'calculate',
72
+ description: 'Perform calculation',
73
+ inputSchema: { expression: z.string() },
74
+ outputSchema: { result: z.number() },
75
+ })((input) => ({ result: eval(input.expression) })),
76
+ ],
77
+ cacheKey: 'my-service', // Reuse same instance on repeated calls
78
+ });
79
+
80
+ // Call tools directly
81
+ const result = await server.callTool('calculate', { expression: '2 + 2' });
82
+
83
+ // List available tools
84
+ const { tools } = await server.listTools();
85
+
86
+ // Clean up
87
+ await server.dispose();
88
+ ```
89
+
90
+ ### CreateConfig Fields
91
+
92
+ ```typescript
93
+ create({
94
+ // Required
95
+ info: { name: string; version: string },
96
+
97
+ // App-level (merged into synthetic app)
98
+ tools?: ToolType[],
99
+ resources?: ResourceType[],
100
+ prompts?: PromptType[],
101
+ agents?: AgentType[],
102
+ skills?: SkillType[],
103
+ plugins?: PluginType[],
104
+ providers?: ProviderType[],
105
+ adapters?: AdapterType[],
106
+ auth?: AuthOptionsInput,
107
+
108
+ // Server-level
109
+ redis?: RedisOptionsInput,
110
+ transport?: TransportOptionsInput,
111
+ logging?: LoggingOptionsInput,
112
+ elicitation?: ElicitationOptionsInput,
113
+
114
+ // create()-specific
115
+ appName?: string, // defaults to info.name
116
+ cacheKey?: string, // same key = reuse server instance
117
+ machineId?: string, // stable session ID across restarts
118
+ })
119
+ ```
120
+
121
+ ## Platform-Specific Connections
122
+
123
+ Use `connect*()` functions to get tools formatted for a specific LLM platform:
124
+
125
+ ### OpenAI Function Calling
126
+
127
+ ```typescript
128
+ import { connectOpenAI } from '@frontmcp/sdk';
129
+
130
+ const client = await connectOpenAI(MyServerConfig, {
131
+ session: { id: 'user-123', user: { sub: 'user-id' } },
132
+ });
133
+
134
+ const tools = await client.listTools();
135
+ // Returns OpenAI format: [{ type: 'function', function: { name, description, parameters, strict: true } }]
136
+
137
+ const result = await client.callTool('my-tool', { arg: 'value' });
138
+ await client.close();
139
+ ```
140
+
141
+ ### Anthropic Claude
142
+
143
+ ```typescript
144
+ import { connectClaude } from '@frontmcp/sdk';
145
+
146
+ const client = await connectClaude(MyServerConfig);
147
+ const tools = await client.listTools();
148
+ // Returns Claude format: [{ name, description, input_schema }]
149
+ ```
150
+
151
+ ### LangChain
152
+
153
+ ```typescript
154
+ import { connectLangChain } from '@frontmcp/sdk';
155
+
156
+ const client = await connectLangChain(MyServerConfig);
157
+ const tools = await client.listTools();
158
+ // Returns LangChain tool schema format
159
+ ```
160
+
161
+ ### Vercel AI SDK
162
+
163
+ ```typescript
164
+ import { connectVercelAI } from '@frontmcp/sdk';
165
+
166
+ const client = await connectVercelAI(MyServerConfig);
167
+ const tools = await client.listTools();
168
+ // Returns Vercel AI SDK format
169
+ ```
170
+
171
+ ### ConnectOptions
172
+
173
+ ```typescript
174
+ const client = await connectOpenAI(config, {
175
+ clientInfo: { name: 'my-app', version: '1.0' },
176
+ session: { id: 'session-123', user: { sub: 'user-id', name: 'Alice' } },
177
+ authToken: 'jwt-token-here',
178
+ capabilities: { roots: { listChanged: true } },
179
+ });
180
+ ```
181
+
182
+ ## DirectClient API
183
+
184
+ All `connect*()` functions return a `DirectClient` with these methods:
185
+
186
+ | Method | Description |
187
+ | ----------------------- | -------------------------------------- |
188
+ | `listTools()` | List tools in platform-specific format |
189
+ | `callTool(name, args)` | Execute a tool |
190
+ | `listResources()` | List available resources |
191
+ | `readResource(uri)` | Read a resource |
192
+ | `listPrompts()` | List available prompts |
193
+ | `getPrompt(name, args)` | Get a prompt |
194
+ | `close()` | Clean up connection |
195
+
196
+ ## SDK vs Node Target
197
+
198
+ | Aspect | `--target sdk` | `--target node` |
199
+ | ------------ | --------------------------------- | --------------------- |
200
+ | Output | CJS + ESM + .d.ts | Single JS executable |
201
+ | HTTP server | No (`serve: false`) | Yes (listens on port) |
202
+ | Use case | Library/embed in apps | Standalone deployment |
203
+ | Distribution | npm package | Docker/binary |
204
+ | Tool format | Platform-specific via connect\*() | Raw MCP protocol |
205
+
206
+ ## Verification
207
+
208
+ ```bash
209
+ # Build
210
+ frontmcp build --target sdk
211
+
212
+ # Check outputs
213
+ ls dist/
214
+ # my-sdk.cjs.js my-sdk.esm.mjs *.d.ts
215
+
216
+ # Test programmatically
217
+ node -e "const { create } = require('./dist/my-sdk.cjs.js'); ..."
218
+ ```
@@ -0,0 +1,192 @@
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.