@frontmcp/skills 1.1.2-beta.1 → 1.2.0
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
package/catalog/frontmcp-production-readiness/examples/production-node-server/graceful-shutdown.md
CHANGED
|
@@ -2,24 +2,40 @@
|
|
|
2
2
|
name: graceful-shutdown
|
|
3
3
|
reference: production-node-server
|
|
4
4
|
level: intermediate
|
|
5
|
-
description:
|
|
6
|
-
tags:
|
|
5
|
+
description: Shows how to expose load-balancer drain state without overriding the FrontMCP framework's built-in SIGTERM / SIGINT graceful shutdown.
|
|
6
|
+
tags:
|
|
7
|
+
- production
|
|
8
|
+
- redis
|
|
9
|
+
- database
|
|
10
|
+
- node
|
|
11
|
+
- graceful
|
|
12
|
+
- shutdown
|
|
7
13
|
features:
|
|
8
|
-
-
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
-
|
|
14
|
+
- The framework already handles SIGTERM/SIGINT — never call `server.close()` (no such method) or `process.exit()` on top of it
|
|
15
|
+
- Use `server.dispose()` if you need explicit cleanup in non-server (SDK) contexts
|
|
16
|
+
- Add a _drain probe_ on `/healthz` so load balancers stop sending traffic during the framework's drain window
|
|
17
|
+
- "Avoid handler conflicts: registering a second SIGTERM that calls `process.exit(0)` races the framework's own exit path"
|
|
12
18
|
---
|
|
13
19
|
|
|
14
20
|
# Graceful Shutdown with SIGTERM Handling
|
|
15
21
|
|
|
16
|
-
Shows how to
|
|
22
|
+
Shows how to expose load-balancer drain state without overriding the FrontMCP framework's built-in SIGTERM / SIGINT graceful shutdown.
|
|
23
|
+
|
|
24
|
+
> The framework already installs SIGTERM/SIGINT handlers that:
|
|
25
|
+
>
|
|
26
|
+
> 1. Unregister the server from the notification bus
|
|
27
|
+
> 2. Call `scope.shutdown()` to dispose all providers
|
|
28
|
+
> 3. Call `mcpServer.close()` on the underlying transport
|
|
29
|
+
> 4. Exit with code 0 (or 1 after a 5s deadline)
|
|
30
|
+
>
|
|
31
|
+
> See `libs/sdk/src/front-mcp/front-mcp.ts`. **Do not register a second handler that also calls `process.exit()`** — both will fire and race.
|
|
17
32
|
|
|
18
33
|
## Code
|
|
19
34
|
|
|
20
35
|
```typescript
|
|
21
36
|
// src/main.ts
|
|
22
37
|
import { FrontMcp } from '@frontmcp/sdk';
|
|
38
|
+
|
|
23
39
|
import { MyApp } from './my.app';
|
|
24
40
|
|
|
25
41
|
@FrontMcp({
|
|
@@ -30,58 +46,58 @@ import { MyApp } from './my.app';
|
|
|
30
46
|
host: process.env.REDIS_HOST ?? 'localhost',
|
|
31
47
|
port: 6379,
|
|
32
48
|
},
|
|
49
|
+
// /healthz is auto-registered on Node — see frontmcp-production-readiness
|
|
50
|
+
// health-readiness-endpoints reference.
|
|
33
51
|
})
|
|
34
52
|
export default class ResilientServer {}
|
|
35
53
|
```
|
|
36
54
|
|
|
37
55
|
```typescript
|
|
38
|
-
// src/lifecycle/
|
|
39
|
-
//
|
|
56
|
+
// src/lifecycle/drain-signal.ts
|
|
57
|
+
// Track shutdown state ONLY — the framework owns the actual shutdown sequence.
|
|
58
|
+
// Use this for /healthz custom probes so load balancers stop sending traffic
|
|
59
|
+
// during the framework's drain window.
|
|
40
60
|
|
|
41
61
|
let isShuttingDown = false;
|
|
42
62
|
|
|
43
|
-
export function
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
isShuttingDown = true;
|
|
47
|
-
|
|
48
|
-
console.log(`Received ${signal}. Starting graceful shutdown...`);
|
|
49
|
-
|
|
50
|
-
// 1. Stop accepting new connections
|
|
51
|
-
await server.close();
|
|
52
|
-
console.log('Server closed — no new connections accepted.');
|
|
53
|
-
|
|
54
|
-
// 2. Wait for in-flight requests to complete (with timeout)
|
|
55
|
-
const drainTimeout = setTimeout(() => {
|
|
56
|
-
console.error('Drain timeout reached. Forcing exit.');
|
|
57
|
-
process.exit(1);
|
|
58
|
-
}, 30_000); // 30 second drain period
|
|
59
|
-
|
|
60
|
-
// 3. Dispose all resources (Redis, DB connections, providers)
|
|
61
|
-
await server.dispose();
|
|
62
|
-
clearTimeout(drainTimeout);
|
|
63
|
-
console.log('All resources disposed. Exiting.');
|
|
63
|
+
export function isDraining(): boolean {
|
|
64
|
+
return isShuttingDown;
|
|
65
|
+
}
|
|
64
66
|
|
|
65
|
-
|
|
67
|
+
export function setupDrainSignal(): void {
|
|
68
|
+
// Mark as draining as soon as a signal arrives. The framework's handler
|
|
69
|
+
// also fires (Node calls every listener) and runs the actual shutdown.
|
|
70
|
+
// We do NOT call process.exit() — the framework owns the exit.
|
|
71
|
+
const markDraining = () => {
|
|
72
|
+
isShuttingDown = true;
|
|
73
|
+
console.log('[drain] Marking server as draining for /healthz.');
|
|
66
74
|
};
|
|
67
|
-
|
|
68
|
-
process.on('
|
|
69
|
-
process.on('SIGINT', () => shutdown('SIGINT'));
|
|
75
|
+
process.on('SIGTERM', markDraining);
|
|
76
|
+
process.on('SIGINT', markDraining);
|
|
70
77
|
}
|
|
78
|
+
```
|
|
71
79
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
80
|
+
```typescript
|
|
81
|
+
// src/probes/drain-probe.ts — wire into health.probes
|
|
82
|
+
import { isDraining } from '../lifecycle/drain-signal';
|
|
83
|
+
|
|
84
|
+
export const drainProbe = {
|
|
85
|
+
name: 'drain',
|
|
86
|
+
async check() {
|
|
87
|
+
return isDraining() ? { status: 'unhealthy' as const, message: 'shutting down' } : { status: 'healthy' as const };
|
|
88
|
+
},
|
|
89
|
+
};
|
|
76
90
|
```
|
|
77
91
|
|
|
78
92
|
## What This Demonstrates
|
|
79
93
|
|
|
80
|
-
-
|
|
81
|
-
-
|
|
82
|
-
-
|
|
83
|
-
-
|
|
94
|
+
- The framework already handles SIGTERM/SIGINT — never call `server.close()` (no such method) or `process.exit()` on top of it
|
|
95
|
+
- Use `server.dispose()` if you need explicit cleanup in non-server (SDK) contexts
|
|
96
|
+
- Add a _drain probe_ on `/healthz` so load balancers stop sending traffic during the framework's drain window
|
|
97
|
+
- Avoid handler conflicts: registering a second SIGTERM that calls `process.exit(0)` races the framework's own exit path
|
|
84
98
|
|
|
85
99
|
## Related
|
|
86
100
|
|
|
87
101
|
- See `production-node-server` for the full process management and scaling checklist
|
|
102
|
+
- Framework SIGTERM/SIGINT wiring: `libs/sdk/src/front-mcp/front-mcp.ts`
|
|
103
|
+
- Health probes: `references/health-readiness-endpoints.md`
|
|
@@ -21,6 +21,7 @@ Shows how to configure Redis-backed session storage, connection pooling, and sta
|
|
|
21
21
|
```typescript
|
|
22
22
|
// src/main.ts
|
|
23
23
|
import { FrontMcp } from '@frontmcp/sdk';
|
|
24
|
+
|
|
24
25
|
import { MyApp } from './my.app';
|
|
25
26
|
|
|
26
27
|
@FrontMcp({
|
|
@@ -66,10 +67,12 @@ import { Provider, ProviderScope } from '@frontmcp/sdk';
|
|
|
66
67
|
|
|
67
68
|
export const ENV_VALIDATOR = Symbol('EnvValidator');
|
|
68
69
|
|
|
70
|
+
// Validate env in the constructor rather than a lifecycle hook — first
|
|
71
|
+
// instantiation throws synchronously on missing config and prevents the
|
|
72
|
+
// server from starting (fail fast). Providers don't expose onInit/onDestroy.
|
|
69
73
|
@Provider({ token: ENV_VALIDATOR, scope: ProviderScope.GLOBAL })
|
|
70
74
|
export class EnvValidationProvider {
|
|
71
|
-
|
|
72
|
-
// Fail fast on missing config — don't discover in production at runtime
|
|
75
|
+
constructor() {
|
|
73
76
|
const required = ['REDIS_HOST', 'NODE_ENV'];
|
|
74
77
|
const missing = required.filter((key) => !process.env[key]);
|
|
75
78
|
|
package/catalog/frontmcp-production-readiness/examples/production-vercel/cold-start-optimization.md
CHANGED
|
@@ -2,18 +2,26 @@
|
|
|
2
2
|
name: cold-start-optimization
|
|
3
3
|
reference: production-vercel
|
|
4
4
|
level: intermediate
|
|
5
|
-
description:
|
|
6
|
-
tags:
|
|
5
|
+
description: Shows how to minimize cold start time by lazy-loading dependencies on first use, avoiding heavy initialization at module scope, and caching expensive operations across warm invocations.
|
|
6
|
+
tags:
|
|
7
|
+
- production
|
|
8
|
+
- vercel
|
|
9
|
+
- openapi
|
|
10
|
+
- performance
|
|
11
|
+
- cold
|
|
12
|
+
- start
|
|
7
13
|
features:
|
|
8
|
-
-
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
-
|
|
14
|
+
- Lazy-loading heavy SDKs via dynamic `import()` on **first use**, not at module scope (and not in a fictional `Provider.onInit`)
|
|
15
|
+
- Caching expensive fetches (e.g., OpenAPI specs) across warm invocations
|
|
16
|
+
- Keeping the module scope lightweight with no side effects
|
|
17
|
+
- No `top-level await` and no heavy global initialization or network calls at import time (lightweight module-scope caching of cheap synchronous values like `cachedSpec` is fine)
|
|
12
18
|
---
|
|
13
19
|
|
|
14
20
|
# Cold Start Optimization for Serverless
|
|
15
21
|
|
|
16
|
-
Shows how to minimize cold start time by lazy-loading dependencies, avoiding heavy initialization at module scope, and caching expensive operations.
|
|
22
|
+
Shows how to minimize cold start time by lazy-loading dependencies on first use, avoiding heavy initialization at module scope, and caching expensive operations across warm invocations.
|
|
23
|
+
|
|
24
|
+
> `@Provider`-decorated classes do **not** have `onInit` / `onDestroy` lifecycle hooks. Initialize lazily on first method call inside the provider, or in the constructor if synchronous.
|
|
17
25
|
|
|
18
26
|
## Code
|
|
19
27
|
|
|
@@ -23,22 +31,30 @@ import { Provider, ProviderScope } from '@frontmcp/sdk';
|
|
|
23
31
|
|
|
24
32
|
export const API_CLIENT = Symbol('ApiClient');
|
|
25
33
|
|
|
34
|
+
// Provider initializes lazily on first getClient() call — heavy SDK is
|
|
35
|
+
// not imported at module scope, so cold starts stay fast.
|
|
26
36
|
@Provider({ token: API_CLIENT, scope: ProviderScope.GLOBAL })
|
|
27
37
|
export class LazyApiClientProvider {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
38
|
+
private clientPromise: Promise<unknown> | undefined;
|
|
39
|
+
|
|
40
|
+
async getClient(): Promise<unknown> {
|
|
41
|
+
if (!this.clientPromise) {
|
|
42
|
+
// Reset the cache from inside the async initializer so a transient
|
|
43
|
+
// import/init failure doesn't permanently poison `clientPromise` for
|
|
44
|
+
// every warm invocation that follows. The initializer itself owns the
|
|
45
|
+
// try/catch + rethrow, so callers see the original error.
|
|
46
|
+
const promise = (async () => {
|
|
47
|
+
try {
|
|
48
|
+
const { HeavySDK } = await import('heavy-third-party-sdk');
|
|
49
|
+
return new HeavySDK({ apiKey: process.env.API_KEY });
|
|
50
|
+
} catch (err) {
|
|
51
|
+
if (this.clientPromise === promise) this.clientPromise = undefined;
|
|
52
|
+
throw err;
|
|
53
|
+
}
|
|
54
|
+
})();
|
|
55
|
+
this.clientPromise = promise;
|
|
56
|
+
}
|
|
57
|
+
return this.clientPromise;
|
|
42
58
|
}
|
|
43
59
|
}
|
|
44
60
|
```
|
|
@@ -82,7 +98,8 @@ import { FrontMcp } from '@frontmcp/sdk';
|
|
|
82
98
|
import { MyApp } from './my.app';
|
|
83
99
|
|
|
84
100
|
// No heavy initialization here — this runs on every cold start
|
|
85
|
-
// No top-level await
|
|
101
|
+
// No top-level await and no heavy init at import time. The module-scope
|
|
102
|
+
// cachedSpec below is fine — it's a cheap synchronous value populated lazily.
|
|
86
103
|
|
|
87
104
|
@FrontMcp({
|
|
88
105
|
info: { name: 'fast-start', version: '1.0.0' },
|
|
@@ -94,10 +111,10 @@ export default class FastStartServer {}
|
|
|
94
111
|
|
|
95
112
|
## What This Demonstrates
|
|
96
113
|
|
|
97
|
-
- Lazy-loading heavy
|
|
114
|
+
- Lazy-loading heavy SDKs via dynamic `import()` on **first use**, not at module scope (and not in a fictional `Provider.onInit`)
|
|
98
115
|
- Caching expensive fetches (e.g., OpenAPI specs) across warm invocations
|
|
99
116
|
- Keeping the module scope lightweight with no side effects
|
|
100
|
-
- No `top-level await
|
|
117
|
+
- No `top-level await` and no heavy global initialization or network calls at import time (lightweight module-scope caching of cheap synchronous values like `cachedSpec` is fine)
|
|
101
118
|
|
|
102
119
|
## Related
|
|
103
120
|
|
package/catalog/frontmcp-production-readiness/examples/production-vercel/vercel-edge-config.md
CHANGED
|
@@ -2,77 +2,68 @@
|
|
|
2
2
|
name: vercel-edge-config
|
|
3
3
|
reference: production-vercel
|
|
4
4
|
level: basic
|
|
5
|
-
description: '
|
|
6
|
-
tags:
|
|
5
|
+
description: 'Checklist for verifying the Vercel Build Output API v3 artifact and edge config produced by `frontmcp build --target vercel`. **Note:** configuration authoring lives in `frontmcp-deployment → references/deploy-to-vercel.md`; this file is checklist-only.'
|
|
6
|
+
tags:
|
|
7
|
+
- production
|
|
8
|
+
- vercel-kv
|
|
9
|
+
- vercel
|
|
10
|
+
- session
|
|
11
|
+
- serverless
|
|
12
|
+
- checklist
|
|
7
13
|
features:
|
|
8
|
-
-
|
|
9
|
-
-
|
|
10
|
-
- '
|
|
11
|
-
-
|
|
14
|
+
- Verify `frontmcp build --target vercel` produced `.vercel/output/functions/index.func/handler.cjs`
|
|
15
|
+
- No hand-written `vercel.json` `builds`/`routes` — the build adapter uses Build Output API v3
|
|
16
|
+
- "Verify Vercel KV (`provider: 'vercel-kv'`) is configured for session/cache state"
|
|
17
|
+
- Verify CORS origins include `VERCEL_URL` and any custom production domain
|
|
12
18
|
---
|
|
13
19
|
|
|
14
|
-
# Vercel
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
##
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
origin: [
|
|
52
|
-
process.env.VERCEL_URL ? `https://${process.env.VERCEL_URL}` : 'http://localhost:3000',
|
|
53
|
-
'https://app.example.com',
|
|
54
|
-
],
|
|
55
|
-
},
|
|
56
|
-
})
|
|
57
|
-
export default class VercelMcpServer {}
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
```typescript
|
|
61
|
-
// api/mcp.ts — Vercel serverless function entry point
|
|
62
|
-
import Server from '../src/main';
|
|
63
|
-
|
|
64
|
-
// Export the server class directly — FrontMCP handles
|
|
65
|
-
// the Vercel serverless function lifecycle automatically.
|
|
66
|
-
export default Server;
|
|
67
|
-
```
|
|
20
|
+
# Vercel Deployment: Production-Readiness Checklist
|
|
21
|
+
|
|
22
|
+
Checklist for verifying the Vercel Build Output API v3 artifact and edge config produced by `frontmcp build --target vercel`. **Note:** configuration authoring lives in `frontmcp-deployment → references/deploy-to-vercel.md`; this file is checklist-only.
|
|
23
|
+
|
|
24
|
+
## Build artifact checks
|
|
25
|
+
|
|
26
|
+
- [ ] `frontmcp build --target vercel` completed without warnings
|
|
27
|
+
- [ ] `.vercel/output/config.json` exists (Build Output API v3 — `version: 3`)
|
|
28
|
+
- [ ] `.vercel/output/functions/index.func/handler.cjs` exists — this is the actual function bundle
|
|
29
|
+
- [ ] `.vercel/output/functions/index.func/.vc-config.json` declares `runtime: nodejs24.x` (the default written by the build adapter) and `handler: "handler.cjs"`
|
|
30
|
+
- [ ] No hand-written `vercel.json` with the obsolete `{ "builds": [...], "routes": [...] }` shape — modern adapter emits `{ "version": 2, "buildCommand": ..., "installCommand": ... }` and routes through Build Output API
|
|
31
|
+
- [ ] No hand-written `src/lambda.ts` / `api/mcp.ts` with a fictional `createVercelHandler(...)` import — the build adapter generates `index.js` that requires your decorated `@FrontMcp` class
|
|
32
|
+
|
|
33
|
+
## Runtime config (`@FrontMcp` decorator)
|
|
34
|
+
|
|
35
|
+
- [ ] `redis: { provider: 'vercel-kv' }` for session/cache state (in-memory is per-invocation only)
|
|
36
|
+
- [ ] `cors.origin` is an explicit allowlist (`VERCEL_URL`, custom domain) — never `*` in production
|
|
37
|
+
- [ ] No SQLite usage (no persistent filesystem on Vercel functions)
|
|
38
|
+
- [ ] No `setInterval` / background timers — they don't survive freeze
|
|
39
|
+
|
|
40
|
+
## Cold-start budget
|
|
41
|
+
|
|
42
|
+
- [ ] No top-level `await` in `src/main.ts`
|
|
43
|
+
- [ ] Heavy SDKs are lazy-imported (`await import('...')`)
|
|
44
|
+
- [ ] Cold start under your function `maxDuration` budget on first request
|
|
45
|
+
|
|
46
|
+
## Env & secrets
|
|
47
|
+
|
|
48
|
+
- [ ] All required env vars set in Vercel project settings (`Production` + `Preview` scopes)
|
|
49
|
+
- [ ] No secrets committed to `vercel.json` or `.env`
|
|
50
|
+
- [ ] `KV_REST_API_URL` / `KV_REST_API_TOKEN` linked from the KV integration
|
|
51
|
+
|
|
52
|
+
## Deploy & monitoring
|
|
53
|
+
|
|
54
|
+
- [ ] Preview deployment exercises the full MCP flow (init → `tools/list` → `tools/call`)
|
|
55
|
+
- [ ] `vercel --prod` deploy succeeds and the function appears in the dashboard
|
|
56
|
+
- [ ] Function logs show no warnings on cold start
|
|
68
57
|
|
|
69
58
|
## What This Demonstrates
|
|
70
59
|
|
|
71
|
-
-
|
|
72
|
-
-
|
|
73
|
-
-
|
|
74
|
-
-
|
|
60
|
+
- Verify `frontmcp build --target vercel` produced `.vercel/output/functions/index.func/handler.cjs`
|
|
61
|
+
- No hand-written `vercel.json` `builds`/`routes` — the build adapter uses Build Output API v3
|
|
62
|
+
- Verify Vercel KV (`provider: 'vercel-kv'`) is configured for session/cache state
|
|
63
|
+
- Verify CORS origins include `VERCEL_URL` and any custom production domain
|
|
75
64
|
|
|
76
65
|
## Related
|
|
77
66
|
|
|
78
|
-
-
|
|
67
|
+
- Configuration source of truth: `frontmcp-deployment/references/deploy-to-vercel.md`
|
|
68
|
+
- Build adapter source: `libs/cli/src/commands/build/adapters/vercel.ts`
|
|
69
|
+
- See `production-vercel` for the edge-runtime / scaling checklist
|
|
@@ -116,6 +116,11 @@ These checks apply to ALL deployment targets. Run them first, then proceed to yo
|
|
|
116
116
|
- [ ] Error rate metrics are tracked
|
|
117
117
|
- [ ] Tool execution duration is measured
|
|
118
118
|
- [ ] Error tracking service is integrated (Sentry, Datadog, etc.)
|
|
119
|
+
- [ ] OTel `MeterProvider` registered (not just the tracer)
|
|
120
|
+
- [ ] `frontmcp_skills_bundle_pulls_total` is scraped
|
|
121
|
+
- [ ] `frontmcp_skills_signature_failures_total` is alerted on
|
|
122
|
+
- [ ] `frontmcp_skills_replay_rejects_total` is alerted on
|
|
123
|
+
- [ ] `frontmcp_skills_audit_dropped_total` is alerted on (audit back-pressure)
|
|
119
124
|
|
|
120
125
|
## Jobs & Workflows (if enabled)
|
|
121
126
|
|
|
@@ -131,6 +136,13 @@ These checks apply to ALL deployment targets. Run them first, then proceed to yo
|
|
|
131
136
|
- [ ] Skills caching is enabled for production (`skillsConfig.cache: { enabled: true }`)
|
|
132
137
|
- [ ] Cache TTL is tuned for skill instruction freshness requirements
|
|
133
138
|
- [ ] `/llm.txt` and `/skills` endpoints are tested for correct responses
|
|
139
|
+
- [ ] Skill audit log enabled (`skillsConfig.audit.enabled: true`) for production
|
|
140
|
+
- [ ] Audit signer is RS256 with a key rotation policy (`Rs256AuditSigner` + bundle-signing key)
|
|
141
|
+
- [ ] Audit store is persistent (`StorageAdapterAuditStore` with Redis / Vercel KV / SQLite)
|
|
142
|
+
- [ ] Audit chain verifier (`verifyChain`) runs in CI on the latest tail
|
|
143
|
+
- [ ] Single-writer constraint respected (v1.2.0): writes routed to a single elected leader pod
|
|
144
|
+
- [ ] `instructions` is set or `skillsConfig.injectInstructions` tuned for clients
|
|
145
|
+
- [ ] Auto-injected skill catalog summary stays within the 16 KB ceiling (review on each catalog change)
|
|
134
146
|
|
|
135
147
|
## ExtApps / Widgets (if enabled)
|
|
136
148
|
|
|
@@ -166,10 +178,10 @@ These checks apply to ALL deployment targets. Run them first, then proceed to yo
|
|
|
166
178
|
|
|
167
179
|
## Examples
|
|
168
180
|
|
|
169
|
-
| Example | Level | Description
|
|
170
|
-
| ------------------------------------------------------------------------------------ | ------------ |
|
|
171
|
-
| [`caching-and-performance`](../examples/common-checklist/caching-and-performance.md) | Advanced | Shows how to configure caching with
|
|
172
|
-
| [`observability-setup`](../examples/common-checklist/observability-setup.md) | Intermediate | Shows how to configure structured logging, error handling with MCP error codes, and monitoring integration for production.
|
|
173
|
-
| [`security-hardening`](../examples/common-checklist/security-hardening.md) | Basic | Shows how to configure authentication, CORS, input validation,
|
|
181
|
+
| Example | Level | Description |
|
|
182
|
+
| ------------------------------------------------------------------------------------ | ------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
183
|
+
| [`caching-and-performance`](../examples/common-checklist/caching-and-performance.md) | Advanced | Shows how to configure caching with the real `CachePlugin.init(...)` API and how to size connection pools so the server does not exhaust downstream resources. |
|
|
184
|
+
| [`observability-setup`](../examples/common-checklist/observability-setup.md) | Intermediate | Shows how to configure structured logging, error handling with MCP error codes, and monitoring integration for production. |
|
|
185
|
+
| [`security-hardening`](../examples/common-checklist/security-hardening.md) | Basic | Shows how to configure authentication, CORS, input validation, rate limiting, audit logging, and observability counters for a production FrontMCP server. |
|
|
174
186
|
|
|
175
187
|
> See all examples in [`examples/common-checklist/`](../examples/common-checklist/)
|
|
@@ -62,10 +62,10 @@ Checklist for deploying FrontMCP as a long-running local MCP server managed by t
|
|
|
62
62
|
|
|
63
63
|
## Examples
|
|
64
64
|
|
|
65
|
-
| Example | Level | Description
|
|
66
|
-
| --------------------------------------------------------------------------------------------- | ------------ |
|
|
67
|
-
| [`daemon-socket-config`](../examples/production-cli-daemon/daemon-socket-config.md) | Basic | Shows how to configure a FrontMCP server as a long-running local daemon with Unix socket transport, process management, and SQLite storage.
|
|
68
|
-
| [`graceful-shutdown-cleanup`](../examples/production-cli-daemon/graceful-shutdown-cleanup.md) | Intermediate | Shows how to
|
|
69
|
-
| [`security-and-permissions`](../examples/production-cli-daemon/security-and-permissions.md) | Advanced | Shows how to secure a local daemon with restrictive socket permissions, XDG-compliant config storage, and file-based secret management.
|
|
65
|
+
| Example | Level | Description |
|
|
66
|
+
| --------------------------------------------------------------------------------------------- | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
67
|
+
| [`daemon-socket-config`](../examples/production-cli-daemon/daemon-socket-config.md) | Basic | Shows how to configure a FrontMCP server as a long-running local daemon with Unix socket transport, process management, and SQLite storage. |
|
|
68
|
+
| [`graceful-shutdown-cleanup`](../examples/production-cli-daemon/graceful-shutdown-cleanup.md) | Intermediate | Shows how to layer daemon-specific cleanup (socket file, PID file) **on top of** the framework's built-in SIGTERM/SIGINT handler. |
|
|
69
|
+
| [`security-and-permissions`](../examples/production-cli-daemon/security-and-permissions.md) | Advanced | Shows how to secure a local daemon with restrictive socket permissions, XDG-compliant config storage, and file-based secret management. |
|
|
70
70
|
|
|
71
71
|
> See all examples in [`examples/production-cli-daemon/`](../examples/production-cli-daemon/)
|
|
@@ -53,10 +53,10 @@ Target-specific checklist for deploying FrontMCP to Cloudflare Workers.
|
|
|
53
53
|
|
|
54
54
|
## Examples
|
|
55
55
|
|
|
56
|
-
| Example | Level | Description
|
|
57
|
-
| ------------------------------------------------------------------------------------------------- | ------------ |
|
|
58
|
-
| [`durable-objects-state`](../examples/production-cloudflare/durable-objects-state.md) | Advanced | Shows how to use Cloudflare Durable Objects for stateful coordination alongside the stateless Workers runtime, with KV for cache and R2 for blob storage.
|
|
59
|
-
| [`workers-runtime-constraints`](../examples/production-cloudflare/workers-runtime-constraints.md) | Intermediate | Shows how to write tools that are compatible with the Cloudflare Workers runtime: no Node.js APIs, no eval, only async I/O, and using Web APIs.
|
|
60
|
-
| [`wrangler-config`](../examples/production-cloudflare/wrangler-config.md) | Basic |
|
|
56
|
+
| Example | Level | Description |
|
|
57
|
+
| ------------------------------------------------------------------------------------------------- | ------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
58
|
+
| [`durable-objects-state`](../examples/production-cloudflare/durable-objects-state.md) | Advanced | Shows how to use Cloudflare Durable Objects for stateful coordination alongside the stateless Workers runtime, with KV for cache and R2 for blob storage. |
|
|
59
|
+
| [`workers-runtime-constraints`](../examples/production-cloudflare/workers-runtime-constraints.md) | Intermediate | Shows how to write tools that are compatible with the Cloudflare Workers runtime: no Node.js APIs, no eval, only async I/O, and using Web APIs. |
|
|
60
|
+
| [`wrangler-config`](../examples/production-cloudflare/wrangler-config.md) | Basic | Checklist for verifying the `wrangler.toml` produced by `frontmcp build --target cloudflare` is production-ready. **Note:** configuration authoring lives in `frontmcp-deployment → references/deploy-to-cloudflare.md`; this file is checklist-only. |
|
|
61
61
|
|
|
62
62
|
> See all examples in [`examples/production-cloudflare/`](../examples/production-cloudflare/)
|
|
@@ -54,10 +54,10 @@ Target-specific checklist for deploying FrontMCP to AWS Lambda.
|
|
|
54
54
|
|
|
55
55
|
## Examples
|
|
56
56
|
|
|
57
|
-
| Example | Level | Description
|
|
58
|
-
| --------------------------------------------------------------------------------------------- | ------------ |
|
|
59
|
-
| [`cold-start-connection-reuse`](../examples/production-lambda/cold-start-connection-reuse.md) | Intermediate | Shows how to minimize Lambda cold starts with lazy initialization
|
|
60
|
-
| [`sam-template`](../examples/production-lambda/sam-template.md) | Basic |
|
|
61
|
-
| [`scaling-and-monitoring`](../examples/production-lambda/scaling-and-monitoring.md) | Advanced | Shows how to configure concurrency limits, dead letter queues, provisioned concurrency, and CloudWatch alarms for a production Lambda deployment.
|
|
57
|
+
| Example | Level | Description |
|
|
58
|
+
| --------------------------------------------------------------------------------------------- | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
59
|
+
| [`cold-start-connection-reuse`](../examples/production-lambda/cold-start-connection-reuse.md) | Intermediate | Shows how to minimize Lambda cold starts with lazy initialization on first call and the module-scope connection-reuse pattern for external services. |
|
|
60
|
+
| [`sam-template`](../examples/production-lambda/sam-template.md) | Basic | Checklist for verifying the SAM template pairs correctly with the bundle produced by `frontmcp build --target lambda`. **Note:** configuration authoring lives in `frontmcp-deployment → references/deploy-to-lambda.md`; this file is checklist-only. |
|
|
61
|
+
| [`scaling-and-monitoring`](../examples/production-lambda/scaling-and-monitoring.md) | Advanced | Shows how to configure concurrency limits, dead letter queues, provisioned concurrency, and CloudWatch alarms for a production Lambda deployment. |
|
|
62
62
|
|
|
63
63
|
> See all examples in [`examples/production-lambda/`](../examples/production-lambda/)
|
|
@@ -67,10 +67,10 @@ await server.dispose();
|
|
|
67
67
|
|
|
68
68
|
## Examples
|
|
69
69
|
|
|
70
|
-
| Example | Level | Description
|
|
71
|
-
| ------------------------------------------------------------------------------------- | ------------ |
|
|
72
|
-
| [`basic-sdk-lifecycle`](../examples/production-node-sdk/basic-sdk-lifecycle.md) | Basic | Shows the complete lifecycle of a FrontMCP SDK package used as an embedded client: initialization, tool invocation, and proper cleanup.
|
|
73
|
-
| [`multi-instance-cleanup`](../examples/production-node-sdk/multi-instance-cleanup.md) | Advanced | Shows how multiple SDK instances can coexist without conflicts, and how to
|
|
74
|
-
| [`package-json-config`](../examples/production-node-sdk/package-json-config.md) | Intermediate | Shows the correct package.json configuration for publishing a FrontMCP SDK package with CJS + ESM entry points, peer dependencies, and proper file inclusions.
|
|
70
|
+
| Example | Level | Description |
|
|
71
|
+
| ------------------------------------------------------------------------------------- | ------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
72
|
+
| [`basic-sdk-lifecycle`](../examples/production-node-sdk/basic-sdk-lifecycle.md) | Basic | Shows the complete lifecycle of a FrontMCP SDK package used as an embedded client: initialization, tool invocation, and proper cleanup. |
|
|
73
|
+
| [`multi-instance-cleanup`](../examples/production-node-sdk/multi-instance-cleanup.md) | Advanced | Shows how multiple SDK instances can coexist without conflicts, and how to clean up timers and listeners — given that `@Provider` classes have **no** `onInit` / `onDestroy` lifecycle hooks. The pattern is: initialize in the constructor, expose an explicit `stop()` method, and have the host app call it before `server.dispose()`. |
|
|
74
|
+
| [`package-json-config`](../examples/production-node-sdk/package-json-config.md) | Intermediate | Shows the correct package.json configuration for publishing a FrontMCP SDK package with CJS + ESM entry points, peer dependencies, and proper file inclusions. |
|
|
75
75
|
|
|
76
76
|
> See all examples in [`examples/production-node-sdk/`](../examples/production-node-sdk/)
|
|
@@ -65,7 +65,7 @@ Target-specific checklist for deploying FrontMCP as a long-running Node.js serve
|
|
|
65
65
|
| Example | Level | Description |
|
|
66
66
|
| -------------------------------------------------------------------------------------- | ------------ | --------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
67
67
|
| [`docker-multi-stage`](../examples/production-node-server/docker-multi-stage.md) | Basic | Shows a production-ready Dockerfile with multi-stage build, non-root user, and container health check for a FrontMCP Node.js server. |
|
|
68
|
-
| [`graceful-shutdown`](../examples/production-node-server/graceful-shutdown.md) | Intermediate | Shows how to
|
|
68
|
+
| [`graceful-shutdown`](../examples/production-node-server/graceful-shutdown.md) | Intermediate | Shows how to expose load-balancer drain state without overriding the FrontMCP framework's built-in SIGTERM / SIGINT graceful shutdown. |
|
|
69
69
|
| [`redis-session-scaling`](../examples/production-node-server/redis-session-scaling.md) | Advanced | Shows how to configure Redis-backed session storage, connection pooling, and stateless server design for horizontal scaling behind a load balancer. |
|
|
70
70
|
|
|
71
71
|
> See all examples in [`examples/production-node-server/`](../examples/production-node-server/)
|
|
@@ -53,10 +53,10 @@ Target-specific checklist for deploying FrontMCP to Vercel serverless or edge fu
|
|
|
53
53
|
|
|
54
54
|
## Examples
|
|
55
55
|
|
|
56
|
-
| Example | Level | Description
|
|
57
|
-
| --------------------------------------------------------------------------------------------- | ------------ |
|
|
58
|
-
| [`cold-start-optimization`](../examples/production-vercel/cold-start-optimization.md) | Intermediate | Shows how to minimize cold start time by lazy-loading dependencies, avoiding heavy initialization at module scope, and caching expensive operations.
|
|
59
|
-
| [`stateless-serverless-design`](../examples/production-vercel/stateless-serverless-design.md) | Advanced | Shows a fully stateless server design that works on Vercel edge runtime with no Node.js-only APIs, using `@frontmcp/utils` for cross-platform crypto.
|
|
60
|
-
| [`vercel-edge-config`](../examples/production-vercel/vercel-edge-config.md) | Basic |
|
|
56
|
+
| Example | Level | Description |
|
|
57
|
+
| --------------------------------------------------------------------------------------------- | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
58
|
+
| [`cold-start-optimization`](../examples/production-vercel/cold-start-optimization.md) | Intermediate | Shows how to minimize cold start time by lazy-loading dependencies on first use, avoiding heavy initialization at module scope, and caching expensive operations across warm invocations. |
|
|
59
|
+
| [`stateless-serverless-design`](../examples/production-vercel/stateless-serverless-design.md) | Advanced | Shows a fully stateless server design that works on Vercel edge runtime with no Node.js-only APIs, using `@frontmcp/utils` for cross-platform crypto. |
|
|
60
|
+
| [`vercel-edge-config`](../examples/production-vercel/vercel-edge-config.md) | Basic | Checklist for verifying the Vercel Build Output API v3 artifact and edge config produced by `frontmcp build --target vercel`. **Note:** configuration authoring lives in `frontmcp-deployment → references/deploy-to-vercel.md`; this file is checklist-only. |
|
|
61
61
|
|
|
62
62
|
> See all examples in [`examples/production-vercel/`](../examples/production-vercel/)
|