@frontmcp/skills 1.1.2 → 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
|
@@ -10,14 +10,15 @@ Every execution context (tools, resources, prompts, agents) gets a `this.telemet
|
|
|
10
10
|
|
|
11
11
|
## Available Methods
|
|
12
12
|
|
|
13
|
-
| Method
|
|
14
|
-
|
|
|
15
|
-
| `startSpan(name, attrs?)`
|
|
16
|
-
| `withSpan(name, fn, attrs?)`
|
|
17
|
-
| `addEvent(name, attrs?)`
|
|
18
|
-
| `setAttributes(attrs)`
|
|
19
|
-
| `
|
|
20
|
-
| `
|
|
13
|
+
| Method | Purpose |
|
|
14
|
+
| ----------------------------------- | --------------------------------------------------- |
|
|
15
|
+
| `startSpan(name, attrs?)` | Create a child span (you must call `.end()`) |
|
|
16
|
+
| `withSpan(name, fn, attrs?)` | Run a function in an auto-managed span |
|
|
17
|
+
| `addEvent(name, attrs?)` | Add an event to the active execution span |
|
|
18
|
+
| `setAttributes(attrs)` | Set attributes on the active execution span |
|
|
19
|
+
| `createCounter(name, description?)` | Create a counter for cumulative metrics |
|
|
20
|
+
| `traceId` | Get the current trace ID (for external correlation) |
|
|
21
|
+
| `sessionId` | Get the privacy-safe session tracing ID |
|
|
21
22
|
|
|
22
23
|
## Usage in Tools
|
|
23
24
|
|
|
@@ -138,6 +139,68 @@ otelSpan.setAttributes({ 'custom.otel.attr': 'value' });
|
|
|
138
139
|
telemetrySpan.end();
|
|
139
140
|
```
|
|
140
141
|
|
|
142
|
+
## Counters (Metrics)
|
|
143
|
+
|
|
144
|
+
Counters are cumulative, monotonically-increasing metrics. Unlike spans (which describe one request) or events (which mark a point on a span), counters aggregate across all requests and are scraped by your monitoring backend at a steady cadence. Use them for things like "how many bundles have been pulled?" or "how many signature verifications failed?".
|
|
145
|
+
|
|
146
|
+
### `createCounter(name, description?)`
|
|
147
|
+
|
|
148
|
+
```typescript
|
|
149
|
+
createCounter(name: string, description?: string): Counter
|
|
150
|
+
|
|
151
|
+
interface Counter {
|
|
152
|
+
inc(by?: number, attrs?: Record<string, string | number | boolean>): void;
|
|
153
|
+
}
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
```typescript
|
|
157
|
+
@Tool({ name: 'process_widget', inputSchema: { id: z.string() } })
|
|
158
|
+
class ProcessWidgetTool extends ToolContext {
|
|
159
|
+
async execute({ id }: { id: string }) {
|
|
160
|
+
const counter = this.telemetry.createCounter('my_app_widgets_total', 'Widgets processed');
|
|
161
|
+
try {
|
|
162
|
+
const result = await this.processWidget(id);
|
|
163
|
+
counter.inc(1, { status: 'ok' });
|
|
164
|
+
return result;
|
|
165
|
+
} catch (err) {
|
|
166
|
+
counter.inc(1, { status: 'error' });
|
|
167
|
+
throw err;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
### Built-in skill telemetry counters
|
|
174
|
+
|
|
175
|
+
When `skillsConfig.enabled: true` is set on `@FrontMcp`, the framework emits the following counters automatically:
|
|
176
|
+
|
|
177
|
+
| Counter | Attributes | Description |
|
|
178
|
+
| ----------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------- |
|
|
179
|
+
| `frontmcp_skills_bundle_pulls_total` | `status: 'ok' \| 'error'`, `source: 'static' \| 'npm' \| 'saas-pull' \| 'filesystem' \| 'unknown'`, `reason: 'pinned' \| 'invalid_bundle' \| 'listener_error' \| 'unknown'` (errors only) | Number of skill bundle pulls / hot-swaps |
|
|
180
|
+
| `frontmcp_skills_signature_verifications_total` | `status: 'ok' \| 'error'` | Number of bundle signature verifications attempted |
|
|
181
|
+
| `frontmcp_skills_signature_failures_total` | `reason: <bounded vocabulary>` | Number of signature failures, classified by reason |
|
|
182
|
+
| `frontmcp_skills_replay_checks_total` | `status: 'ok' \| 'error'` | Number of replay-protection checks |
|
|
183
|
+
| `frontmcp_skills_replay_rejects_total` | `reason: <bounded vocabulary>` | Number of replay rejections, classified by reason |
|
|
184
|
+
| `frontmcp_skills_audit_dropped_total` | `reason: <queue overflow / write failure>` | Audit log records dropped due to back-pressure or persistence errors |
|
|
185
|
+
|
|
186
|
+
The framework also emits a `skill.bundle.swap` span (with `source`, `bundle_id`, `version`, `skill_count`, `from_version` attributes) for every successful bundle swap, and adds `skill_search.query`, `skill_search.results`, and `skill_action.phase` events to the active flow span when the skill HTTP catalog is exercised.
|
|
187
|
+
|
|
188
|
+
### How counters become observable
|
|
189
|
+
|
|
190
|
+
Counters live in two places:
|
|
191
|
+
|
|
192
|
+
1. **OTel `MeterProvider`** — once you register a global `MeterProvider` (e.g., via `@opentelemetry/sdk-metrics` + an OTLP exporter), every counter the framework or your code creates is exported through the standard OTel pipeline.
|
|
193
|
+
2. **In-memory snapshot** — when no `MeterProvider` is registered, counters still increment internally and can be read with `getMetricSnapshot()` from `@frontmcp/observability` (intended for tests and local debugging only).
|
|
194
|
+
|
|
195
|
+
```typescript
|
|
196
|
+
import { getMetricSnapshot } from '@frontmcp/observability';
|
|
197
|
+
|
|
198
|
+
const snapshot = getMetricSnapshot();
|
|
199
|
+
expect(snapshot['frontmcp_skills_bundle_pulls_total']).toBeGreaterThan(0);
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
See [`vendor-integrations`](./vendor-integrations.md) for the metrics-side wiring (PeriodicExportingMetricReader + OTLP exporter).
|
|
203
|
+
|
|
141
204
|
## Examples
|
|
142
205
|
|
|
143
206
|
| Example | Level | Description |
|
|
@@ -145,6 +208,7 @@ telemetrySpan.end();
|
|
|
145
208
|
| [`tool-custom-spans`](../examples/telemetry-api/tool-custom-spans.md) | Basic | Create child spans, events, and attributes inside a tool's execute method using this.telemetry. |
|
|
146
209
|
| [`plugin-telemetry`](../examples/telemetry-api/plugin-telemetry.md) | Intermediate | Add telemetry events from a custom plugin's hooks. Events appear on the tool execution span, giving you visibility into plugin behavior within the trace. |
|
|
147
210
|
| [`agent-nested-tracing`](../examples/telemetry-api/agent-nested-tracing.md) | Advanced | Trace an agent's execution lifecycle including its nested tool calls. Every span shares the same trace ID. |
|
|
211
|
+
| [`skill-counters`](../examples/telemetry-api/skill-counters.md) | Intermediate | Read built-in skill counters from the in-memory snapshot for tests and wire an OTel MeterProvider so counters export to OTLP in production. |
|
|
148
212
|
|
|
149
213
|
> See all examples in [`examples/telemetry-api/`](../examples/telemetry-api/)
|
|
150
214
|
|
|
@@ -12,12 +12,12 @@ Verify that your tools create the right spans, log entries include trace context
|
|
|
12
12
|
|
|
13
13
|
```typescript
|
|
14
14
|
import {
|
|
15
|
-
createTestTracer,
|
|
16
|
-
getFinishedSpans,
|
|
17
|
-
assertSpanExists,
|
|
18
15
|
assertSpanAttribute,
|
|
16
|
+
assertSpanExists,
|
|
17
|
+
createTestTracer,
|
|
19
18
|
findSpan,
|
|
20
19
|
findSpansByAttribute,
|
|
20
|
+
getFinishedSpans,
|
|
21
21
|
} from '@frontmcp/observability';
|
|
22
22
|
```
|
|
23
23
|
|
|
@@ -53,8 +53,7 @@ describe('AnalyzeDataTool', () => {
|
|
|
53
53
|
Use a `CallbackSink` to capture structured log entries:
|
|
54
54
|
|
|
55
55
|
```typescript
|
|
56
|
-
import { StructuredLogTransport,
|
|
57
|
-
import type { StructuredLogEntry } from '@frontmcp/observability';
|
|
56
|
+
import { CallbackSink, StructuredLogTransport, type StructuredLogEntry } from '@frontmcp/observability';
|
|
58
57
|
|
|
59
58
|
describe('Structured logging', () => {
|
|
60
59
|
it('should include trace_id in log entries', () => {
|
|
@@ -85,56 +84,41 @@ describe('Structured logging', () => {
|
|
|
85
84
|
});
|
|
86
85
|
```
|
|
87
86
|
|
|
88
|
-
## Testing Auto-Instrumentation
|
|
87
|
+
## Testing Auto-Instrumentation End-to-End
|
|
89
88
|
|
|
90
|
-
|
|
89
|
+
The plugin's hook functions are not part of the public API surface — only top-level helpers from `@frontmcp/observability` are. To verify auto-instrumentation, drive a real tool through the SDK with an isolated tracer and assert spans on the exporter:
|
|
91
90
|
|
|
92
91
|
```typescript
|
|
93
|
-
import {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
const exporter =
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
set: () => {},
|
|
119
|
-
get: () => undefined,
|
|
120
|
-
delete: () => {},
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
},
|
|
124
|
-
};
|
|
125
|
-
|
|
126
|
-
const opts = { executionSpans: true, flowStageEvents: true };
|
|
127
|
-
onToolWillParse(opts, flowCtx);
|
|
128
|
-
onToolWillExecute(opts, flowCtx);
|
|
129
|
-
onToolDidExecute(opts, flowCtx);
|
|
130
|
-
onToolDidFinalize(flowCtx);
|
|
131
|
-
|
|
132
|
-
const spans = exporter.getFinishedSpans();
|
|
133
|
-
expect(spans.find((s) => s.name === 'tools/call')).toBeTruthy();
|
|
134
|
-
expect(spans.find((s) => s.name === 'tool my_tool')).toBeTruthy();
|
|
92
|
+
import { trace } from '@opentelemetry/api';
|
|
93
|
+
|
|
94
|
+
import { createTestTracer, findSpan, getFinishedSpans } from '@frontmcp/observability';
|
|
95
|
+
|
|
96
|
+
// ...your test harness for invoking a FrontMCP tool, e.g. via the SDK's
|
|
97
|
+
// in-process server or your transport adapter under test.
|
|
98
|
+
|
|
99
|
+
it('should create RPC + tool spans for a tool call', async () => {
|
|
100
|
+
const { tracer, exporter, cleanup } = createTestTracer();
|
|
101
|
+
// Register the tracer for the duration of the test so the plugin's hooks
|
|
102
|
+
// see a TracerProvider (without it, all OTel calls are no-ops).
|
|
103
|
+
trace.setGlobalTracerProvider(tracer);
|
|
104
|
+
|
|
105
|
+
try {
|
|
106
|
+
// Drive a real tool call through your server / harness.
|
|
107
|
+
await invokeTool('my_tool', {
|
|
108
|
+
/* args */
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
const spans = getFinishedSpans(exporter);
|
|
112
|
+
expect(findSpan(spans, 'tools/call')).toBeTruthy();
|
|
113
|
+
expect(findSpan(spans, 'tool my_tool')).toBeTruthy();
|
|
114
|
+
} finally {
|
|
115
|
+
cleanup();
|
|
116
|
+
}
|
|
135
117
|
});
|
|
136
118
|
```
|
|
137
119
|
|
|
120
|
+
Use `createTestTracer()` (top-level import from `@frontmcp/observability`) — never reach into internal hook subpaths, which are not part of the package's `exports` map.
|
|
121
|
+
|
|
138
122
|
## Test Isolation
|
|
139
123
|
|
|
140
124
|
Each test should:
|
|
@@ -6,12 +6,12 @@ tags: [tracing, opentelemetry, spans, setup]
|
|
|
6
6
|
|
|
7
7
|
# Tracing Setup
|
|
8
8
|
|
|
9
|
-
Enable automatic distributed tracing for every flow in your FrontMCP server. When enabled,
|
|
9
|
+
Enable automatic distributed tracing for every flow in your FrontMCP server. When enabled, hooks across all SDK flows produce spans (and stage events on those spans) for tool calls, resource reads, HTTP requests, auth flows, transport sessions, and more — with zero code changes.
|
|
10
10
|
|
|
11
11
|
## How It Works
|
|
12
12
|
|
|
13
13
|
1. Set `observability: true` in `@FrontMcp` config
|
|
14
|
-
2. The SDK auto-loads `@frontmcp/observability` and registers hooks on all
|
|
14
|
+
2. The SDK auto-loads `@frontmcp/observability` and registers hooks on all SDK flows
|
|
15
15
|
3. Every request gets a single W3C trace ID, shared across all spans
|
|
16
16
|
4. Without a TracerProvider, all OTel calls are no-ops (zero overhead)
|
|
17
17
|
|
|
@@ -56,8 +56,8 @@ node server.js
|
|
|
56
56
|
### Option C: Your own OTel SDK
|
|
57
57
|
|
|
58
58
|
```typescript
|
|
59
|
-
import { NodeSDK } from '@opentelemetry/sdk-node';
|
|
60
59
|
import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-http';
|
|
60
|
+
import { NodeSDK } from '@opentelemetry/sdk-node';
|
|
61
61
|
|
|
62
62
|
const sdk = new NodeSDK({
|
|
63
63
|
traceExporter: new OTLPTraceExporter({ url: 'http://localhost:4318/v1/traces' }),
|
|
@@ -102,17 +102,24 @@ observability: {
|
|
|
102
102
|
httpSpans: true, // HTTP request spans
|
|
103
103
|
executionSpans: true, // Tool/resource/prompt/agent spans
|
|
104
104
|
fetchSpans: true, // Outbound ctx.fetch() spans
|
|
105
|
-
flowStageEvents: true, //
|
|
105
|
+
flowStageEvents: true, // Add stage events (e.g. stage.execute.start) on the parent span
|
|
106
106
|
transportSpans: true, // SSE/HTTP transport spans
|
|
107
107
|
authSpans: true, // Auth/session verify spans
|
|
108
108
|
oauthSpans: true, // OAuth flow spans
|
|
109
109
|
elicitationSpans: true, // Elicitation spans
|
|
110
|
-
hookSpans: false, //
|
|
110
|
+
hookSpans: false, // Emit a NEW child span per hook (verbose; default off)
|
|
111
111
|
startupReport: true, // Emit startup span on first request
|
|
112
112
|
},
|
|
113
113
|
}
|
|
114
114
|
```
|
|
115
115
|
|
|
116
|
+
### `flowStageEvents` vs `hookSpans` — what's the difference?
|
|
117
|
+
|
|
118
|
+
- `flowStageEvents: true` (default) — the plugin's hooks attach **events** (`addEvent('stage.execute.start')`, etc.) onto the existing parent span (e.g. the tool span). One span per request stage; many events per span. Cheap, easy to read.
|
|
119
|
+
- `hookSpans: true` (default off) — the plugin emits a **separate child span** for each hook invocation. Produces a much deeper, noisier trace and is intended for low-level debugging of the SDK pipeline itself. Most users should leave this off.
|
|
120
|
+
|
|
121
|
+
In other words: events live inside an existing span; hook spans add their own spans to the tree.
|
|
122
|
+
|
|
116
123
|
## Local Development
|
|
117
124
|
|
|
118
125
|
### otel-desktop-viewer
|
|
@@ -45,7 +45,7 @@ observability: {
|
|
|
45
45
|
}
|
|
46
46
|
```
|
|
47
47
|
|
|
48
|
-
For traces, configure `setupOTel()` with the same endpoint:
|
|
48
|
+
For traces, configure `setupOTel()` with the same endpoint. `setupOTel()` does **not** accept `headers` directly — pass auth via the standard `OTEL_EXPORTER_OTLP_HEADERS` environment variable, which the underlying OTLP trace exporter reads automatically:
|
|
49
49
|
|
|
50
50
|
```typescript
|
|
51
51
|
import { setupOTel } from '@frontmcp/observability';
|
|
@@ -57,6 +57,13 @@ setupOTel({
|
|
|
57
57
|
});
|
|
58
58
|
```
|
|
59
59
|
|
|
60
|
+
```bash
|
|
61
|
+
# Auth is supplied via env var, not setupOTel options
|
|
62
|
+
export OTEL_EXPORTER_OTLP_HEADERS="Authorization=Bearer ${CX_PRIVATE_KEY}"
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
> The OTLP **logging** sink (`{ type: 'otlp', headers: { ... } }`) does accept `headers` directly — only `setupOTel()` for traces relies on env vars.
|
|
66
|
+
|
|
60
67
|
### Datadog
|
|
61
68
|
|
|
62
69
|
```typescript
|
|
@@ -140,6 +147,44 @@ observability: {
|
|
|
140
147
|
|
|
141
148
|
Structured log entries (with `trace_id`) are forwarded to your logger, which sends them to wherever it's configured.
|
|
142
149
|
|
|
150
|
+
## Exporting Metrics (Counters)
|
|
151
|
+
|
|
152
|
+
Counters created by `this.telemetry.createCounter(...)` and the built-in framework counters (`frontmcp_skills_bundle_pulls_total`, `frontmcp_skills_signature_failures_total`, `frontmcp_skills_replay_rejects_total`, etc.) become observable once you register a global OTel `MeterProvider`. Mirror your trace setup with `@opentelemetry/sdk-metrics` and an OTLP metric exporter:
|
|
153
|
+
|
|
154
|
+
```typescript
|
|
155
|
+
import { metrics } from '@opentelemetry/api';
|
|
156
|
+
import { OTLPMetricExporter } from '@opentelemetry/exporter-metrics-otlp-http';
|
|
157
|
+
import { Resource } from '@opentelemetry/resources';
|
|
158
|
+
import { MeterProvider, PeriodicExportingMetricReader } from '@opentelemetry/sdk-metrics';
|
|
159
|
+
|
|
160
|
+
const meterProvider = new MeterProvider({
|
|
161
|
+
resource: new Resource({ 'service.name': 'my-mcp-server' }),
|
|
162
|
+
readers: [
|
|
163
|
+
new PeriodicExportingMetricReader({
|
|
164
|
+
exporter: new OTLPMetricExporter({
|
|
165
|
+
url: process.env.OTEL_EXPORTER_OTLP_ENDPOINT ?? 'http://localhost:4318/v1/metrics',
|
|
166
|
+
}),
|
|
167
|
+
exportIntervalMillis: 10_000,
|
|
168
|
+
}),
|
|
169
|
+
],
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
metrics.setGlobalMeterProvider(meterProvider);
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
Use the same OTLP gateway family as for traces, but note that vendor-specific
|
|
176
|
+
metrics paths, ports, and auth methods can differ from the trace endpoint
|
|
177
|
+
(the table below lists the per-vendor exceptions):
|
|
178
|
+
|
|
179
|
+
| Vendor | Metrics endpoint hint |
|
|
180
|
+
| ------------- | ------------------------------------------------------------------------------- |
|
|
181
|
+
| Coralogix | `https://ingress.coralogix.com:443` — auth via `OTEL_EXPORTER_OTLP_HEADERS` |
|
|
182
|
+
| Datadog | Use the Datadog OTLP intake (`/api/v2/otlp/v1/metrics`) with `DD-API-KEY` |
|
|
183
|
+
| Grafana Cloud | `https://otlp-gateway-<region>.grafana.net/otlp/v1/metrics` (Basic auth) |
|
|
184
|
+
| Logz.io | Use the dedicated Metrics token endpoint (`https://otlp-listener.logz.io:8053`) |
|
|
185
|
+
|
|
186
|
+
Without a registered `MeterProvider`, counters still increment in an in-memory snapshot (readable via `getMetricSnapshot()` from `@frontmcp/observability`) but are **not** exported. Use the snapshot for tests and local debugging only.
|
|
187
|
+
|
|
143
188
|
## OTLP Sink Options
|
|
144
189
|
|
|
145
190
|
| Option | Type | Default | Description |
|
|
@@ -37,7 +37,15 @@ Router for production readiness checklists. Start with the common checklist (sec
|
|
|
37
37
|
|
|
38
38
|
> **Decision:** Use this skill when preparing for production. Start with `common-checklist`, then pick your deployment target.
|
|
39
39
|
|
|
40
|
-
##
|
|
40
|
+
## Prerequisites
|
|
41
|
+
|
|
42
|
+
- A deployable FrontMCP project (build target chosen, see `frontmcp-deployment`).
|
|
43
|
+
- Observability and structured logging available (see `frontmcp-observability`) — production hardening assumes you can see what the server is doing.
|
|
44
|
+
- A staging environment matching production target (Node, Vercel, Lambda, Cloudflare, CLI, browser) to validate the checklist before go-live.
|
|
45
|
+
|
|
46
|
+
## Steps
|
|
47
|
+
|
|
48
|
+
### Step 1: Detect Deployment Target
|
|
41
49
|
|
|
42
50
|
Check the project to determine the deployment target:
|
|
43
51
|
|
|
@@ -46,11 +54,11 @@ Check the project to determine the deployment target:
|
|
|
46
54
|
3. Check if the build target is `cli` or `browser` in the build config
|
|
47
55
|
4. If unclear, ask the user which environment they're deploying to
|
|
48
56
|
|
|
49
|
-
|
|
57
|
+
### Step 2: Run Common Checklist
|
|
50
58
|
|
|
51
59
|
Always start with the common checklist — it covers security, performance, reliability, and observability that apply to every target.
|
|
52
60
|
|
|
53
|
-
|
|
61
|
+
### Step 3: Run Target-Specific Checklist
|
|
54
62
|
|
|
55
63
|
After the common checklist, run the checklist for your deployment target.
|
|
56
64
|
|
|
@@ -82,6 +90,27 @@ After the common checklist, run the checklist for your deployment target.
|
|
|
82
90
|
| `build --target cli` + `bin` in package.json | CLI binary → `production-cli-binary.md` |
|
|
83
91
|
| `build --target browser` in scripts | Browser → `production-browser.md` |
|
|
84
92
|
|
|
93
|
+
## Common Patterns
|
|
94
|
+
|
|
95
|
+
| Pattern | Correct | Incorrect | Why |
|
|
96
|
+
| ------------------ | --------------------------------------------------------- | ------------------------------------------------- | -------------------------------------------------------------------------------- |
|
|
97
|
+
| Checklist order | Common checklist first, target-specific second | Skip straight to vendor checklist | Common items (auth, rate limits, observability) gate all targets |
|
|
98
|
+
| Storage | Redis / Vercel KV in production | In-memory session/elicitation stores | Memory stores reset on every cold start and don't span replicas |
|
|
99
|
+
| Health checks | `/healthz` (liveness) + `/readyz` (readiness) endpoints | Single `/health` endpoint that always returns 200 | Kubernetes/load balancers need separate liveness vs readiness signals |
|
|
100
|
+
| Secret loading | Read from env vars (`process.env.X`) | Hardcode tokens / paste into config | Hardcoded secrets leak via the build artefact and source control |
|
|
101
|
+
| Build verification | Run `frontmcp doctor` + smoke test against built artefact | Trust local `dev` mode behaviour | Production targets (Vercel, Lambda, Cloudflare, browser) have different runtimes |
|
|
102
|
+
|
|
103
|
+
## Troubleshooting
|
|
104
|
+
|
|
105
|
+
| Problem | Cause | Solution |
|
|
106
|
+
| --------------------------------------------- | ------------------------------------------------ | ----------------------------------------------------------------------------------------------------- |
|
|
107
|
+
| Sessions disappear after a deploy | Memory session store on a stateless platform | Switch to Redis / Vercel KV; see `setup-redis` and `configure-session` |
|
|
108
|
+
| Liveness probe passes while requests fail | `/healthz` doesn't exercise the request path | Add `/readyz` that checks dependencies (DB, Redis, downstream APIs); see `health-readiness-endpoints` |
|
|
109
|
+
| Cold-start latency above SLA | Heavy provider construction at request time | Construct shared clients in module scope or `onInit`; see `production-vercel` / `production-lambda` |
|
|
110
|
+
| Rate-limit exceeded under normal load | Global throttle too tight, no per-tool overrides | Tune `throttle.requestsPerSecond`; add per-tool overrides; see `configure-throttle` |
|
|
111
|
+
| `frontmcp doctor` flags missing observability | Observability disabled or not wired | Set `observability: true` in `@FrontMcp` and configure a sink; see `frontmcp-observability` |
|
|
112
|
+
| Browser build exceeds bundle budget | Server-only deps imported into the browser entry | Split entries; gate Node-only imports behind `availableWhen.platform`; see `production-browser` |
|
|
113
|
+
|
|
85
114
|
## Verification Checklist
|
|
86
115
|
|
|
87
116
|
After completing both common and target-specific checklists:
|
|
@@ -93,6 +122,108 @@ After completing both common and target-specific checklists:
|
|
|
93
122
|
5. Review logs for any warnings or errors during startup
|
|
94
123
|
6. Update README for the deployment target (see `frontmcp-setup` → `references/readme-guide.md`)
|
|
95
124
|
|
|
125
|
+
## Examples
|
|
126
|
+
|
|
127
|
+
Each reference has matching examples under [`examples/<reference>/`](./examples/):
|
|
128
|
+
|
|
129
|
+
### `common-checklist`
|
|
130
|
+
|
|
131
|
+
| Example | Level | Description |
|
|
132
|
+
| ----------------------------------------------------------------------------------- | ------------ | -------------------------------------------------------------------------------------------------------------------------- |
|
|
133
|
+
| [`caching-and-performance`](./examples/common-checklist/caching-and-performance.md) | Advanced | Shows how to configure caching with TTL, optimize responses, and manage memory with proper provider lifecycle cleanup. |
|
|
134
|
+
| [`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. |
|
|
135
|
+
| [`security-hardening`](./examples/common-checklist/security-hardening.md) | Basic | Shows how to configure authentication, CORS, input validation, and rate limiting for a production FrontMCP server. |
|
|
136
|
+
|
|
137
|
+
### `production-browser`
|
|
138
|
+
|
|
139
|
+
| Example | Level | Description |
|
|
140
|
+
| --------------------------------------------------------------------------------------- | ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
141
|
+
| [`browser-bundle-config`](./examples/production-browser/browser-bundle-config.md) | Basic | Shows how to configure package.json for browser-compatible SDK distribution with ESM/CJS/UMD entry points, TypeScript declarations, and CDN support. |
|
|
142
|
+
| [`cross-platform-crypto`](./examples/production-browser/cross-platform-crypto.md) | Intermediate | Shows how to use `@frontmcp/utils` for cross-platform crypto operations that work in both browser and Node.js, and how to avoid Node.js-only APIs. |
|
|
143
|
+
| [`security-and-performance`](./examples/production-browser/security-and-performance.md) | Advanced | Shows how to ensure no secrets are bundled in browser code, configure CSP headers on the server, optimize bundle size, and avoid blocking the main thread. |
|
|
144
|
+
|
|
145
|
+
### `production-cli-binary`
|
|
146
|
+
|
|
147
|
+
| Example | Level | Description |
|
|
148
|
+
| ------------------------------------------------------------------------------------------------------ | ------------ | -------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
149
|
+
| [`binary-build-config`](./examples/production-cli-binary/binary-build-config.md) | Basic | Shows how to configure a FrontMCP CLI binary with correct package.json `bin` field, shebang, stdio transport, and npm distribution settings. |
|
|
150
|
+
| [`stdio-transport-error-handling`](./examples/production-cli-binary/stdio-transport-error-handling.md) | Intermediate | Shows how to handle stdin/stdout transport correctly, implement proper exit codes, and handle edge cases like EOF and broken pipes. |
|
|
151
|
+
|
|
152
|
+
### `production-cli-daemon`
|
|
153
|
+
|
|
154
|
+
| Example | Level | Description |
|
|
155
|
+
| -------------------------------------------------------------------------------------------- | ------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
156
|
+
| [`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. |
|
|
157
|
+
| [`graceful-shutdown-cleanup`](./examples/production-cli-daemon/graceful-shutdown-cleanup.md) | Intermediate | Shows how to implement graceful shutdown for a daemon process, including completing in-flight requests, closing database connections, removing the socket file, and cleaning up the PID file. |
|
|
158
|
+
| [`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. |
|
|
159
|
+
|
|
160
|
+
### `production-cloudflare`
|
|
161
|
+
|
|
162
|
+
| Example | Level | Description |
|
|
163
|
+
| ------------------------------------------------------------------------------------------------ | ------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
164
|
+
| [`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. |
|
|
165
|
+
| [`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. |
|
|
166
|
+
| [`wrangler-config`](./examples/production-cloudflare/wrangler-config.md) | Basic | Shows how to configure `wrangler.toml` with correct routes, KV bindings for session storage, and secret management for a FrontMCP Cloudflare Worker. |
|
|
167
|
+
|
|
168
|
+
### `production-lambda`
|
|
169
|
+
|
|
170
|
+
| Example | Level | Description |
|
|
171
|
+
| -------------------------------------------------------------------------------------------- | ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
172
|
+
| [`cold-start-connection-reuse`](./examples/production-lambda/cold-start-connection-reuse.md) | Intermediate | Shows how to minimize Lambda cold starts with lazy initialization, tree-shaking, and the connection reuse pattern for external services. |
|
|
173
|
+
| [`sam-template`](./examples/production-lambda/sam-template.md) | Basic | Shows a complete SAM/CloudFormation template for deploying a FrontMCP server to AWS Lambda with API Gateway routing, DynamoDB for session storage, and proper environment configuration. |
|
|
174
|
+
| [`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. |
|
|
175
|
+
|
|
176
|
+
### `production-node-sdk`
|
|
177
|
+
|
|
178
|
+
| Example | Level | Description |
|
|
179
|
+
| ------------------------------------------------------------------------------------ | ------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
180
|
+
| [`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. |
|
|
181
|
+
| [`multi-instance-cleanup`](./examples/production-node-sdk/multi-instance-cleanup.md) | Advanced | Shows how multiple SDK instances can coexist without conflicts, and how to implement proper cleanup to prevent memory leaks from event listeners, timers, and provider resources. |
|
|
182
|
+
| [`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. |
|
|
183
|
+
|
|
184
|
+
### `production-node-server`
|
|
185
|
+
|
|
186
|
+
| Example | Level | Description |
|
|
187
|
+
| ------------------------------------------------------------------------------------- | ------------ | --------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
188
|
+
| [`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. |
|
|
189
|
+
| [`graceful-shutdown`](./examples/production-node-server/graceful-shutdown.md) | Intermediate | Shows how to implement graceful shutdown with SIGTERM handling, in-flight request draining, and health check status transitions. |
|
|
190
|
+
| [`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. |
|
|
191
|
+
|
|
192
|
+
### `production-vercel`
|
|
193
|
+
|
|
194
|
+
| Example | Level | Description |
|
|
195
|
+
| -------------------------------------------------------------------------------------------- | ------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
196
|
+
| [`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. |
|
|
197
|
+
| [`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. |
|
|
198
|
+
| [`vercel-edge-config`](./examples/production-vercel/vercel-edge-config.md) | Basic | Shows how to configure a FrontMCP server for Vercel deployment with Vercel KV for session storage and correct route configuration. |
|
|
199
|
+
|
|
200
|
+
### `health-readiness-endpoints`
|
|
201
|
+
|
|
202
|
+
| Example | Level | Description |
|
|
203
|
+
| ----------------------------------------------------------------------------------- | ------------ | ------------------------------------------------------------------------------------------ |
|
|
204
|
+
| [`basic-health-setup`](./examples/health-readiness-endpoints/basic-health-setup.md) | Basic | Default health endpoints with Redis session store, showing /healthz and /readyz responses. |
|
|
205
|
+
| [`custom-probes`](./examples/health-readiness-endpoints/custom-probes.md) | Intermediate | Custom database and API probes with Kubernetes deployment configuration. |
|
|
206
|
+
|
|
207
|
+
### `distributed-ha`
|
|
208
|
+
|
|
209
|
+
| Example | Level | Description |
|
|
210
|
+
| ----------------------------------------------------------------------------------- | ------------ | ------------------------------------------------------------------------------------ |
|
|
211
|
+
| [`ha-kubernetes-3-replicas`](./examples/distributed-ha/ha-kubernetes-3-replicas.md) | Intermediate | Deploy FrontMCP with 3 replicas, Redis, and automatic session failover on Kubernetes |
|
|
212
|
+
|
|
213
|
+
## Accessing This Skill
|
|
214
|
+
|
|
215
|
+
Skills are distributed as plain SKILL.md files plus a sibling `references/`
|
|
216
|
+
and `examples/` tree, so consumers can pick whichever access mode fits:
|
|
217
|
+
|
|
218
|
+
| Mode | How it works |
|
|
219
|
+
| ------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
220
|
+
| **Filesystem** | Read `libs/skills/catalog/frontmcp-production-readiness/` directly from a clone of the catalog repo, or from a published `@frontmcp/skills` install. SKILL.md is the entry point. |
|
|
221
|
+
| **`frontmcp` CLI** | `frontmcp skills list`, `frontmcp skills read frontmcp-production-readiness`, `frontmcp skills read frontmcp-production-readiness:references/<file>.md`, `frontmcp skills install frontmcp-production-readiness` — no server required. |
|
|
222
|
+
| **MCP `skill://`** | When a developer mounts this skill into their own FrontMCP server (`@FrontMcp({ skills: [...] })`), the SDK exposes it via SEP-2640 resources: `skill://frontmcp-production-readiness/SKILL.md`, `skill://frontmcp-production-readiness/references/{file}.md`, etc. The server’s `skill://index.json` returns the SEP-2640 discovery document for everything mounted on it. |
|
|
223
|
+
|
|
224
|
+
The catalog itself is **not** an MCP server. The `skill://` URIs only resolve
|
|
225
|
+
when a server has been configured to host this skill.
|
|
226
|
+
|
|
96
227
|
## Reference
|
|
97
228
|
|
|
98
229
|
- [Production Build](https://docs.agentfront.dev/frontmcp/deployment/production-build)
|