@frontmcp/skills 1.1.2 → 1.2.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.
- package/catalog/TEMPLATE.md +16 -11
- package/catalog/frontmcp-authorities/SKILL.md +116 -11
- package/catalog/frontmcp-authorities/references/authority-profiles.md +39 -36
- package/catalog/frontmcp-authorities/references/claims-mapping.md +7 -0
- package/catalog/frontmcp-authorities/references/custom-evaluators.md +63 -14
- package/catalog/frontmcp-channels/SKILL.md +36 -0
- package/catalog/frontmcp-channels/examples/channel-sources/file-watcher.md +8 -2
- package/catalog/frontmcp-channels/examples/channel-sources/replay-buffer.md +111 -30
- package/catalog/frontmcp-channels/examples/channel-two-way/whatsapp-bridge.md +45 -3
- package/catalog/frontmcp-channels/references/channel-sources.md +11 -3
- package/catalog/frontmcp-channels/references/channel-two-way.md +60 -89
- package/catalog/frontmcp-config/SKILL.md +111 -8
- package/catalog/frontmcp-config/examples/configure-auth-modes/local-self-signed-tokens.md +4 -4
- package/catalog/frontmcp-config/examples/configure-auth-modes/remote-enterprise-oauth.md +7 -1
- package/catalog/frontmcp-config/examples/configure-deployment-targets/distributed-ha-config.md +1 -1
- package/catalog/frontmcp-config/examples/configure-deployment-targets/json-schema-ide-support.md +1 -1
- package/catalog/frontmcp-config/examples/configure-deployment-targets/multi-target-with-security.md +12 -9
- package/catalog/frontmcp-config/examples/configure-http/cors-restricted-origins.md +2 -2
- package/catalog/frontmcp-config/examples/configure-http/entry-path-reverse-proxy.md +1 -1
- package/catalog/frontmcp-config/examples/configure-security-headers/csp-report-only.md +1 -1
- package/catalog/frontmcp-config/examples/configure-security-headers/full-production-headers.md +1 -1
- package/catalog/frontmcp-config/examples/configure-skills-http/audit-log-basic.md +76 -0
- package/catalog/frontmcp-config/examples/configure-skills-http/audit-log-redis.md +116 -0
- package/catalog/frontmcp-config/examples/configure-skills-http/inject-instructions.md +59 -0
- package/catalog/frontmcp-config/references/configure-auth-modes.md +5 -5
- package/catalog/frontmcp-config/references/configure-deployment-targets.md +27 -24
- package/catalog/frontmcp-config/references/configure-http.md +14 -10
- package/catalog/frontmcp-config/references/configure-security-headers.md +2 -2
- package/catalog/frontmcp-config/references/configure-session.md +25 -25
- package/catalog/frontmcp-config/references/configure-skills-http.md +157 -0
- package/catalog/frontmcp-config/references/configure-throttle.md +1 -1
- package/catalog/frontmcp-config/references/configure-transport.md +2 -2
- package/catalog/frontmcp-deployment/SKILL.md +112 -9
- package/catalog/frontmcp-deployment/examples/build-for-browser/browser-build-with-custom-entry.md +23 -11
- package/catalog/frontmcp-deployment/examples/build-for-browser/browser-crypto-and-storage.md +44 -17
- package/catalog/frontmcp-deployment/examples/build-for-browser/react-provider-setup.md +53 -21
- package/catalog/frontmcp-deployment/examples/build-for-cli/cli-binary-build.md +1 -1
- package/catalog/frontmcp-deployment/examples/build-for-cli/unix-socket-daemon.md +1 -1
- package/catalog/frontmcp-deployment/examples/build-for-mcpb/mcpb-bundle-build.md +1 -1
- package/catalog/frontmcp-deployment/examples/build-for-sdk/connect-openai.md +1 -1
- package/catalog/frontmcp-deployment/examples/build-for-sdk/multi-platform-connect.md +1 -1
- package/catalog/frontmcp-deployment/examples/deploy-to-cloudflare/basic-worker-deploy.md +7 -8
- package/catalog/frontmcp-deployment/examples/deploy-to-cloudflare/worker-custom-domain.md +8 -6
- package/catalog/frontmcp-deployment/examples/deploy-to-cloudflare/worker-with-kv-storage.md +5 -4
- package/catalog/frontmcp-deployment/examples/deploy-to-lambda/cdk-deployment.md +8 -5
- package/catalog/frontmcp-deployment/examples/deploy-to-lambda/lambda-handler-with-cors.md +20 -18
- package/catalog/frontmcp-deployment/examples/deploy-to-lambda/sam-template-basic.md +8 -5
- package/catalog/frontmcp-deployment/examples/deploy-to-node/docker-compose-with-redis.md +3 -3
- package/catalog/frontmcp-deployment/examples/deploy-to-node/pm2-with-nginx.md +1 -1
- package/catalog/frontmcp-deployment/examples/deploy-to-node/resource-limits.md +2 -2
- package/catalog/frontmcp-deployment/examples/deploy-to-node-dockerfile/basic-multistage-dockerfile.md +2 -2
- package/catalog/frontmcp-deployment/examples/deploy-to-node-dockerfile/secure-nonroot-dockerfile.md +1 -1
- package/catalog/frontmcp-deployment/examples/deploy-to-vercel/vercel-mcp-endpoint-test.md +23 -21
- package/catalog/frontmcp-deployment/examples/deploy-to-vercel/vercel-with-kv.md +25 -22
- package/catalog/frontmcp-deployment/examples/deploy-to-vercel/vercel-with-skills-cache.md +23 -30
- package/catalog/frontmcp-deployment/examples/deploy-to-vercel-config/minimal-vercel-config.md +52 -28
- package/catalog/frontmcp-deployment/examples/deploy-to-vercel-config/vercel-config-with-security-headers.md +32 -55
- package/catalog/frontmcp-deployment/examples/mcp-client-integration/http-remote.md +9 -0
- package/catalog/frontmcp-deployment/references/build-for-browser.md +40 -17
- package/catalog/frontmcp-deployment/references/build-for-cli.md +8 -8
- package/catalog/frontmcp-deployment/references/deploy-to-cloudflare.md +43 -24
- package/catalog/frontmcp-deployment/references/deploy-to-lambda.md +36 -25
- package/catalog/frontmcp-deployment/references/deploy-to-node-dockerfile.md +56 -14
- package/catalog/frontmcp-deployment/references/deploy-to-node.md +9 -6
- package/catalog/frontmcp-deployment/references/deploy-to-vercel-config.md +57 -58
- package/catalog/frontmcp-deployment/references/deploy-to-vercel.md +49 -59
- package/catalog/frontmcp-deployment/references/mcp-client-integration.md +2 -0
- package/catalog/frontmcp-development/SKILL.md +186 -11
- package/catalog/frontmcp-development/examples/create-agent/custom-multi-pass-agent.md +1 -1
- package/catalog/frontmcp-development/examples/create-agent/nested-agents-with-swarm.md +30 -27
- package/catalog/frontmcp-development/examples/create-job/job-with-permissions.md +13 -8
- package/catalog/frontmcp-development/examples/create-provider/basic-database-provider.md +33 -23
- package/catalog/frontmcp-development/examples/create-provider/config-and-api-providers.md +19 -10
- package/catalog/frontmcp-development/examples/create-tool/tool-with-rate-limiting-and-progress.md +3 -3
- package/catalog/frontmcp-development/examples/create-workflow/webhook-triggered-workflow.md +6 -4
- package/catalog/frontmcp-development/examples/decorators-guide/agent-skill-job-workflow.md +1 -1
- package/catalog/frontmcp-development/examples/decorators-guide/basic-server-with-app-and-tools.md +13 -8
- package/catalog/frontmcp-development/examples/decorators-guide/multi-app-with-plugins-and-providers.md +50 -23
- package/catalog/frontmcp-development/references/create-agent.md +47 -30
- package/catalog/frontmcp-development/references/create-job.md +69 -54
- package/catalog/frontmcp-development/references/create-plugin-hooks.md +45 -28
- package/catalog/frontmcp-development/references/create-plugin.md +10 -8
- package/catalog/frontmcp-development/references/create-prompt.md +3 -3
- package/catalog/frontmcp-development/references/create-provider.md +91 -51
- package/catalog/frontmcp-development/references/create-resource.md +3 -3
- package/catalog/frontmcp-development/references/create-skill.md +2 -2
- package/catalog/frontmcp-development/references/create-tool.md +7 -7
- package/catalog/frontmcp-development/references/create-workflow.md +8 -10
- package/catalog/frontmcp-development/references/decorators-guide.md +92 -56
- package/catalog/frontmcp-development/references/official-plugins.md +4 -3
- package/catalog/frontmcp-development/references/openapi-adapter.md +1 -1
- package/catalog/frontmcp-extensibility/SKILL.md +70 -10
- package/catalog/frontmcp-extensibility/examples/skill-audit-log/custom-store.md +197 -0
- package/catalog/frontmcp-extensibility/examples/skill-audit-log/verify-chain.md +68 -0
- package/catalog/frontmcp-extensibility/examples/vectoriadb/product-catalog-search.md +3 -5
- package/catalog/frontmcp-extensibility/examples/vectoriadb/semantic-search-with-persistence.md +4 -11
- package/catalog/frontmcp-extensibility/examples/vectoriadb/tfidf-keyword-search.md +41 -30
- package/catalog/frontmcp-extensibility/references/skill-audit-log.md +233 -0
- package/catalog/frontmcp-extensibility/references/vectoriadb.md +73 -63
- package/catalog/frontmcp-guides/SKILL.md +84 -27
- package/catalog/frontmcp-guides/examples/example-knowledge-base/agent-and-plugin.md +72 -62
- package/catalog/frontmcp-guides/examples/example-knowledge-base/vector-search-and-resources.md +32 -43
- package/catalog/frontmcp-guides/examples/example-task-manager/auth-and-crud-tools.md +24 -17
- package/catalog/frontmcp-guides/examples/example-task-manager/authenticated-e2e-tests.md +23 -21
- package/catalog/frontmcp-guides/examples/example-task-manager/redis-provider-with-di.md +47 -39
- package/catalog/frontmcp-guides/examples/example-weather-api/server-and-app-setup.md +16 -6
- package/catalog/frontmcp-guides/examples/example-weather-api/unit-and-e2e-tests.md +9 -8
- package/catalog/frontmcp-guides/references/example-knowledge-base.md +192 -265
- package/catalog/frontmcp-guides/references/example-task-manager.md +60 -54
- package/catalog/frontmcp-guides/references/example-weather-api.md +22 -24
- package/catalog/frontmcp-observability/SKILL.md +66 -2
- package/catalog/frontmcp-observability/examples/telemetry-api/skill-counters.md +100 -0
- package/catalog/frontmcp-observability/examples/tracing-setup/production-tracing.md +7 -2
- package/catalog/frontmcp-observability/examples/vendor-integrations/coralogix-setup.md +6 -2
- package/catalog/frontmcp-observability/references/telemetry-api.md +72 -8
- package/catalog/frontmcp-observability/references/testing-observability.md +33 -49
- package/catalog/frontmcp-observability/references/tracing-setup.md +12 -5
- package/catalog/frontmcp-observability/references/vendor-integrations.md +46 -1
- package/catalog/frontmcp-production-readiness/SKILL.md +134 -3
- package/catalog/frontmcp-production-readiness/examples/common-checklist/caching-and-performance.md +57 -36
- package/catalog/frontmcp-production-readiness/examples/common-checklist/observability-setup.md +1 -1
- package/catalog/frontmcp-production-readiness/examples/common-checklist/security-hardening.md +102 -6
- package/catalog/frontmcp-production-readiness/examples/production-cli-daemon/daemon-socket-config.md +2 -1
- package/catalog/frontmcp-production-readiness/examples/production-cli-daemon/graceful-shutdown-cleanup.md +66 -58
- package/catalog/frontmcp-production-readiness/examples/production-cli-daemon/security-and-permissions.md +5 -3
- package/catalog/frontmcp-production-readiness/examples/production-cloudflare/durable-objects-state.md +2 -1
- package/catalog/frontmcp-production-readiness/examples/production-cloudflare/wrangler-config.md +55 -76
- package/catalog/frontmcp-production-readiness/examples/production-lambda/cold-start-connection-reuse.md +43 -40
- package/catalog/frontmcp-production-readiness/examples/production-lambda/sam-template.md +63 -94
- package/catalog/frontmcp-production-readiness/examples/production-lambda/scaling-and-monitoring.md +28 -18
- package/catalog/frontmcp-production-readiness/examples/production-node-sdk/multi-instance-cleanup.md +29 -14
- package/catalog/frontmcp-production-readiness/examples/production-node-server/graceful-shutdown.md +58 -42
- package/catalog/frontmcp-production-readiness/examples/production-node-server/redis-session-scaling.md +5 -2
- package/catalog/frontmcp-production-readiness/examples/production-vercel/cold-start-optimization.md +41 -24
- package/catalog/frontmcp-production-readiness/examples/production-vercel/vercel-edge-config.md +56 -65
- package/catalog/frontmcp-production-readiness/references/common-checklist.md +17 -5
- package/catalog/frontmcp-production-readiness/references/production-cli-daemon.md +5 -5
- package/catalog/frontmcp-production-readiness/references/production-cloudflare.md +5 -5
- package/catalog/frontmcp-production-readiness/references/production-lambda.md +5 -5
- package/catalog/frontmcp-production-readiness/references/production-node-sdk.md +5 -5
- package/catalog/frontmcp-production-readiness/references/production-node-server.md +1 -1
- package/catalog/frontmcp-production-readiness/references/production-vercel.md +5 -5
- package/catalog/frontmcp-setup/SKILL.md +88 -0
- package/catalog/frontmcp-setup/examples/project-structure-nx/nx-workspace-with-apps.md +10 -4
- package/catalog/frontmcp-setup/examples/project-structure-standalone/dev-workflow-commands.md +21 -8
- package/catalog/frontmcp-setup/examples/readme-guide/node-server-readme.md +3 -3
- package/catalog/frontmcp-setup/references/multi-app-composition.md +4 -3
- package/catalog/frontmcp-setup/references/project-structure-nx.md +15 -6
- package/catalog/frontmcp-setup/references/project-structure-standalone.md +18 -15
- package/catalog/frontmcp-setup/references/readme-guide.md +1 -1
- package/catalog/frontmcp-setup/references/setup-project.md +19 -5
- package/catalog/frontmcp-setup/references/setup-redis.md +27 -39
- package/catalog/frontmcp-setup/references/setup-sqlite.md +25 -18
- package/catalog/frontmcp-testing/SKILL.md +102 -15
- package/catalog/frontmcp-testing/examples/setup-testing/unit-test-tool-resource-prompt.md +3 -3
- package/catalog/frontmcp-testing/examples/test-auth/oauth-flow-test.md +50 -39
- package/catalog/frontmcp-testing/examples/test-auth/role-based-access-test.md +52 -29
- package/catalog/frontmcp-testing/examples/test-auth/token-factory-test.md +37 -20
- package/catalog/frontmcp-testing/examples/test-direct-client/basic-create-test.md +25 -15
- package/catalog/frontmcp-testing/examples/test-direct-client/openai-claude-format-test.md +27 -21
- package/catalog/frontmcp-testing/examples/test-e2e-handler/basic-e2e-test.md +29 -20
- package/catalog/frontmcp-testing/examples/test-e2e-handler/manual-client-with-transport.md +5 -3
- package/catalog/frontmcp-testing/examples/test-e2e-handler/tool-call-and-error-e2e.md +35 -26
- package/catalog/frontmcp-testing/examples/test-tool-unit/basic-tool-test.md +8 -3
- package/catalog/frontmcp-testing/examples/test-tool-unit/schema-validation-test.md +4 -1
- package/catalog/frontmcp-testing/examples/test-tool-unit/tool-error-handling-test.md +6 -3
- package/catalog/frontmcp-testing/references/setup-testing.md +35 -39
- package/catalog/frontmcp-testing/references/test-auth.md +86 -43
- package/catalog/frontmcp-testing/references/test-browser-build.md +1 -1
- package/catalog/frontmcp-testing/references/test-direct-client.md +29 -19
- package/catalog/frontmcp-testing/references/test-e2e-handler.md +31 -19
- package/catalog/frontmcp-testing/references/test-tool-unit.md +6 -2
- package/catalog/skills-manifest.json +428 -339
- package/package.json +1 -1
- package/src/manifest.d.ts +13 -0
- package/src/manifest.js.map +1 -1
|
@@ -59,25 +59,47 @@ Not all FrontMCP features are available in browser environments:
|
|
|
59
59
|
|
|
60
60
|
## Usage with @frontmcp/react
|
|
61
61
|
|
|
62
|
-
The browser build is commonly paired with `@frontmcp/react` for React applications
|
|
62
|
+
The browser build is commonly paired with `@frontmcp/react` for React applications. `FrontMcpProvider` takes a pre-created `DirectMcpServer` (via the SDK's `create()` factory) — not a `serverUrl`. Hooks for listing/invoking are `useListTools` / `useCallTool`:
|
|
63
63
|
|
|
64
64
|
```typescript
|
|
65
|
-
import {
|
|
65
|
+
import { create } from '@frontmcp/sdk';
|
|
66
|
+
import { FrontMcpProvider, useListTools, useCallTool } from '@frontmcp/react';
|
|
67
|
+
|
|
68
|
+
// Create the server once (outside React) and pass the instance to the provider.
|
|
69
|
+
const server = await create({
|
|
70
|
+
info: { name: 'browser-app', version: '1.0.0' },
|
|
71
|
+
// tools/resources/prompts as flat config (see build-for-sdk)
|
|
72
|
+
tools: [/* ... */],
|
|
73
|
+
});
|
|
66
74
|
|
|
67
75
|
function App() {
|
|
68
76
|
return (
|
|
69
|
-
<FrontMcpProvider
|
|
77
|
+
<FrontMcpProvider server={server}>
|
|
70
78
|
<ToolUI />
|
|
71
79
|
</FrontMcpProvider>
|
|
72
80
|
);
|
|
73
81
|
}
|
|
74
82
|
|
|
75
83
|
function ToolUI() {
|
|
76
|
-
|
|
77
|
-
|
|
84
|
+
// useListTools returns ToolInfo[] directly (live-updates from the provider's registry).
|
|
85
|
+
const tools = useListTools();
|
|
86
|
+
// useCallTool returns [callFn, state, reset]. Pass the tool name to the hook,
|
|
87
|
+
// and call the returned function with just the arguments object.
|
|
88
|
+
const [callGetWeather, weatherState] = useCallTool('get_weather');
|
|
89
|
+
return (
|
|
90
|
+
<ul>
|
|
91
|
+
{tools.map((t) => (
|
|
92
|
+
<li key={t.name}>
|
|
93
|
+
<button onClick={() => callGetWeather({})}>{t.name}</button>
|
|
94
|
+
</li>
|
|
95
|
+
))}
|
|
96
|
+
</ul>
|
|
97
|
+
);
|
|
78
98
|
}
|
|
79
99
|
```
|
|
80
100
|
|
|
101
|
+
For connecting to a remote MCP server (HTTP), create a server-bound `DirectMcpServer` via `connect()` from `@frontmcp/sdk` and pass that instance to the provider.
|
|
102
|
+
|
|
81
103
|
## Browser vs Node vs SDK Target
|
|
82
104
|
|
|
83
105
|
| Aspect | `--target browser` | `--target node` | `--target sdk` |
|
|
@@ -99,13 +121,14 @@ ls dist/browser/
|
|
|
99
121
|
|
|
100
122
|
## Common Patterns
|
|
101
123
|
|
|
102
|
-
| Pattern | Correct
|
|
103
|
-
| ----------------- |
|
|
104
|
-
| Crypto usage | `@frontmcp/utils` (uses WebCrypto)
|
|
105
|
-
| Storage | In-memory stores or remote API
|
|
106
|
-
| File system ops | Avoid `@frontmcp/utils` fs functions
|
|
107
|
-
| Entry file | Separate browser entry (`src/client.ts`)
|
|
108
|
-
|
|
|
124
|
+
| Pattern | Correct | Incorrect | Why |
|
|
125
|
+
| ----------------- | ------------------------------------------------- | ------------------------------------------- | ------------------------------------------------------ |
|
|
126
|
+
| Crypto usage | `@frontmcp/utils` (uses WebCrypto) | `node:crypto` | `node:crypto` is not available in browsers |
|
|
127
|
+
| Storage | In-memory stores or remote API | SQLite / Redis directly | No filesystem or native TCP in browsers |
|
|
128
|
+
| File system ops | Avoid `@frontmcp/utils` fs functions | `readFile()`, `writeFile()` | fs utilities throw in browser environments |
|
|
129
|
+
| Entry file | Separate browser entry (`src/client.ts`) | Reusing server entry point | Server entry may import Node-only modules |
|
|
130
|
+
| Provider props | `<FrontMcpProvider server={await create({...})}>` | `<FrontMcpProvider config={{ serverUrl }}>` | Real prop is `server: DirectMcpServer`; no `serverUrl` |
|
|
131
|
+
| Tool listing hook | `useListTools()` -> `{ data: { tools } }` | `useTools()` -> `{ tools, callTool }` | `useTools` is not exported; real hooks are split |
|
|
109
132
|
|
|
110
133
|
## Verification Checklist
|
|
111
134
|
|
|
@@ -139,11 +162,11 @@ ls dist/browser/
|
|
|
139
162
|
|
|
140
163
|
## Examples
|
|
141
164
|
|
|
142
|
-
| Example | Level | Description
|
|
143
|
-
| ----------------------------------------------------------------------------------------------------- | ------------ |
|
|
144
|
-
| [`browser-build-with-custom-entry`](../examples/build-for-browser/browser-build-with-custom-entry.md) | Intermediate | Build a browser bundle using a dedicated client entry file that avoids Node.js-only imports.
|
|
145
|
-
| [`browser-crypto-and-storage`](../examples/build-for-browser/browser-crypto-and-storage.md) | Advanced | Use `@frontmcp/utils` crypto
|
|
146
|
-
| [`react-provider-setup`](../examples/build-for-browser/react-provider-setup.md) | Basic | Connect a React application to a
|
|
165
|
+
| Example | Level | Description |
|
|
166
|
+
| ----------------------------------------------------------------------------------------------------- | ------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
167
|
+
| [`browser-build-with-custom-entry`](../examples/build-for-browser/browser-build-with-custom-entry.md) | Intermediate | Build a browser bundle using a dedicated client entry file that avoids Node.js-only imports. Re-export the real `@frontmcp/react` symbols (`useListTools`, `useListResources`, `useCallTool`) — `useTools`/`useResources` do not exist. |
|
|
168
|
+
| [`browser-crypto-and-storage`](../examples/build-for-browser/browser-crypto-and-storage.md) | Advanced | Use `@frontmcp/utils` crypto in the browser, and create the FrontMCP server with `create()` from `@frontmcp/sdk` so the React provider can consume it via the `server` prop. |
|
|
169
|
+
| [`react-provider-setup`](../examples/build-for-browser/react-provider-setup.md) | Basic | Connect a React application to a FrontMCP server using `@frontmcp/react`. `FrontMcpProvider` takes a `DirectMcpServer` instance via the `server` prop — there is no `serverUrl` option. |
|
|
147
170
|
|
|
148
171
|
> See all examples in [`examples/build-for-browser/`](../examples/build-for-browser/)
|
|
149
172
|
|
|
@@ -57,7 +57,7 @@ frontmcp build --target cli --js # JS bundle only (no SEA)
|
|
|
57
57
|
|
|
58
58
|
## Requirements
|
|
59
59
|
|
|
60
|
-
- **Node.js 24+** required for SEA
|
|
60
|
+
- **Node.js 24+** required for the SEA path (`frontmcp build --target cli`). The plain JS bundle path (`--target cli --js`) only requires the Node version your entry file supports.
|
|
61
61
|
- The entry file must export or instantiate a `@FrontMcp` decorated class
|
|
62
62
|
- SEA binaries are platform-specific (build on macOS for macOS, Linux for Linux)
|
|
63
63
|
|
|
@@ -147,13 +147,13 @@ frontmcp service uninstall my-server
|
|
|
147
147
|
|
|
148
148
|
## Common Patterns
|
|
149
149
|
|
|
150
|
-
| Pattern | Correct
|
|
151
|
-
| --------------------- |
|
|
152
|
-
| Node.js version | Node.js 24+ for SEA builds
|
|
153
|
-
| Entry file | Export or instantiate a `@FrontMcp` decorated class
|
|
154
|
-
| Transport for CLI | `socketPath` or stdin/stdout
|
|
155
|
-
| Cross-platform binary | Build on each target OS separately
|
|
156
|
-
| JS-only bundle | `frontmcp build --target cli --js`
|
|
150
|
+
| Pattern | Correct | Incorrect | Why |
|
|
151
|
+
| --------------------- | ---------------------------------------------------- | -------------------------------- | ----------------------------------------------------------- |
|
|
152
|
+
| Node.js version | Node.js 24+ for SEA builds (not required for `--js`) | Using SEA flow on Node < 24 | SEA support requires Node.js 24+; `--js` bundles do not |
|
|
153
|
+
| Entry file | Export or instantiate a `@FrontMcp` decorated class | Export a plain function | The build expects a FrontMcp entry point |
|
|
154
|
+
| Transport for CLI | `socketPath` or stdin/stdout | TCP port binding | CLI tools run locally; ports may conflict |
|
|
155
|
+
| Cross-platform binary | Build on each target OS separately | Build on macOS and ship to Linux | SEA binaries are platform-specific |
|
|
156
|
+
| JS-only bundle | `frontmcp build --target cli --js` | `frontmcp build --target node` | `--target node` assumes server deployment with node_modules |
|
|
157
157
|
|
|
158
158
|
## Verification Checklist
|
|
159
159
|
|
|
@@ -56,33 +56,49 @@ frontmcp build --target cloudflare
|
|
|
56
56
|
This produces:
|
|
57
57
|
|
|
58
58
|
```text
|
|
59
|
-
dist/
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
wrangler.toml
|
|
59
|
+
dist/cloudflare/
|
|
60
|
+
index.js # Cloudflare Workers entry (CommonJS) — wraps your @FrontMcp server
|
|
61
|
+
main.js # Your compiled server module (CommonJS)
|
|
62
|
+
wrangler.toml # Wrangler configuration (overwritten on every build)
|
|
63
63
|
```
|
|
64
64
|
|
|
65
65
|
Cloudflare Workers use CommonJS (not ESM). The build command sets `--module commonjs` automatically.
|
|
66
66
|
|
|
67
|
+
> **Important:** The Cloudflare adapter sets `alwaysWriteConfig: true` and overwrites the entire `wrangler.toml` on every build with the three-line template below. Hand-edited bindings (`[[kv_namespaces]]`, `[vars]`, `[[d1_databases]]`, etc.) WILL be erased the next time you run `frontmcp build --target cloudflare`. Configure `name` and `compatibility_date` via your `frontmcp.config` file's `deployments[].wrangler` section, and keep bindings in a separate config file referenced from your toolchain (or re-add them after each build).
|
|
68
|
+
|
|
67
69
|
## Step 3: Configure wrangler.toml
|
|
68
70
|
|
|
69
|
-
The
|
|
71
|
+
The build always writes exactly this:
|
|
70
72
|
|
|
71
73
|
```toml
|
|
72
74
|
name = "frontmcp-worker"
|
|
73
|
-
main = "dist/index.js"
|
|
75
|
+
main = "dist/cloudflare/index.js"
|
|
74
76
|
compatibility_date = "2024-01-01"
|
|
77
|
+
```
|
|
75
78
|
|
|
76
|
-
|
|
77
|
-
|
|
79
|
+
`name` and `compatibility_date` come from `frontmcp.config.{ts,js}`'s `deployments` array. Example:
|
|
80
|
+
|
|
81
|
+
```ts
|
|
82
|
+
// frontmcp.config.ts
|
|
83
|
+
export default {
|
|
84
|
+
deployments: [
|
|
85
|
+
{
|
|
86
|
+
target: 'cloudflare',
|
|
87
|
+
wrangler: {
|
|
88
|
+
name: 'my-worker',
|
|
89
|
+
compatibilityDate: '2025-01-15',
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
],
|
|
93
|
+
};
|
|
78
94
|
```
|
|
79
95
|
|
|
80
|
-
To add KV storage
|
|
96
|
+
To add KV storage or other bindings, append them AFTER each build (or use a wrapper script that runs the build then concatenates a `wrangler.bindings.toml` you maintain separately):
|
|
81
97
|
|
|
82
98
|
```toml
|
|
83
|
-
name = "
|
|
84
|
-
main = "dist/index.js"
|
|
85
|
-
compatibility_date = "
|
|
99
|
+
name = "my-worker"
|
|
100
|
+
main = "dist/cloudflare/index.js"
|
|
101
|
+
compatibility_date = "2025-01-15"
|
|
86
102
|
|
|
87
103
|
[[kv_namespaces]]
|
|
88
104
|
binding = "FRONTMCP_KV"
|
|
@@ -103,7 +119,7 @@ Copy the returned `id` into your `wrangler.toml`.
|
|
|
103
119
|
## Step 4: Configure the Server
|
|
104
120
|
|
|
105
121
|
```typescript
|
|
106
|
-
import {
|
|
122
|
+
import { App, FrontMcp } from '@frontmcp/sdk';
|
|
107
123
|
|
|
108
124
|
@App({ name: 'MyApp' })
|
|
109
125
|
class MyApp {}
|
|
@@ -112,7 +128,7 @@ class MyApp {}
|
|
|
112
128
|
info: { name: 'my-worker', version: '1.0.0' },
|
|
113
129
|
apps: [MyApp],
|
|
114
130
|
transport: {
|
|
115
|
-
|
|
131
|
+
protocol: 'legacy', // preset: 'legacy' | 'modern' | 'stateless-api' | 'full' — see configure-transport
|
|
116
132
|
},
|
|
117
133
|
})
|
|
118
134
|
class MyServer {}
|
|
@@ -120,7 +136,9 @@ class MyServer {}
|
|
|
120
136
|
export default MyServer;
|
|
121
137
|
```
|
|
122
138
|
|
|
123
|
-
|
|
139
|
+
> **Note:** The transport schema uses `protocol`, not `type`. The preset string accepts `'legacy'` (default), `'modern'`, `'stateless-api'`, or `'full'`. For granular control, pass an object instead, e.g. `protocol: { sse: true, streamable: true }`. `transport: { type: 'sse' }` will fail Zod validation at startup.
|
|
140
|
+
|
|
141
|
+
For session storage, use Upstash Redis (HTTP) via `redis: { provider: 'vercel-kv' }` or wire Cloudflare KV directly inside your tools — the SDK does not include a built-in Cloudflare KV provider, and ioredis-style `redis: { ... }` configs are rejected by the Cloudflare adapter at build time (no Node TCP on Workers).
|
|
124
142
|
|
|
125
143
|
## Step 5: Deploy
|
|
126
144
|
|
|
@@ -143,8 +161,8 @@ wrangler domains add mcp.example.com
|
|
|
143
161
|
## Step 6: Verify
|
|
144
162
|
|
|
145
163
|
```bash
|
|
146
|
-
# Health check
|
|
147
|
-
curl https://frontmcp-worker.your-subdomain.workers.dev/
|
|
164
|
+
# Health check (FrontMCP serves /healthz by default; /health is a legacy alias)
|
|
165
|
+
curl https://frontmcp-worker.your-subdomain.workers.dev/healthz
|
|
148
166
|
|
|
149
167
|
# Test MCP endpoint
|
|
150
168
|
curl -X POST https://frontmcp-worker.your-subdomain.workers.dev/mcp \
|
|
@@ -179,13 +197,14 @@ curl -X POST https://frontmcp-worker.your-subdomain.workers.dev/mcp \
|
|
|
179
197
|
|
|
180
198
|
## Common Patterns
|
|
181
199
|
|
|
182
|
-
| Pattern | Correct
|
|
183
|
-
| ------------------ |
|
|
184
|
-
| Module format | CommonJS (`main = "dist/index.js"`)
|
|
185
|
-
|
|
|
186
|
-
|
|
|
187
|
-
|
|
|
188
|
-
|
|
|
200
|
+
| Pattern | Correct | Incorrect | Why |
|
|
201
|
+
| ------------------ | -------------------------------------------------------------------------- | --------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
|
|
202
|
+
| Module format | CommonJS (`main = "dist/cloudflare/index.js"`) | ESM (`type = "module"`) | FrontMCP Cloudflare builds emit CommonJS at this exact path; the build overwrites `wrangler.toml` to enforce it |
|
|
203
|
+
| Transport key | `transport: { protocol: 'modern' }` (or `{ sse: true, streamable: true }`) | `transport: { type: 'sse' }` | The schema field is `protocol`; valid presets are `'legacy' \| 'modern' \| 'stateless-api' \| 'full'`, or pass a `ProtocolConfig` object |
|
|
204
|
+
| Storage binding | `[[kv_namespaces]]` with matching `binding` | Hardcoded KV namespace ID in code | Bindings are injected at runtime by Workers |
|
|
205
|
+
| Compatibility date | Set via `frontmcp.config.deployments[].wrangler.compatibilityDate` | Hand-editing `wrangler.toml` | The build overwrites `wrangler.toml`; config-driven values survive |
|
|
206
|
+
| Build command | `frontmcp build --target cloudflare` | `frontmcp build` (no target) | Default target is Node.js, not Workers |
|
|
207
|
+
| Secrets | `wrangler secret put MY_SECRET` | Storing secrets in `[vars]` | `[vars]` are visible in plaintext in the dashboard |
|
|
189
208
|
|
|
190
209
|
## Verification Checklist
|
|
191
210
|
|
|
@@ -36,6 +36,13 @@ This skill walks you through deploying a FrontMCP server to AWS Lambda with API
|
|
|
36
36
|
- SAM CLI installed: `brew install aws-sam-cli` (macOS) or see AWS docs
|
|
37
37
|
- Node.js 24 or later
|
|
38
38
|
- A FrontMCP project ready to build
|
|
39
|
+
- **Peer dependency:** `@codegenie/serverless-express` installed in your project. The Lambda adapter externalizes it at bundle time and validates its presence at build time:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
npm install @codegenie/serverless-express
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
If it isn't installed, `frontmcp build --target lambda` fails with a clear error before producing artifacts.
|
|
39
46
|
|
|
40
47
|
## Step 1: Build for Lambda
|
|
41
48
|
|
|
@@ -43,7 +50,16 @@ This skill walks you through deploying a FrontMCP server to AWS Lambda with API
|
|
|
43
50
|
frontmcp build --target lambda
|
|
44
51
|
```
|
|
45
52
|
|
|
46
|
-
This produces a Lambda-compatible output
|
|
53
|
+
This produces a Lambda-compatible output under `dist/lambda/`:
|
|
54
|
+
|
|
55
|
+
```text
|
|
56
|
+
dist/lambda/
|
|
57
|
+
├── handler.cjs # Bundled Lambda handler (CJS, exports `handler`)
|
|
58
|
+
├── serverless-setup.js # Sets FRONTMCP_SERVERLESS=1 before decorators
|
|
59
|
+
└── ... # Chunks split out by rspack
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
The handler is auto-generated. It calls `getServerlessHandlerAsync()` from `@frontmcp/sdk` and wraps the resulting Express app with `@codegenie/serverless-express`. You do **not** need to write a custom `lambda.ts` entry — the build produces `handler.cjs` with a working `handler` export. SAM/CDK reference it as `handler.handler`.
|
|
47
63
|
|
|
48
64
|
## Step 2: SAM Template
|
|
49
65
|
|
|
@@ -69,7 +85,7 @@ Resources:
|
|
|
69
85
|
Type: AWS::Serverless::Function
|
|
70
86
|
Properties:
|
|
71
87
|
Handler: handler.handler
|
|
72
|
-
CodeUri:
|
|
88
|
+
CodeUri: dist/lambda/
|
|
73
89
|
Description: FrontMCP MCP server
|
|
74
90
|
Architectures:
|
|
75
91
|
- arm64
|
|
@@ -82,7 +98,7 @@ Resources:
|
|
|
82
98
|
HealthCheck:
|
|
83
99
|
Type: HttpApi
|
|
84
100
|
Properties:
|
|
85
|
-
Path: /
|
|
101
|
+
Path: /healthz
|
|
86
102
|
Method: GET
|
|
87
103
|
Environment:
|
|
88
104
|
Variables:
|
|
@@ -143,16 +159,9 @@ Resources:
|
|
|
143
159
|
|
|
144
160
|
## Step 4: Handler Configuration
|
|
145
161
|
|
|
146
|
-
|
|
162
|
+
`frontmcp build --target lambda` generates `dist/lambda/handler.cjs` with a `handler` export. In SAM and CDK, reference it as `handler.handler` and set `CodeUri`/`code.fromAsset` to `dist/lambda/`. There is no user-authored handler factory; the adapter wraps your `@FrontMcp` server with `@codegenie/serverless-express` automatically.
|
|
147
163
|
|
|
148
|
-
|
|
149
|
-
import { createLambdaHandler } from '@frontmcp/adapters/lambda';
|
|
150
|
-
import { AppModule } from './app.module';
|
|
151
|
-
|
|
152
|
-
export const handler = createLambdaHandler(AppModule, {
|
|
153
|
-
streaming: false,
|
|
154
|
-
});
|
|
155
|
-
```
|
|
164
|
+
If you need to customize behaviour (CORS, request mapping, streaming), do so in your `@FrontMcp` decorated server class — the same code runs locally with `frontmcp dev`, in containers with `--target node`, and in Lambda with `--target lambda`.
|
|
156
165
|
|
|
157
166
|
## Step 5: Environment Variables
|
|
158
167
|
|
|
@@ -202,14 +211,14 @@ If you prefer AWS CDK over SAM:
|
|
|
202
211
|
|
|
203
212
|
```typescript
|
|
204
213
|
import * as cdk from 'aws-cdk-lib';
|
|
205
|
-
import * as lambda from 'aws-cdk-lib/aws-lambda';
|
|
206
214
|
import * as apigw from 'aws-cdk-lib/aws-apigatewayv2';
|
|
207
215
|
import * as integrations from 'aws-cdk-lib/aws-apigatewayv2-integrations';
|
|
216
|
+
import * as lambda from 'aws-cdk-lib/aws-lambda';
|
|
208
217
|
|
|
209
218
|
const fn = new lambda.Function(this, 'FrontMcpHandler', {
|
|
210
219
|
runtime: lambda.Runtime.NODEJS_24_X,
|
|
211
220
|
handler: 'handler.handler',
|
|
212
|
-
code: lambda.Code.fromAsset('
|
|
221
|
+
code: lambda.Code.fromAsset('dist/lambda'),
|
|
213
222
|
memorySize: 512,
|
|
214
223
|
timeout: cdk.Duration.seconds(30),
|
|
215
224
|
architecture: lambda.Architecture.ARM_64,
|
|
@@ -239,8 +248,8 @@ aws cloudformation describe-stacks \
|
|
|
239
248
|
--query "Stacks[0].Outputs[?OutputKey=='ApiEndpoint'].OutputValue" \
|
|
240
249
|
--output text
|
|
241
250
|
|
|
242
|
-
# Health check
|
|
243
|
-
curl https://abc123.execute-api.us-east-1.amazonaws.com/
|
|
251
|
+
# Health check (FrontMCP serves /healthz by default; /health is a legacy alias)
|
|
252
|
+
curl https://abc123.execute-api.us-east-1.amazonaws.com/healthz
|
|
244
253
|
```
|
|
245
254
|
|
|
246
255
|
## Cold Start Mitigation
|
|
@@ -276,7 +285,7 @@ Lambda cold starts occur when a new execution environment is initialized. Strate
|
|
|
276
285
|
| ------------------ | -------------------------------------------------------------- | --------------------------------------- | -------------------------------------------------------------------------------------------------- |
|
|
277
286
|
| 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 |
|
|
278
287
|
| Architecture | `arm64` (Graviton) | `x86_64` | ARM64 functions initialize faster and cost less per ms of compute |
|
|
279
|
-
| Handler path | `handler.handler` in SAM
|
|
288
|
+
| Handler path | `handler.handler` with `CodeUri: dist/lambda/` in SAM | `index.handler` or `src/lambda.handler` | The FrontMCP Lambda build emits `dist/lambda/handler.cjs`; mismatched paths cause 502 errors |
|
|
280
289
|
| 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 |
|
|
281
290
|
| 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 |
|
|
282
291
|
|
|
@@ -284,8 +293,9 @@ Lambda cold starts occur when a new execution environment is initialized. Strate
|
|
|
284
293
|
|
|
285
294
|
**Build**
|
|
286
295
|
|
|
296
|
+
- [ ] `@codegenie/serverless-express` is listed in `package.json` (peer dep validated by the adapter)
|
|
287
297
|
- [ ] `frontmcp build --target lambda` completes without errors
|
|
288
|
-
- [ ] `handler.
|
|
298
|
+
- [ ] `dist/lambda/handler.cjs` exists and exports a `handler` function
|
|
289
299
|
|
|
290
300
|
**SAM / CDK**
|
|
291
301
|
|
|
@@ -295,7 +305,7 @@ Lambda cold starts occur when a new execution environment is initialized. Strate
|
|
|
295
305
|
|
|
296
306
|
**Runtime**
|
|
297
307
|
|
|
298
|
-
- [ ] `curl https://<api-id>.execute-api.<region>.amazonaws.com/
|
|
308
|
+
- [ ] `curl https://<api-id>.execute-api.<region>.amazonaws.com/healthz` returns `{"status":"ok"}`
|
|
299
309
|
- [ ] CloudWatch Logs show successful invocations without errors
|
|
300
310
|
- [ ] `NODE_ENV` is set to `production` in the function configuration
|
|
301
311
|
|
|
@@ -311,18 +321,19 @@ Lambda cold starts occur when a new execution environment is initialized. Strate
|
|
|
311
321
|
| Problem | Cause | Solution |
|
|
312
322
|
| ------------------------------------ | --------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- |
|
|
313
323
|
| Timeout errors | Function timeout too low or waiting on unreachable resource | Increase `Timeout` in the SAM template; verify network connectivity to dependencies |
|
|
314
|
-
| 502 Bad Gateway | Handler path mismatch, missing env vars, or unhandled exception | Check CloudWatch Logs; confirm `Handler
|
|
324
|
+
| 502 Bad Gateway | Handler path mismatch, missing env vars, or unhandled exception | Check CloudWatch Logs; confirm `Handler: handler.handler` and `CodeUri: dist/lambda/` |
|
|
325
|
+
| `Cannot find module @codegenie/...` | Peer dep not installed locally or in Layer | `npm install @codegenie/serverless-express` (the build's `validate` hook checks for it) |
|
|
315
326
|
| Cold starts too slow | Low memory, x86 architecture, or large bundle | Increase memory to 512+ MB, use `arm64`, or enable provisioned concurrency |
|
|
316
327
|
| 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 |
|
|
317
328
|
| `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` |
|
|
318
329
|
|
|
319
330
|
## Examples
|
|
320
331
|
|
|
321
|
-
| Example | Level | Description
|
|
322
|
-
| -------------------------------------------------------------------------------------- | ------------ |
|
|
323
|
-
| [`cdk-deployment`](../examples/deploy-to-lambda/cdk-deployment.md) | Advanced | Deploy a FrontMCP server to AWS Lambda using CDK with provisioned concurrency and secrets management.
|
|
324
|
-
| [`lambda-handler-with-cors`](../examples/deploy-to-lambda/lambda-handler-with-cors.md) | Intermediate |
|
|
325
|
-
| [`sam-template-basic`](../examples/deploy-to-lambda/sam-template-basic.md) | Basic | Deploy a FrontMCP server to AWS Lambda with API Gateway using a SAM template.
|
|
332
|
+
| Example | Level | Description |
|
|
333
|
+
| -------------------------------------------------------------------------------------- | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
334
|
+
| [`cdk-deployment`](../examples/deploy-to-lambda/cdk-deployment.md) | Advanced | Deploy a FrontMCP server to AWS Lambda using CDK with provisioned concurrency and secrets management. |
|
|
335
|
+
| [`lambda-handler-with-cors`](../examples/deploy-to-lambda/lambda-handler-with-cors.md) | Intermediate | CORS for a FrontMCP Lambda is configured at the API Gateway HTTP API level, not in the handler. `frontmcp build --target lambda` writes `dist/lambda/handler.cjs` — your `@FrontMcp` server is wrapped automatically with `@codegenie/serverless-express`, so CORS belongs on the gateway. |
|
|
336
|
+
| [`sam-template-basic`](../examples/deploy-to-lambda/sam-template-basic.md) | Basic | Deploy a FrontMCP server to AWS Lambda with API Gateway using a SAM template. |
|
|
326
337
|
|
|
327
338
|
> See all examples in [`examples/deploy-to-lambda/`](../examples/deploy-to-lambda/)
|
|
328
339
|
|
|
@@ -3,60 +3,98 @@ name: deploy-to-node-dockerfile
|
|
|
3
3
|
description: Multi-stage Dockerfile for building and running a FrontMCP server in production
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
#
|
|
6
|
+
# Multi-Stage Dockerfile for FrontMCP
|
|
7
|
+
|
|
8
|
+
This reference shows the canonical multi-stage `Dockerfile` for building and running a FrontMCP server (`--target node`) in production.
|
|
9
|
+
|
|
10
|
+
## When to Use This Skill
|
|
11
|
+
|
|
12
|
+
### Must Use
|
|
13
|
+
|
|
14
|
+
- Containerizing a FrontMCP Node target server with Docker for production
|
|
15
|
+
- Producing a slim, non-root image for deployment to Kubernetes, ECS, Fly.io, etc.
|
|
16
|
+
|
|
17
|
+
### Recommended
|
|
18
|
+
|
|
19
|
+
- Pairing with `deploy-to-node` for Docker Compose, PM2, or NGINX setups
|
|
20
|
+
- Using a non-root user inside the container for security hardening
|
|
21
|
+
|
|
22
|
+
### Skip When
|
|
7
23
|
|
|
24
|
+
- Deploying serverless to Vercel, Lambda, or Cloudflare (no Dockerfile needed)
|
|
25
|
+
- Distributing a single-file binary -- use `build-for-cli` instead
|
|
26
|
+
|
|
27
|
+
## Reference Dockerfile
|
|
28
|
+
|
|
29
|
+
Save as `Dockerfile` in your project root. Adjust the package manager (`yarn`/`npm`/`pnpm`) to match your project.
|
|
30
|
+
|
|
31
|
+
```dockerfile
|
|
32
|
+
# ---- Build Stage ----
|
|
8
33
|
FROM node:24-alpine AS builder
|
|
9
34
|
|
|
10
35
|
WORKDIR /app
|
|
11
36
|
|
|
12
37
|
# Install dependencies first for better layer caching
|
|
13
|
-
|
|
14
38
|
COPY package.json yarn.lock ./
|
|
15
39
|
RUN yarn install --frozen-lockfile
|
|
16
40
|
|
|
17
|
-
# Copy source and build
|
|
18
|
-
|
|
41
|
+
# Copy source and build for the Node.js target
|
|
19
42
|
COPY . .
|
|
20
43
|
RUN yarn frontmcp build --target node
|
|
21
44
|
|
|
22
45
|
# ---- Production Stage ----
|
|
23
|
-
|
|
24
46
|
FROM node:24-alpine AS production
|
|
25
47
|
|
|
26
48
|
WORKDIR /app
|
|
27
49
|
|
|
28
50
|
# Create non-root user for security
|
|
29
|
-
|
|
30
51
|
RUN addgroup -S frontmcp && adduser -S frontmcp -G frontmcp
|
|
31
52
|
|
|
32
53
|
# Copy only production artifacts
|
|
33
|
-
|
|
34
54
|
COPY --from=builder /app/dist ./dist
|
|
35
55
|
COPY --from=builder /app/package.json ./
|
|
36
56
|
COPY --from=builder /app/yarn.lock ./
|
|
37
57
|
|
|
38
58
|
# Install production dependencies only
|
|
39
|
-
|
|
40
59
|
RUN yarn install --frozen-lockfile --production && \
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
# Set ownership
|
|
60
|
+
yarn cache clean
|
|
44
61
|
|
|
62
|
+
# Set ownership and switch to non-root user
|
|
45
63
|
RUN chown -R frontmcp:frontmcp /app
|
|
46
|
-
|
|
47
64
|
USER frontmcp
|
|
48
65
|
|
|
49
66
|
# Environment defaults
|
|
50
|
-
|
|
51
67
|
ENV NODE_ENV=production
|
|
52
68
|
ENV PORT=3000
|
|
53
69
|
|
|
54
70
|
EXPOSE 3000
|
|
55
71
|
|
|
72
|
+
# FrontMCP exposes /healthz by default; /health is a legacy alias kept for
|
|
73
|
+
# backwards compatibility unless you set `health.healthzPath` to '/health'.
|
|
56
74
|
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
|
|
57
|
-
|
|
75
|
+
CMD wget --no-verbose --tries=1 --spider http://localhost:3000/healthz || exit 1
|
|
58
76
|
|
|
59
77
|
CMD ["node", "dist/main.js"]
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Build and Run
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
# Build the image
|
|
84
|
+
docker build -t my-frontmcp-server .
|
|
85
|
+
|
|
86
|
+
# Run the container
|
|
87
|
+
docker run -p 3000:3000 -e NODE_ENV=production my-frontmcp-server
|
|
88
|
+
|
|
89
|
+
# Verify
|
|
90
|
+
curl http://localhost:3000/healthz
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Notes
|
|
94
|
+
|
|
95
|
+
- The build stage installs all dependencies (including dev) so `frontmcp build --target node` can run; the production stage installs only `--production` deps.
|
|
96
|
+
- The non-root `frontmcp` user prevents container escape from running as `root`.
|
|
97
|
+
- For `dist/main.js` to exist, `frontmcp build --target node` must complete without errors. If your entry file is not `src/main.ts`, pass `-e ./path/to/entry.ts`.
|
|
60
98
|
|
|
61
99
|
## Examples
|
|
62
100
|
|
|
@@ -66,3 +104,7 @@ CMD ["node", "dist/main.js"]
|
|
|
66
104
|
| [`secure-nonroot-dockerfile`](../examples/deploy-to-node-dockerfile/secure-nonroot-dockerfile.md) | Advanced | A production Dockerfile with a non-root user, proper ownership, and security hardening. |
|
|
67
105
|
|
|
68
106
|
> See all examples in [`examples/deploy-to-node-dockerfile/`](../examples/deploy-to-node-dockerfile/)
|
|
107
|
+
|
|
108
|
+
## Reference
|
|
109
|
+
|
|
110
|
+
- Related skills: `deploy-to-node`, `build-for-mcpb`
|
|
@@ -65,7 +65,7 @@ COPY --from=builder /app/package.json ./
|
|
|
65
65
|
RUN yarn install --frozen-lockfile --production && yarn cache clean
|
|
66
66
|
EXPOSE 3000
|
|
67
67
|
HEALTHCHECK --interval=30s --timeout=5s --retries=3 --start-period=10s \
|
|
68
|
-
CMD wget -qO- http://localhost:3000/
|
|
68
|
+
CMD wget -qO- http://localhost:3000/healthz || exit 1
|
|
69
69
|
CMD ["node", "dist/main.js"]
|
|
70
70
|
```
|
|
71
71
|
|
|
@@ -95,7 +95,7 @@ services:
|
|
|
95
95
|
condition: service_healthy
|
|
96
96
|
restart: unless-stopped
|
|
97
97
|
healthcheck:
|
|
98
|
-
test: ['CMD', 'wget', '-qO-', 'http://localhost:3000/
|
|
98
|
+
test: ['CMD', 'wget', '-qO-', 'http://localhost:3000/healthz']
|
|
99
99
|
interval: 30s
|
|
100
100
|
timeout: 5s
|
|
101
101
|
retries: 3
|
|
@@ -149,14 +149,17 @@ LOG_LEVEL=info
|
|
|
149
149
|
|
|
150
150
|
## Step 5: Health Checks
|
|
151
151
|
|
|
152
|
-
FrontMCP servers expose
|
|
152
|
+
FrontMCP servers expose `/healthz` by default (configurable via `health.healthzPath`). `/health` is registered as a legacy alias for backwards compatibility unless `healthzPath` is explicitly set to `/health`:
|
|
153
153
|
|
|
154
154
|
```bash
|
|
155
|
-
curl http://localhost:3000/
|
|
155
|
+
curl http://localhost:3000/healthz
|
|
156
156
|
# Response: { "status": "ok", "uptime": 12345 }
|
|
157
|
+
|
|
158
|
+
# /health works too (legacy alias) — prefer /healthz for new infra
|
|
159
|
+
curl http://localhost:3000/health
|
|
157
160
|
```
|
|
158
161
|
|
|
159
|
-
For Docker, the `HEALTHCHECK` directive in the Dockerfile and the `healthcheck` block in Compose handle this automatically. Point your load balancer or orchestrator at
|
|
162
|
+
For Docker, the `HEALTHCHECK` directive in the Dockerfile and the `healthcheck` block in Compose handle this automatically. Point your load balancer or orchestrator at `/healthz` for liveness checks.
|
|
160
163
|
|
|
161
164
|
## Step 6: PM2 for Bare Metal
|
|
162
165
|
|
|
@@ -236,7 +239,7 @@ services:
|
|
|
236
239
|
|
|
237
240
|
- [ ] `docker compose up -d` starts all services without errors
|
|
238
241
|
- [ ] `docker compose ps` shows all containers as healthy
|
|
239
|
-
- [ ] `curl http://localhost:3000/
|
|
242
|
+
- [ ] `curl http://localhost:3000/healthz` returns `{"status":"ok"}`
|
|
240
243
|
|
|
241
244
|
**Production Readiness**
|
|
242
245
|
|