@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.
Files changed (88) hide show
  1. package/README.md +2 -2
  2. package/catalog/TEMPLATE.md +58 -13
  3. package/catalog/frontmcp-config/SKILL.md +143 -0
  4. package/catalog/frontmcp-config/references/configure-auth.md +238 -0
  5. package/catalog/frontmcp-config/references/configure-elicitation.md +178 -0
  6. package/catalog/frontmcp-config/references/configure-http.md +205 -0
  7. package/catalog/frontmcp-config/references/configure-session.md +205 -0
  8. package/catalog/frontmcp-config/references/configure-throttle.md +229 -0
  9. package/catalog/frontmcp-config/references/configure-transport.md +195 -0
  10. package/catalog/frontmcp-config/references/setup-redis.md +4 -0
  11. package/catalog/frontmcp-config/references/setup-sqlite.md +4 -0
  12. package/catalog/frontmcp-deployment/SKILL.md +127 -0
  13. package/catalog/frontmcp-deployment/references/build-for-browser.md +138 -0
  14. package/catalog/frontmcp-deployment/references/build-for-cli.md +138 -0
  15. package/catalog/{deployment/build-for-sdk/SKILL.md → frontmcp-deployment/references/build-for-sdk.md} +65 -24
  16. package/catalog/frontmcp-deployment/references/deploy-to-cloudflare.md +213 -0
  17. package/catalog/{deployment/deploy-to-lambda/SKILL.md → frontmcp-deployment/references/deploy-to-lambda.md} +76 -63
  18. package/catalog/{deployment/deploy-to-node/references/Dockerfile.example → frontmcp-deployment/references/deploy-to-node-dockerfile.md} +13 -4
  19. package/catalog/{deployment/deploy-to-node/SKILL.md → frontmcp-deployment/references/deploy-to-node.md} +68 -40
  20. package/catalog/frontmcp-deployment/references/deploy-to-vercel-config.md +60 -0
  21. package/catalog/frontmcp-deployment/references/deploy-to-vercel.md +224 -0
  22. package/catalog/frontmcp-development/SKILL.md +121 -0
  23. package/catalog/frontmcp-development/references/create-adapter.md +165 -0
  24. package/catalog/{development/create-agent/references/llm-config.md → frontmcp-development/references/create-agent-llm-config.md} +5 -5
  25. package/catalog/{development/create-agent/SKILL.md → frontmcp-development/references/create-agent.md} +82 -44
  26. package/catalog/{development/create-job/SKILL.md → frontmcp-development/references/create-job.md} +61 -19
  27. package/catalog/{plugins/create-plugin-hooks/SKILL.md → frontmcp-development/references/create-plugin-hooks.md} +63 -11
  28. package/catalog/{plugins/create-plugin/SKILL.md → frontmcp-development/references/create-plugin.md} +65 -60
  29. package/catalog/{development/create-prompt/SKILL.md → frontmcp-development/references/create-prompt.md} +62 -26
  30. package/catalog/{development/create-provider/SKILL.md → frontmcp-development/references/create-provider.md} +62 -27
  31. package/catalog/{development/create-resource/SKILL.md → frontmcp-development/references/create-resource.md} +62 -30
  32. package/catalog/{development/create-skill-with-tools/SKILL.md → frontmcp-development/references/create-skill-with-tools.md} +69 -24
  33. package/catalog/{development/create-skill/SKILL.md → frontmcp-development/references/create-skill.md} +96 -22
  34. package/catalog/{development/create-tool/SKILL.md → frontmcp-development/references/create-tool.md} +62 -26
  35. package/catalog/{development/create-workflow/SKILL.md → frontmcp-development/references/create-workflow.md} +60 -18
  36. package/catalog/{development/decorators-guide/SKILL.md → frontmcp-development/references/decorators-guide.md} +123 -34
  37. package/catalog/frontmcp-development/references/official-adapters.md +194 -0
  38. package/catalog/{plugins/official-plugins/SKILL.md → frontmcp-development/references/official-plugins.md} +96 -31
  39. package/catalog/frontmcp-guides/SKILL.md +420 -0
  40. package/catalog/frontmcp-guides/references/example-knowledge-base.md +636 -0
  41. package/catalog/frontmcp-guides/references/example-task-manager.md +512 -0
  42. package/catalog/frontmcp-guides/references/example-weather-api.md +292 -0
  43. package/catalog/frontmcp-production-readiness/SKILL.md +253 -0
  44. package/catalog/frontmcp-setup/SKILL.md +130 -0
  45. package/catalog/frontmcp-setup/references/frontmcp-skills-usage.md +265 -0
  46. package/catalog/{setup/multi-app-composition/SKILL.md → frontmcp-setup/references/multi-app-composition.md} +65 -23
  47. package/catalog/{setup/nx-workflow/SKILL.md → frontmcp-setup/references/nx-workflow.md} +78 -21
  48. package/catalog/frontmcp-setup/references/project-structure-nx.md +246 -0
  49. package/catalog/frontmcp-setup/references/project-structure-standalone.md +212 -0
  50. package/catalog/{setup/setup-project/SKILL.md → frontmcp-setup/references/setup-project.md} +62 -62
  51. package/catalog/{setup/setup-redis/SKILL.md → frontmcp-setup/references/setup-redis.md} +59 -86
  52. package/catalog/{setup/setup-sqlite/SKILL.md → frontmcp-setup/references/setup-sqlite.md} +64 -76
  53. package/catalog/frontmcp-testing/SKILL.md +127 -0
  54. package/catalog/{testing/setup-testing/SKILL.md → frontmcp-testing/references/setup-testing.md} +78 -67
  55. package/catalog/{testing/setup-testing → frontmcp-testing}/references/test-tool-unit.md +1 -0
  56. package/catalog/skills-manifest.json +39 -378
  57. package/package.json +2 -2
  58. package/src/loader.js +0 -1
  59. package/src/loader.js.map +1 -1
  60. package/src/manifest.d.ts +3 -3
  61. package/src/manifest.js +2 -3
  62. package/src/manifest.js.map +1 -1
  63. package/catalog/adapters/create-adapter/SKILL.md +0 -127
  64. package/catalog/adapters/official-adapters/SKILL.md +0 -136
  65. package/catalog/auth/configure-auth/SKILL.md +0 -250
  66. package/catalog/auth/configure-session/SKILL.md +0 -201
  67. package/catalog/config/configure-elicitation/SKILL.md +0 -136
  68. package/catalog/config/configure-http/SKILL.md +0 -167
  69. package/catalog/config/configure-throttle/SKILL.md +0 -189
  70. package/catalog/config/configure-transport/SKILL.md +0 -151
  71. package/catalog/deployment/build-for-browser/SKILL.md +0 -95
  72. package/catalog/deployment/build-for-cli/SKILL.md +0 -100
  73. package/catalog/deployment/deploy-to-cloudflare/SKILL.md +0 -192
  74. package/catalog/deployment/deploy-to-vercel/SKILL.md +0 -196
  75. package/catalog/deployment/deploy-to-vercel/references/vercel.json.example +0 -60
  76. package/catalog/setup/frontmcp-skills-usage/SKILL.md +0 -200
  77. package/catalog/setup/project-structure-nx/SKILL.md +0 -186
  78. package/catalog/setup/project-structure-standalone/SKILL.md +0 -153
  79. /package/catalog/{auth/configure-auth/references/auth-modes.md → frontmcp-config/references/configure-auth-modes.md} +0 -0
  80. /package/catalog/{config/configure-throttle/references/guard-config.md → frontmcp-config/references/configure-throttle-guard-config.md} +0 -0
  81. /package/catalog/{config/configure-transport/references/protocol-presets.md → frontmcp-config/references/configure-transport-protocol-presets.md} +0 -0
  82. /package/catalog/{development/create-tool/references/tool-annotations.md → frontmcp-development/references/create-tool-annotations.md} +0 -0
  83. /package/catalog/{development/create-tool/references/output-schema-types.md → frontmcp-development/references/create-tool-output-schema-types.md} +0 -0
  84. /package/catalog/{testing/setup-testing → frontmcp-testing}/references/test-auth.md +0 -0
  85. /package/catalog/{testing/setup-testing → frontmcp-testing}/references/test-browser-build.md +0 -0
  86. /package/catalog/{testing/setup-testing → frontmcp-testing}/references/test-cli-binary.md +0 -0
  87. /package/catalog/{testing/setup-testing → frontmcp-testing}/references/test-direct-client.md +0 -0
  88. /package/catalog/{testing/setup-testing → frontmcp-testing}/references/test-e2e-handler.md +0 -0
@@ -1,33 +1,28 @@
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
1
  # Building as an SDK Library
20
2
 
21
3
  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
4
 
23
- ## When to Use
5
+ ## When to Use This Skill
6
+
7
+ ### Must Use
8
+
9
+ - Embedding MCP tools in an existing Node.js application without starting an HTTP server
10
+ - Distributing your MCP server as an npm package with CJS + ESM + TypeScript declarations
11
+ - Connecting tools to LLM platforms (OpenAI, Claude, LangChain, Vercel AI) via `connect*()` functions
12
+
13
+ ### Recommended
14
+
15
+ - Running MCP tools in-memory for low-latency, zero-network-overhead execution
16
+ - Building a shared tool library consumed by multiple services in a monorepo
17
+ - Testing MCP tools programmatically in integration test suites
24
18
 
25
- Use `--target sdk` when:
19
+ ### Skip When
26
20
 
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
21
+ - Deploying a standalone MCP server that listens on a port -- use `--target node` or `build-for-cli`
22
+ - Building a browser-based MCP client -- use `build-for-browser`
23
+ - Deploying to Cloudflare Workers -- use `deploy-to-cloudflare`
24
+
25
+ > **Decision:** Choose this skill when you need MCP tools as a library or programmatic API; use other targets for standalone servers or browser clients.
31
26
 
32
27
  ## Build Command
33
28
 
@@ -216,3 +211,49 @@ ls dist/
216
211
  # Test programmatically
217
212
  node -e "const { create } = require('./dist/my-sdk.cjs.js'); ..."
218
213
  ```
214
+
215
+ ## Common Patterns
216
+
217
+ | Pattern | Correct | Incorrect | Why |
218
+ | ------------------- | ------------------------------------------- | ---------------------------------------- | ----------------------------------------------------------- |
219
+ | HTTP server | `serve: false` in `@FrontMcp` decorator | Omitting `serve` (defaults to `true`) | SDK mode should not bind a port |
220
+ | Dependency bundling | `@frontmcp/*` marked as external | Bundling all `@frontmcp/*` packages | Consumers already have these as peer deps |
221
+ | Instance reuse | Pass `cacheKey` to `create()` | Call `create()` on every request | Same key reuses the server instance, avoiding repeated init |
222
+ | Cleanup | Call `server.dispose()` or `client.close()` | Letting the process exit without cleanup | Avoids leaked connections and open handles |
223
+ | Platform tools | `connectOpenAI()` for OpenAI format | Manually formatting tool schemas | `connect*()` handles schema translation automatically |
224
+
225
+ ## Verification Checklist
226
+
227
+ **Build**
228
+
229
+ - [ ] `frontmcp build --target sdk` completes without errors
230
+ - [ ] Output contains `.cjs.js`, `.esm.mjs`, and `.d.ts` files
231
+ - [ ] `@frontmcp/*` packages are not included in the bundle
232
+
233
+ **Programmatic API**
234
+
235
+ - [ ] `create()` returns a working server instance
236
+ - [ ] `server.callTool()` executes tools and returns results
237
+ - [ ] `server.listTools()` returns all registered tools
238
+ - [ ] `server.dispose()` cleans up without errors
239
+
240
+ **Platform Connections**
241
+
242
+ - [ ] `connectOpenAI()` returns tools in OpenAI function-calling format
243
+ - [ ] `connectClaude()` returns tools in Anthropic `input_schema` format
244
+ - [ ] `client.close()` releases all resources
245
+
246
+ ## Troubleshooting
247
+
248
+ | Problem | Cause | Solution |
249
+ | ------------------------------- | -------------------------------------------------- | ------------------------------------------------------------------- |
250
+ | HTTP server starts unexpectedly | Missing `serve: false` in decorator | Add `serve: false` to the `@FrontMcp` options |
251
+ | `create()` returns stale tools | Cached instance from a previous `cacheKey` | Use a unique `cacheKey` or call `dispose()` before re-creating |
252
+ | TypeScript types missing | `.d.ts` files not generated | Ensure `tsconfig` has `declaration: true` and build target is `sdk` |
253
+ | `connectOpenAI()` format wrong | Using raw `listTools()` instead of platform client | Use `connectOpenAI()` which formats tools for OpenAI automatically |
254
+ | Bundle includes `@frontmcp/*` | Build config missing externals | Verify `--target sdk` is set; it marks `@frontmcp/*` as external |
255
+
256
+ ## Reference
257
+
258
+ - **Docs:** <https://docs.agentfront.dev/frontmcp/deployment/direct-client>
259
+ - **Related skills:** `build-for-cli`, `build-for-browser`, `deploy-to-cloudflare`
@@ -0,0 +1,213 @@
1
+ # Deploy a FrontMCP Server to Cloudflare Workers
2
+
3
+ This skill guides you through deploying a FrontMCP server to Cloudflare Workers.
4
+
5
+ <Warning>
6
+ 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.
7
+ </Warning>
8
+
9
+ ## When to Use This Skill
10
+
11
+ ### Must Use
12
+
13
+ - Deploying a FrontMCP server to Cloudflare Workers
14
+ - Configuring `wrangler.toml` for a FrontMCP project targeting Cloudflare
15
+ - Setting up Workers KV, D1, or Durable Objects storage for an MCP server on Cloudflare
16
+
17
+ ### Recommended
18
+
19
+ - Evaluating serverless edge deployment options for low-latency MCP endpoints
20
+ - Migrating an existing Node.js MCP server to a Cloudflare Workers environment
21
+ - Adding a custom domain to a Cloudflare-hosted MCP server
22
+
23
+ ### Skip When
24
+
25
+ - Deploying to a traditional Node.js server or Docker container -- use `build-for-cli` or `--target node`
26
+ - Building a browser-based MCP client -- use `build-for-browser`
27
+ - Embedding MCP tools in an existing app without HTTP -- use `build-for-sdk`
28
+
29
+ > **Decision:** Choose this skill when your deployment target is Cloudflare Workers; otherwise pick the skill that matches your runtime.
30
+
31
+ ## Prerequisites
32
+
33
+ - A Cloudflare account (https://dash.cloudflare.com)
34
+ - Wrangler CLI installed: `npm install -g wrangler`
35
+ - A built FrontMCP project
36
+
37
+ ## Step 1: Create a Cloudflare-targeted Project
38
+
39
+ ```bash
40
+ npx frontmcp create my-app --target cloudflare
41
+ ```
42
+
43
+ This generates the project with a `wrangler.toml` and a deploy script (`npm run deploy` runs `wrangler deploy`).
44
+
45
+ ## Step 2: Build for Cloudflare
46
+
47
+ ```bash
48
+ frontmcp build --target cloudflare
49
+ ```
50
+
51
+ This produces:
52
+
53
+ ```text
54
+ dist/
55
+ main.js # Your compiled server (CommonJS)
56
+ index.js # Cloudflare handler wrapper
57
+ wrangler.toml # Wrangler configuration
58
+ ```
59
+
60
+ Cloudflare Workers use CommonJS (not ESM). The build command sets `--module commonjs` automatically.
61
+
62
+ ## Step 3: Configure wrangler.toml
63
+
64
+ The generated `wrangler.toml`:
65
+
66
+ ```toml
67
+ name = "frontmcp-worker"
68
+ main = "dist/index.js"
69
+ compatibility_date = "2024-01-01"
70
+
71
+ [vars]
72
+ NODE_ENV = "production"
73
+ ```
74
+
75
+ To add KV storage for sessions and state:
76
+
77
+ ```toml
78
+ name = "frontmcp-worker"
79
+ main = "dist/index.js"
80
+ compatibility_date = "2024-01-01"
81
+
82
+ [[kv_namespaces]]
83
+ binding = "FRONTMCP_KV"
84
+ id = "your-kv-namespace-id"
85
+
86
+ [vars]
87
+ NODE_ENV = "production"
88
+ ```
89
+
90
+ Create the KV namespace via the dashboard or CLI:
91
+
92
+ ```bash
93
+ wrangler kv:namespace create FRONTMCP_KV
94
+ ```
95
+
96
+ Copy the returned `id` into your `wrangler.toml`.
97
+
98
+ ## Step 4: Configure the Server
99
+
100
+ ```typescript
101
+ import { FrontMcp, App } from '@frontmcp/sdk';
102
+
103
+ @App({ name: 'MyApp' })
104
+ class MyApp {}
105
+
106
+ @FrontMcp({
107
+ info: { name: 'my-worker', version: '1.0.0' },
108
+ apps: [MyApp],
109
+ transport: {
110
+ type: 'sse',
111
+ },
112
+ })
113
+ class MyServer {}
114
+
115
+ export default MyServer;
116
+ ```
117
+
118
+ For KV-backed session storage, use the Cloudflare KV or Upstash Redis provider.
119
+
120
+ ## Step 5: Deploy
121
+
122
+ ```bash
123
+ # Preview deployment
124
+ wrangler dev
125
+
126
+ # Production deployment
127
+ wrangler deploy
128
+ ```
129
+
130
+ ### Custom Domain
131
+
132
+ Configure a custom domain in the Cloudflare dashboard under **Workers & Pages > your worker > Settings > Domains & Routes**, or via wrangler:
133
+
134
+ ```bash
135
+ wrangler domains add mcp.example.com
136
+ ```
137
+
138
+ ## Step 6: Verify
139
+
140
+ ```bash
141
+ # Health check
142
+ curl https://frontmcp-worker.your-subdomain.workers.dev/health
143
+
144
+ # Test MCP endpoint
145
+ curl -X POST https://frontmcp-worker.your-subdomain.workers.dev/mcp \
146
+ -H "Content-Type: application/json" \
147
+ -d '{"jsonrpc":"2.0","method":"tools/list","id":1}'
148
+ ```
149
+
150
+ ## Workers Limitations
151
+
152
+ - **Bundle size**: Workers have a 1 MB compressed / 10 MB uncompressed limit (paid plan: 10 MB / 30 MB). Review dependencies and remove unused packages to reduce bundle size.
153
+ - **CPU time**: 10 ms CPU time on free plan, 30 seconds on paid. Long-running operations must be optimized or use Durable Objects.
154
+ - **No native modules**: `better-sqlite3` and other native Node.js modules are not available. Use KV, D1, or Upstash Redis for storage.
155
+ - **Streaming**: SSE streaming may have limitations through the Workers adapter. Test thoroughly.
156
+
157
+ ## Storage Options
158
+
159
+ | Storage | Use Case | Notes |
160
+ | ------------- | ----------------------------- | --------------------------------- |
161
+ | Cloudflare KV | Simple key-value, low write | Eventually consistent, fast reads |
162
+ | Upstash Redis | Sessions, pub/sub, high write | Redis-compatible REST API |
163
+ | Cloudflare D1 | Relational data | SQLite-based, serverless |
164
+
165
+ ## Troubleshooting
166
+
167
+ | Problem | Cause | Solution |
168
+ | ----------------------------- | ---------------------------------------------- | ------------------------------------------------------------------------- |
169
+ | Worker exceeds size limit | Too many bundled dependencies | Review dependencies and remove unused packages to reduce bundle size |
170
+ | Module format errors | `wrangler.toml` sets `type = "module"` | Remove the `type` field; FrontMCP Cloudflare builds use CommonJS |
171
+ | KV binding errors | Namespace not created or binding name mismatch | Run `wrangler kv:namespace create` and copy the `id` into `wrangler.toml` |
172
+ | Timeout errors | CPU time exceeds plan limit | Upgrade plan or offload heavy computation to Durable Objects |
173
+ | CORS failures on MCP endpoint | Missing CORS headers in Worker response | Add CORS middleware or headers in your FrontMCP server configuration |
174
+
175
+ ## Common Patterns
176
+
177
+ | Pattern | Correct | Incorrect | Why |
178
+ | ------------------ | ------------------------------------------- | --------------------------------- | -------------------------------------------------- |
179
+ | Module format | CommonJS (`main = "dist/index.js"`) | ESM (`type = "module"`) | FrontMCP Cloudflare builds emit CommonJS |
180
+ | Storage binding | `[[kv_namespaces]]` with matching `binding` | Hardcoded KV namespace ID in code | Bindings are injected at runtime by Workers |
181
+ | Compatibility date | Set to a recent, tested date | Omitting `compatibility_date` | Workers behavior changes across compat dates |
182
+ | Build command | `frontmcp build --target cloudflare` | `frontmcp build` (no target) | Default target is Node.js, not Workers |
183
+ | Secrets | `wrangler secret put MY_SECRET` | Storing secrets in `[vars]` | `[vars]` are visible in plaintext in the dashboard |
184
+
185
+ ## Verification Checklist
186
+
187
+ **Build**
188
+
189
+ - [ ] `frontmcp build --target cloudflare` completes without errors
190
+ - [ ] Bundle size is within Cloudflare plan limits (free: 1 MB compressed)
191
+
192
+ **Configuration**
193
+
194
+ - [ ] `wrangler.toml` has correct `name`, `main`, and `compatibility_date`
195
+ - [ ] KV namespace IDs match between dashboard and `wrangler.toml`
196
+ - [ ] Secrets are stored via `wrangler secret put`, not in `[vars]`
197
+
198
+ **Deployment**
199
+
200
+ - [ ] `wrangler dev` serves the MCP endpoint locally
201
+ - [ ] `wrangler deploy` succeeds without errors
202
+ - [ ] Health endpoint responds with 200
203
+
204
+ **Runtime**
205
+
206
+ - [ ] `tools/list` JSON-RPC call returns expected tools
207
+ - [ ] SSE streaming works end-to-end (if using SSE transport)
208
+ - [ ] Custom domain resolves correctly (if configured)
209
+
210
+ ## Reference
211
+
212
+ - **Docs:** <https://docs.agentfront.dev/frontmcp/deployment/serverless>
213
+ - **Related skills:** `build-for-cli`, `build-for-browser`, `build-for-sdk`
@@ -1,66 +1,35 @@
1
- ---
2
- name: deploy-to-lambda
3
- description: Deploy a FrontMCP server to AWS Lambda with API Gateway. Use when deploying to AWS, setting up SAM or CDK, or configuring Lambda handlers.
4
- tags:
5
- - deployment
6
- - lambda
7
- - aws
8
- - serverless
9
- parameters:
10
- - name: runtime
11
- description: AWS Lambda runtime version
12
- type: string
13
- required: false
14
- default: nodejs22.x
15
- - name: memory
16
- description: Lambda function memory in MB
17
- type: number
18
- required: false
19
- default: 512
20
- - name: timeout
21
- description: Lambda function timeout in seconds
22
- type: number
23
- required: false
24
- default: 30
25
- - name: region
26
- description: AWS region for deployment
27
- type: string
28
- required: false
29
- default: us-east-1
30
- examples:
31
- - scenario: Deploy with SAM
32
- parameters:
33
- memory: 512
34
- timeout: 30
35
- region: us-east-1
36
- expected-outcome: A FrontMCP server deployed as an AWS Lambda function behind API Gateway, managed by SAM.
37
- - scenario: Deploy with CDK
38
- parameters:
39
- memory: 1024
40
- timeout: 60
41
- region: eu-west-1
42
- expected-outcome: A FrontMCP server deployed via AWS CDK with API Gateway and Lambda.
43
- compatibility: AWS CLI and SAM CLI required
44
- license: Apache-2.0
45
- visibility: both
46
- priority: 10
47
- metadata:
48
- category: deployment
49
- difficulty: advanced
50
- platform: aws
51
- docs: https://docs.agentfront.dev/frontmcp/deployment/serverless
52
- ---
53
-
54
1
  # Deploy a FrontMCP Server to AWS Lambda
55
2
 
56
3
  This skill walks you through deploying a FrontMCP server to AWS Lambda with API Gateway using SAM or CDK.
57
4
 
5
+ ## When to Use This Skill
6
+
7
+ ### Must Use
8
+
9
+ - Deploying a FrontMCP server to AWS Lambda behind API Gateway
10
+ - Setting up a SAM or CDK stack for a serverless MCP endpoint on AWS
11
+ - Integrating with AWS-native services like ElastiCache, Secrets Manager, or CloudWatch
12
+
13
+ ### Recommended
14
+
15
+ - Your organization standardizes on AWS and you need IAM-based access control
16
+ - You want provisioned concurrency for predictable latency on critical MCP endpoints
17
+ - Deploying across multiple AWS regions with infrastructure-as-code (SAM or CDK)
18
+
19
+ ### Skip When
20
+
21
+ - Deploying to Vercel or you prefer a simpler serverless DX -- use `deploy-to-vercel` instead
22
+ - You need a long-lived process with WebSockets or persistent connections -- use `deploy-to-node` instead
23
+ - You do not use AWS and want to avoid managing IAM roles, VPCs, and CloudFormation stacks
24
+
25
+ > **Decision:** Choose this skill when you need serverless deployment within the AWS ecosystem; choose a different target when you want simpler ops or a non-AWS platform.
26
+
58
27
  ## Prerequisites
59
28
 
60
29
  - AWS account with appropriate IAM permissions
61
30
  - AWS CLI configured: `aws configure`
62
31
  - SAM CLI installed: `brew install aws-sam-cli` (macOS) or see AWS docs
63
- - Node.js 22 or later
32
+ - Node.js 24 or later
64
33
  - A FrontMCP project ready to build
65
34
 
66
35
  ## Step 1: Build for Lambda
@@ -83,7 +52,7 @@ Description: FrontMCP server on AWS Lambda
83
52
  Globals:
84
53
  Function:
85
54
  Timeout: 30
86
- Runtime: nodejs22.x
55
+ Runtime: nodejs24.x
87
56
  MemorySize: 512
88
57
  Environment:
89
58
  Variables:
@@ -94,7 +63,7 @@ Resources:
94
63
  FrontMcpFunction:
95
64
  Type: AWS::Serverless::Function
96
65
  Properties:
97
- Handler: dist/lambda.handler
66
+ Handler: handler.handler
98
67
  CodeUri: .
99
68
  Description: FrontMCP MCP server
100
69
  Architectures:
@@ -169,7 +138,7 @@ Resources:
169
138
 
170
139
  ## Step 4: Handler Configuration
171
140
 
172
- FrontMCP generates a Lambda handler at `dist/lambda.handler` during the build step. To customize the handler, create a `lambda.ts` entry point:
141
+ FrontMCP generates a Lambda handler file (`handler.cjs` with a `handler` export) during the build step. In SAM/CDK, reference it as `handler.handler`. To customize the handler, create a `lambda.ts` entry point:
173
142
 
174
143
  ```typescript
175
144
  import { createLambdaHandler } from '@frontmcp/adapters/lambda';
@@ -233,8 +202,8 @@ import * as apigw from 'aws-cdk-lib/aws-apigatewayv2';
233
202
  import * as integrations from 'aws-cdk-lib/aws-apigatewayv2-integrations';
234
203
 
235
204
  const fn = new lambda.Function(this, 'FrontMcpHandler', {
236
- runtime: lambda.Runtime.NODEJS_22_X,
237
- handler: 'dist/lambda.handler',
205
+ runtime: lambda.Runtime.NODEJS_24_X,
206
+ handler: 'handler.handler',
238
207
  code: lambda.Code.fromAsset('.'),
239
208
  memorySize: 512,
240
209
  timeout: cdk.Duration.seconds(30),
@@ -296,9 +265,53 @@ Lambda cold starts occur when a new execution environment is initialized. Strate
296
265
  | 512 MB | ~500ms | ~700ms |
297
266
  | 1024 MB | ~350ms | ~500ms |
298
267
 
268
+ ## Common Patterns
269
+
270
+ | Pattern | Correct | Incorrect | Why |
271
+ | ------------------ | -------------------------------------------------------------- | --------------------------------------- | -------------------------------------------------------------------------------------------------- |
272
+ | Build command | `frontmcp build --target lambda` | `tsc` or generic bundler | The Lambda target produces a single optimized handler with tree-shaking for cold-start performance |
273
+ | Architecture | `arm64` (Graviton) | `x86_64` | ARM64 functions initialize faster and cost less per ms of compute |
274
+ | Handler path | `handler.handler` in SAM template | `index.handler` or `src/lambda.handler` | The FrontMCP build outputs to `dist/`; mismatched paths cause 502 errors |
275
+ | Secrets management | SSM Parameter Store or Secrets Manager (`{{resolve:ssm:...}}`) | Plaintext env vars in `template.yaml` | SSM/Secrets Manager encrypts values at rest and supports rotation |
276
+ | Redis connectivity | Lambda in same VPC as ElastiCache with security groups | Public Redis endpoint from Lambda | VPC peering ensures low latency and keeps traffic off the public internet |
277
+
278
+ ## Verification Checklist
279
+
280
+ **Build**
281
+
282
+ - [ ] `frontmcp build --target lambda` completes without errors
283
+ - [ ] `handler.handler` exists and exports a `handler` function
284
+
285
+ **SAM / CDK**
286
+
287
+ - [ ] `sam build` succeeds without errors
288
+ - [ ] `sam deploy --guided` creates the CloudFormation stack
289
+ - [ ] Stack outputs include the API Gateway endpoint URL
290
+
291
+ **Runtime**
292
+
293
+ - [ ] `curl https://<api-id>.execute-api.<region>.amazonaws.com/health` returns `{"status":"ok"}`
294
+ - [ ] CloudWatch Logs show successful invocations without errors
295
+ - [ ] `NODE_ENV` is set to `production` in the function configuration
296
+
297
+ **Production Readiness**
298
+
299
+ - [ ] Sensitive values use SSM Parameter Store or Secrets Manager
300
+ - [ ] Log retention is configured (e.g., 14 days)
301
+ - [ ] If using Redis, Lambda is in the same VPC as ElastiCache with correct security groups
302
+ - [ ] Provisioned concurrency is enabled for latency-sensitive endpoints (if applicable)
303
+
299
304
  ## Troubleshooting
300
305
 
301
- - **Timeout errors**: Increase `Timeout` in the SAM template. Check if the function is waiting on an unreachable resource.
302
- - **502 Bad Gateway**: Check CloudWatch logs. Common causes: handler path mismatch, missing environment variables, unhandled exceptions.
303
- - **Cold starts too slow**: Increase memory allocation, use ARM64, or enable provisioned concurrency.
304
- - **Redis from Lambda**: Place the Lambda function in the same VPC as your ElastiCache cluster with appropriate security groups.
306
+ | Problem | Cause | Solution |
307
+ | ------------------------------------ | --------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- |
308
+ | Timeout errors | Function timeout too low or waiting on unreachable resource | Increase `Timeout` in the SAM template; verify network connectivity to dependencies |
309
+ | 502 Bad Gateway | Handler path mismatch, missing env vars, or unhandled exception | Check CloudWatch Logs; confirm `Handler` matches `handler.handler` |
310
+ | Cold starts too slow | Low memory, x86 architecture, or large bundle | Increase memory to 512+ MB, use `arm64`, or enable provisioned concurrency |
311
+ | Redis connection refused from Lambda | Lambda not in the same VPC as ElastiCache | Place the Lambda in the ElastiCache VPC with appropriate security group rules |
312
+ | `sam deploy` fails with IAM error | Insufficient permissions for CloudFormation stack creation | Ensure the deploying IAM user/role has `cloudformation:*`, `lambda:*`, `apigateway:*`, and `iam:PassRole` |
313
+
314
+ ## Reference
315
+
316
+ - **Docs:** https://docs.agentfront.dev/frontmcp/deployment/serverless
317
+ - **Related skills:** `deploy-to-node`, `deploy-to-vercel`
@@ -1,45 +1,54 @@
1
1
  # ---- Build Stage ----
2
- FROM node:22-alpine AS builder
2
+
3
+ FROM node:24-alpine AS builder
3
4
 
4
5
  WORKDIR /app
5
6
 
6
7
  # Install dependencies first for better layer caching
8
+
7
9
  COPY package.json yarn.lock ./
8
10
  RUN yarn install --frozen-lockfile
9
11
 
10
12
  # Copy source and build
13
+
11
14
  COPY . .
12
15
  RUN yarn frontmcp build --target node
13
16
 
14
17
  # ---- Production Stage ----
15
- FROM node:22-alpine AS production
18
+
19
+ FROM node:24-alpine AS production
16
20
 
17
21
  WORKDIR /app
18
22
 
19
23
  # Create non-root user for security
24
+
20
25
  RUN addgroup -S frontmcp && adduser -S frontmcp -G frontmcp
21
26
 
22
27
  # Copy only production artifacts
28
+
23
29
  COPY --from=builder /app/dist ./dist
24
30
  COPY --from=builder /app/package.json ./
25
31
  COPY --from=builder /app/yarn.lock ./
26
32
 
27
33
  # Install production dependencies only
34
+
28
35
  RUN yarn install --frozen-lockfile --production && \
29
- yarn cache clean
36
+ yarn cache clean
30
37
 
31
38
  # Set ownership
39
+
32
40
  RUN chown -R frontmcp:frontmcp /app
33
41
 
34
42
  USER frontmcp
35
43
 
36
44
  # Environment defaults
45
+
37
46
  ENV NODE_ENV=production
38
47
  ENV PORT=3000
39
48
 
40
49
  EXPOSE 3000
41
50
 
42
51
  HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
43
- CMD wget --no-verbose --tries=1 --spider http://localhost:3000/health || exit 1
52
+ CMD wget --no-verbose --tries=1 --spider http://localhost:3000/health || exit 1
44
53
 
45
54
  CMD ["node", "dist/main.js"]