@frontmcp/skills 1.0.3 → 1.1.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (141) hide show
  1. package/catalog/frontmcp-authorities/SKILL.md +272 -0
  2. package/catalog/frontmcp-authorities/references/authority-profiles.md +262 -0
  3. package/catalog/frontmcp-authorities/references/claims-mapping.md +266 -0
  4. package/catalog/frontmcp-authorities/references/custom-evaluators.md +420 -0
  5. package/catalog/frontmcp-authorities/references/rbac-abac-rebac.md +391 -0
  6. package/catalog/frontmcp-channels/SKILL.md +122 -0
  7. package/catalog/frontmcp-channels/examples/channel-sources/agent-notify.md +70 -0
  8. package/catalog/frontmcp-channels/examples/channel-sources/app-errors.md +71 -0
  9. package/catalog/frontmcp-channels/examples/channel-sources/file-watcher.md +102 -0
  10. package/catalog/frontmcp-channels/examples/channel-sources/job-completion.md +79 -0
  11. package/catalog/frontmcp-channels/examples/channel-sources/replay-buffer.md +106 -0
  12. package/catalog/frontmcp-channels/examples/channel-sources/service-connector.md +136 -0
  13. package/catalog/frontmcp-channels/examples/channel-sources/webhook-github.md +85 -0
  14. package/catalog/frontmcp-channels/examples/channel-two-way/whatsapp-bridge.md +133 -0
  15. package/catalog/frontmcp-channels/references/channel-sources.md +214 -0
  16. package/catalog/frontmcp-channels/references/channel-two-way.md +195 -0
  17. package/catalog/frontmcp-config/SKILL.md +20 -18
  18. package/catalog/frontmcp-config/examples/configure-auth/multi-app-auth.md +1 -2
  19. package/catalog/frontmcp-config/examples/configure-auth/public-mode-setup.md +1 -2
  20. package/catalog/frontmcp-config/examples/configure-auth/remote-oauth-with-vault.md +1 -2
  21. package/catalog/frontmcp-config/examples/configure-auth-modes/local-self-signed-tokens.md +1 -2
  22. package/catalog/frontmcp-config/examples/configure-auth-modes/remote-enterprise-oauth.md +1 -2
  23. package/catalog/frontmcp-config/examples/configure-auth-modes/transparent-jwt-validation.md +1 -2
  24. package/catalog/frontmcp-config/examples/configure-deployment-targets/distributed-ha-config.md +121 -0
  25. package/catalog/frontmcp-config/examples/configure-deployment-targets/json-schema-ide-support.md +64 -0
  26. package/catalog/frontmcp-config/examples/configure-deployment-targets/multi-target-with-security.md +113 -0
  27. package/catalog/frontmcp-config/examples/configure-elicitation/basic-confirmation-gate.md +1 -2
  28. package/catalog/frontmcp-config/examples/configure-elicitation/distributed-elicitation-redis.md +1 -2
  29. package/catalog/frontmcp-config/examples/configure-http/entry-path-reverse-proxy.md +1 -2
  30. package/catalog/frontmcp-config/examples/configure-http/unix-socket-local.md +1 -2
  31. package/catalog/frontmcp-config/examples/configure-security-headers/csp-report-only.md +69 -0
  32. package/catalog/frontmcp-config/examples/configure-security-headers/full-production-headers.md +91 -0
  33. package/catalog/frontmcp-config/examples/configure-throttle/distributed-redis-throttle.md +1 -2
  34. package/catalog/frontmcp-config/examples/configure-throttle/per-tool-rate-limit.md +1 -2
  35. package/catalog/frontmcp-config/examples/configure-throttle/server-level-rate-limit.md +1 -2
  36. package/catalog/frontmcp-config/examples/configure-transport/custom-protocol-flags.md +1 -2
  37. package/catalog/frontmcp-config/examples/configure-transport/distributed-sessions-redis.md +1 -2
  38. package/catalog/frontmcp-config/examples/configure-transport/stateless-serverless.md +1 -2
  39. package/catalog/frontmcp-config/examples/configure-transport-protocol-presets/legacy-preset-nodejs.md +1 -2
  40. package/catalog/frontmcp-config/examples/configure-transport-protocol-presets/stateless-api-serverless.md +1 -2
  41. package/catalog/frontmcp-config/references/configure-deployment-targets.md +214 -0
  42. package/catalog/frontmcp-config/references/configure-elicitation.md +1 -2
  43. package/catalog/frontmcp-config/references/configure-security-headers.md +198 -0
  44. package/catalog/frontmcp-deployment/SKILL.md +1 -0
  45. package/catalog/frontmcp-deployment/examples/build-for-cli/cli-binary-build.md +1 -2
  46. package/catalog/frontmcp-deployment/examples/build-for-cli/unix-socket-daemon.md +1 -2
  47. package/catalog/frontmcp-deployment/examples/build-for-mcpb/mcpb-bundle-build.md +117 -0
  48. package/catalog/frontmcp-deployment/examples/build-for-sdk/connect-openai.md +1 -3
  49. package/catalog/frontmcp-deployment/examples/build-for-sdk/create-flat-config.md +1 -2
  50. package/catalog/frontmcp-deployment/examples/build-for-sdk/multi-platform-connect.md +3 -3
  51. package/catalog/frontmcp-deployment/examples/deploy-to-cloudflare/basic-worker-deploy.md +1 -2
  52. package/catalog/frontmcp-deployment/examples/deploy-to-cloudflare/worker-custom-domain.md +1 -2
  53. package/catalog/frontmcp-deployment/examples/deploy-to-cloudflare/worker-with-kv-storage.md +1 -2
  54. package/catalog/frontmcp-deployment/examples/deploy-to-lambda/lambda-handler-with-cors.md +1 -2
  55. package/catalog/frontmcp-deployment/examples/deploy-to-vercel/vercel-with-kv.md +1 -2
  56. package/catalog/frontmcp-deployment/examples/mcp-client-integration/http-remote.md +106 -0
  57. package/catalog/frontmcp-deployment/examples/mcp-client-integration/stdio-binary-with-env.md +107 -0
  58. package/catalog/frontmcp-deployment/examples/mcp-client-integration/stdio-npx.md +89 -0
  59. package/catalog/frontmcp-deployment/references/build-for-mcpb.md +209 -0
  60. package/catalog/frontmcp-deployment/references/build-for-sdk.md +1 -2
  61. package/catalog/frontmcp-deployment/references/mcp-client-integration.md +225 -0
  62. package/catalog/frontmcp-development/SKILL.md +4 -3
  63. package/catalog/frontmcp-development/examples/create-agent/basic-agent-with-tools.md +3 -6
  64. package/catalog/frontmcp-development/examples/create-agent/custom-multi-pass-agent.md +1 -2
  65. package/catalog/frontmcp-development/examples/create-agent/nested-agents-with-swarm.md +2 -4
  66. package/catalog/frontmcp-development/examples/create-agent-llm-config/anthropic-config.md +1 -2
  67. package/catalog/frontmcp-development/examples/create-agent-llm-config/openai-config.md +1 -2
  68. package/catalog/frontmcp-development/examples/create-job/basic-report-job.md +1 -2
  69. package/catalog/frontmcp-development/examples/create-job/job-with-permissions.md +2 -3
  70. package/catalog/frontmcp-development/examples/create-job/job-with-retry.md +1 -2
  71. package/catalog/frontmcp-development/examples/create-plugin-hooks/tool-level-hooks-and-stage-replacement.md +2 -5
  72. package/catalog/frontmcp-development/examples/create-provider/basic-database-provider.md +4 -3
  73. package/catalog/frontmcp-development/examples/create-skill-with-tools/directory-skill-with-tools.md +2 -3
  74. package/catalog/frontmcp-development/examples/create-tool/basic-class-tool.md +1 -2
  75. package/catalog/frontmcp-development/examples/create-tool/tool-with-di-and-errors.md +2 -2
  76. package/catalog/frontmcp-development/examples/create-tool/tool-with-rate-limiting-and-progress.md +1 -2
  77. package/catalog/frontmcp-development/examples/create-tool-annotations/destructive-delete-tool.md +2 -4
  78. package/catalog/frontmcp-development/examples/create-tool-annotations/readonly-query-tool.md +1 -2
  79. package/catalog/frontmcp-development/examples/create-tool-output-schema-types/primitive-and-media-outputs.md +3 -6
  80. package/catalog/frontmcp-development/examples/create-tool-output-schema-types/zod-raw-shape-output.md +1 -2
  81. package/catalog/frontmcp-development/examples/create-tool-output-schema-types/zod-schema-advanced-output.md +2 -4
  82. package/catalog/frontmcp-development/examples/decorators-guide/agent-skill-job-workflow.md +3 -5
  83. package/catalog/frontmcp-development/examples/decorators-guide/basic-server-with-app-and-tools.md +5 -5
  84. package/catalog/frontmcp-development/examples/decorators-guide/multi-app-with-plugins-and-providers.md +4 -6
  85. package/catalog/frontmcp-development/examples/official-plugins/cache-and-feature-flags.md +3 -5
  86. package/catalog/frontmcp-development/examples/official-plugins/production-multi-plugin-setup.md +4 -5
  87. package/catalog/frontmcp-development/examples/official-plugins/remember-plugin-session-memory.md +3 -5
  88. package/catalog/frontmcp-development/examples/{official-adapters → openapi-adapter}/authenticated-adapter-with-polling.md +2 -2
  89. package/catalog/frontmcp-development/examples/{official-adapters → openapi-adapter}/basic-openapi-adapter.md +2 -2
  90. package/catalog/frontmcp-development/examples/openapi-adapter/format-resolution-and-custom-resolvers.md +108 -0
  91. package/catalog/frontmcp-development/examples/{official-adapters → openapi-adapter}/multi-api-hub-with-inline-spec.md +2 -2
  92. package/catalog/frontmcp-development/examples/openapi-adapter/ref-security-and-filtering.md +111 -0
  93. package/catalog/frontmcp-development/references/create-agent.md +4 -7
  94. package/catalog/frontmcp-development/references/create-job.md +3 -6
  95. package/catalog/frontmcp-development/references/create-plugin-hooks.md +12 -16
  96. package/catalog/frontmcp-development/references/create-skill-with-tools.md +2 -3
  97. package/catalog/frontmcp-development/references/create-tool.md +93 -23
  98. package/catalog/frontmcp-development/references/create-workflow.md +2 -3
  99. package/catalog/frontmcp-development/references/decorators-guide.md +32 -36
  100. package/catalog/frontmcp-development/references/official-adapters.md +24 -153
  101. package/catalog/frontmcp-development/references/openapi-adapter.md +431 -0
  102. package/catalog/frontmcp-extensibility/examples/vectoriadb/product-catalog-search.md +4 -4
  103. package/catalog/frontmcp-extensibility/examples/vectoriadb/semantic-search-with-persistence.md +4 -4
  104. package/catalog/frontmcp-extensibility/examples/vectoriadb/tfidf-keyword-search.md +4 -3
  105. package/catalog/frontmcp-guides/SKILL.md +3 -3
  106. package/catalog/frontmcp-guides/examples/example-knowledge-base/agent-and-plugin.md +4 -5
  107. package/catalog/frontmcp-guides/examples/example-knowledge-base/vector-search-and-resources.md +4 -3
  108. package/catalog/frontmcp-guides/examples/example-task-manager/auth-and-crud-tools.md +4 -4
  109. package/catalog/frontmcp-guides/examples/example-weather-api/weather-tool-with-schemas.md +1 -2
  110. package/catalog/frontmcp-guides/references/example-knowledge-base.md +22 -17
  111. package/catalog/frontmcp-guides/references/example-task-manager.md +16 -11
  112. package/catalog/frontmcp-guides/references/example-weather-api.md +6 -3
  113. package/catalog/frontmcp-observability/examples/telemetry-api/tool-custom-spans.md +2 -3
  114. package/catalog/frontmcp-observability/examples/tracing-setup/basic-tracing.md +4 -3
  115. package/catalog/frontmcp-observability/references/telemetry-api.md +2 -3
  116. package/catalog/frontmcp-production-readiness/examples/common-checklist/observability-setup.md +1 -2
  117. package/catalog/frontmcp-production-readiness/examples/common-checklist/security-hardening.md +3 -4
  118. package/catalog/frontmcp-production-readiness/examples/distributed-ha/ha-kubernetes-3-replicas.md +229 -0
  119. package/catalog/frontmcp-production-readiness/examples/production-browser/cross-platform-crypto.md +2 -3
  120. package/catalog/frontmcp-production-readiness/examples/production-cli-binary/stdio-transport-error-handling.md +1 -2
  121. package/catalog/frontmcp-production-readiness/examples/production-cloudflare/durable-objects-state.md +2 -4
  122. package/catalog/frontmcp-production-readiness/examples/production-cloudflare/workers-runtime-constraints.md +2 -3
  123. package/catalog/frontmcp-production-readiness/examples/production-lambda/cold-start-connection-reuse.md +3 -2
  124. package/catalog/frontmcp-production-readiness/examples/production-vercel/cold-start-optimization.md +2 -2
  125. package/catalog/frontmcp-production-readiness/examples/production-vercel/stateless-serverless-design.md +3 -3
  126. package/catalog/frontmcp-production-readiness/references/distributed-ha.md +194 -0
  127. package/catalog/frontmcp-setup/SKILL.md +11 -11
  128. package/catalog/frontmcp-setup/examples/project-structure-standalone/feature-folder-organization.md +5 -3
  129. package/catalog/frontmcp-setup/examples/project-structure-standalone/minimal-standalone-layout.md +4 -2
  130. package/catalog/frontmcp-setup/examples/setup-project/basic-node-server.md +4 -2
  131. package/catalog/frontmcp-setup/examples/setup-project/vercel-serverless-server.md +4 -2
  132. package/catalog/frontmcp-setup/examples/setup-redis/hybrid-vercel-kv-with-pubsub.md +8 -7
  133. package/catalog/frontmcp-setup/references/setup-project.md +10 -9
  134. package/catalog/frontmcp-setup/references/setup-redis.md +19 -16
  135. package/catalog/frontmcp-testing/examples/test-direct-client/basic-create-test.md +1 -3
  136. package/catalog/frontmcp-testing/examples/test-direct-client/openai-claude-format-test.md +1 -3
  137. package/catalog/frontmcp-testing/examples/test-tool-unit/schema-validation-test.md +2 -2
  138. package/catalog/frontmcp-testing/references/test-direct-client.md +1 -3
  139. package/catalog/frontmcp-testing/references/test-tool-unit.md +2 -2
  140. package/catalog/skills-manifest.json +364 -12
  141. package/package.json +1 -1
@@ -16,10 +16,11 @@ A multi-app knowledge base MCP server with three composed apps: document ingesti
16
16
  ```typescript
17
17
  // src/main.ts
18
18
  import { FrontMcp } from '@frontmcp/sdk';
19
+
19
20
  import { IngestionApp } from './ingestion/ingestion.app';
20
- import { SearchApp } from './search/search.app';
21
- import { ResearchApp } from './research/research.app';
22
21
  import { AuditLogPlugin } from './plugins/audit-log.plugin';
22
+ import { ResearchApp } from './research/research.app';
23
+ import { SearchApp } from './search/search.app';
23
24
 
24
25
  @FrontMcp({
25
26
  info: { name: 'knowledge-base', version: '1.0.0' },
@@ -40,6 +41,7 @@ export default class KnowledgeBaseServer {}
40
41
  ```typescript
41
42
  // src/ingestion/ingestion.app.ts
42
43
  import { App } from '@frontmcp/sdk';
44
+
43
45
  import { VectorStoreProvider } from './providers/vector-store.provider';
44
46
  import { IngestDocumentTool } from './tools/ingest-document.tool';
45
47
 
@@ -56,8 +58,8 @@ export class IngestionApp {}
56
58
 
57
59
  ```typescript
58
60
  // src/ingestion/providers/vector-store.provider.ts
59
- import { Provider } from '@frontmcp/sdk';
60
61
  import type { Token } from '@frontmcp/di';
62
+ import { Provider } from '@frontmcp/sdk';
61
63
 
62
64
  export interface DocumentChunk {
63
65
  id: string;
@@ -142,10 +144,9 @@ export class VectorStoreProvider implements VectorStore {
142
144
 
143
145
  ```typescript
144
146
  // src/ingestion/tools/ingest-document.tool.ts
145
- import { Tool, ToolContext } from '@frontmcp/sdk';
146
- import { z } from 'zod';
147
- import { VECTOR_STORE } from '../providers/vector-store.provider';
148
- import type { DocumentChunk } from '../providers/vector-store.provider';
147
+ import { Tool, ToolContext, z } from '@frontmcp/sdk';
148
+
149
+ import { VECTOR_STORE, type DocumentChunk } from '../providers/vector-store.provider';
149
150
 
150
151
  @Tool({
151
152
  name: 'ingest_document',
@@ -238,9 +239,10 @@ export class IngestDocumentTool extends ToolContext {
238
239
  ```typescript
239
240
  // src/search/search.app.ts
240
241
  import { App } from '@frontmcp/sdk';
242
+
241
243
  import { VectorStoreProvider } from '../ingestion/providers/vector-store.provider';
242
- import { SearchDocsTool } from './tools/search-docs.tool';
243
244
  import { DocResource } from './resources/doc.resource';
245
+ import { SearchDocsTool } from './tools/search-docs.tool';
244
246
 
245
247
  @App({
246
248
  name: 'Search',
@@ -256,8 +258,8 @@ export class SearchApp {}
256
258
 
257
259
  ```typescript
258
260
  // src/search/tools/search-docs.tool.ts
259
- import { Tool, ToolContext } from '@frontmcp/sdk';
260
- import { z } from 'zod';
261
+ import { Tool, ToolContext, z } from '@frontmcp/sdk';
262
+
261
263
  import { VECTOR_STORE } from '../../ingestion/providers/vector-store.provider';
262
264
 
263
265
  @Tool({
@@ -318,8 +320,9 @@ export class SearchDocsTool extends ToolContext {
318
320
 
319
321
  ```typescript
320
322
  // src/search/resources/doc.resource.ts
321
- import { ResourceTemplate, ResourceContext } from '@frontmcp/sdk';
322
323
  import type { ReadResourceResult } from '@frontmcp/protocol';
324
+ import { ResourceContext, ResourceTemplate } from '@frontmcp/sdk';
325
+
323
326
  import { VECTOR_STORE } from '../../ingestion/providers/vector-store.provider';
324
327
 
325
328
  @ResourceTemplate({
@@ -368,6 +371,7 @@ export class DocResource extends ResourceContext<{ documentId: string }> {
368
371
  ```typescript
369
372
  // src/research/research.app.ts
370
373
  import { App } from '@frontmcp/sdk';
374
+
371
375
  import { ResearcherAgent } from './agents/researcher.agent';
372
376
 
373
377
  @App({
@@ -382,10 +386,10 @@ export class ResearchApp {}
382
386
 
383
387
  ```typescript
384
388
  // src/research/agents/researcher.agent.ts
385
- import { Agent, AgentContext } from '@frontmcp/sdk';
386
- import { z } from 'zod';
387
- import { SearchDocsTool } from '../../search/tools/search-docs.tool';
389
+ import { Agent, AgentContext, z } from '@frontmcp/sdk';
390
+
388
391
  import { IngestDocumentTool } from '../../ingestion/tools/ingest-document.tool';
392
+ import { SearchDocsTool } from '../../search/tools/search-docs.tool';
389
393
 
390
394
  @Agent({
391
395
  name: 'research_topic',
@@ -442,8 +446,7 @@ export class ResearcherAgent extends AgentContext {
442
446
 
443
447
  ```typescript
444
448
  // src/plugins/audit-log.plugin.ts
445
- import { Plugin } from '@frontmcp/sdk';
446
- import type { PluginHookContext } from '@frontmcp/sdk';
449
+ import { Plugin, type PluginHookContext } from '@frontmcp/sdk';
447
450
 
448
451
  @Plugin({
449
452
  name: 'AuditLog',
@@ -515,6 +518,7 @@ export class AuditLogPlugin {
515
518
  ```typescript
516
519
  // test/researcher.agent.spec.ts
517
520
  import { AgentContext } from '@frontmcp/sdk';
521
+
518
522
  import { ResearcherAgent } from '../src/research/agents/researcher.agent';
519
523
 
520
524
  describe('ResearcherAgent', () => {
@@ -590,9 +594,10 @@ describe('ResearcherAgent', () => {
590
594
 
591
595
  ```typescript
592
596
  // test/audit-log.plugin.spec.ts
593
- import { AuditLogPlugin } from '../src/plugins/audit-log.plugin';
594
597
  import type { PluginHookContext } from '@frontmcp/sdk';
595
598
 
599
+ import { AuditLogPlugin } from '../src/plugins/audit-log.plugin';
600
+
596
601
  describe('AuditLogPlugin', () => {
597
602
  let plugin: AuditLogPlugin;
598
603
 
@@ -45,6 +45,7 @@ An authenticated task management MCP server with CRUD tools, a Redis-backed prov
45
45
  ```typescript
46
46
  // src/main.ts
47
47
  import { FrontMcp } from '@frontmcp/sdk';
48
+
48
49
  import { TasksApp } from './tasks.app';
49
50
 
50
51
  @FrontMcp({
@@ -63,11 +64,12 @@ export default class TaskManagerServer {}
63
64
  ```typescript
64
65
  // src/tasks.app.ts
65
66
  import { App } from '@frontmcp/sdk';
67
+
66
68
  import { RedisTaskStoreProvider } from './providers/task-store.provider';
67
69
  import { CreateTaskTool } from './tools/create-task.tool';
70
+ import { DeleteTaskTool } from './tools/delete-task.tool';
68
71
  import { ListTasksTool } from './tools/list-tasks.tool';
69
72
  import { UpdateTaskTool } from './tools/update-task.tool';
70
- import { DeleteTaskTool } from './tools/delete-task.tool';
71
73
 
72
74
  @App({
73
75
  name: 'Tasks',
@@ -100,8 +102,9 @@ export interface Task {
100
102
 
101
103
  ```typescript
102
104
  // src/providers/task-store.provider.ts
103
- import { Provider } from '@frontmcp/sdk';
104
105
  import type { Token } from '@frontmcp/di';
106
+ import { Provider } from '@frontmcp/sdk';
107
+
105
108
  import type { Task } from '../types/task';
106
109
 
107
110
  export interface TaskStore {
@@ -167,8 +170,8 @@ export class RedisTaskStoreProvider implements TaskStore {
167
170
 
168
171
  ```typescript
169
172
  // src/tools/create-task.tool.ts
170
- import { Tool, ToolContext } from '@frontmcp/sdk';
171
- import { z } from 'zod';
173
+ import { Tool, ToolContext, z } from '@frontmcp/sdk';
174
+
172
175
  import { TASK_STORE } from '../providers/task-store.provider';
173
176
 
174
177
  @Tool({
@@ -219,8 +222,8 @@ export class CreateTaskTool extends ToolContext {
219
222
 
220
223
  ```typescript
221
224
  // src/tools/list-tasks.tool.ts
222
- import { Tool, ToolContext } from '@frontmcp/sdk';
223
- import { z } from 'zod';
225
+ import { Tool, ToolContext, z } from '@frontmcp/sdk';
226
+
224
227
  import { TASK_STORE } from '../providers/task-store.provider';
225
228
 
226
229
  @Tool({
@@ -277,8 +280,8 @@ export class ListTasksTool extends ToolContext {
277
280
 
278
281
  ```typescript
279
282
  // src/tools/update-task.tool.ts
280
- import { Tool, ToolContext } from '@frontmcp/sdk';
281
- import { z } from 'zod';
283
+ import { Tool, ToolContext, z } from '@frontmcp/sdk';
284
+
282
285
  import { TASK_STORE } from '../providers/task-store.provider';
283
286
 
284
287
  @Tool({
@@ -331,8 +334,8 @@ export class UpdateTaskTool extends ToolContext {
331
334
 
332
335
  ```typescript
333
336
  // src/tools/delete-task.tool.ts
334
- import { Tool, ToolContext } from '@frontmcp/sdk';
335
- import { z } from 'zod';
337
+ import { Tool, ToolContext, z } from '@frontmcp/sdk';
338
+
336
339
  import { TASK_STORE } from '../providers/task-store.provider';
337
340
 
338
341
  @Tool({
@@ -385,8 +388,9 @@ export class DeleteTaskTool extends ToolContext {
385
388
  ```typescript
386
389
  // test/create-task.tool.spec.ts
387
390
  import { ToolContext } from '@frontmcp/sdk';
388
- import { CreateTaskTool } from '../src/tools/create-task.tool';
391
+
389
392
  import { TASK_STORE, type TaskStore } from '../src/providers/task-store.provider';
393
+ import { CreateTaskTool } from '../src/tools/create-task.tool';
390
394
  import type { Task } from '../src/types/task';
391
395
 
392
396
  describe('CreateTaskTool', () => {
@@ -465,6 +469,7 @@ describe('CreateTaskTool', () => {
465
469
  ```typescript
466
470
  // test/tasks.e2e.spec.ts
467
471
  import { McpTestClient, TestServer, TestTokenFactory } from '@frontmcp/testing';
472
+
468
473
  import Server from '../src/main';
469
474
 
470
475
  describe('Task Manager E2E', () => {
@@ -44,6 +44,7 @@ A complete beginner MCP server that exposes a weather lookup tool and a static r
44
44
  ```typescript
45
45
  // src/main.ts
46
46
  import { FrontMcp } from '@frontmcp/sdk';
47
+
47
48
  import { WeatherApp } from './weather.app';
48
49
 
49
50
  @FrontMcp({
@@ -60,8 +61,9 @@ export default class WeatherServer {}
60
61
  ```typescript
61
62
  // src/weather.app.ts
62
63
  import { App } from '@frontmcp/sdk';
63
- import { GetWeatherTool } from './tools/get-weather.tool';
64
+
64
65
  import { CitiesResource } from './resources/cities.resource';
66
+ import { GetWeatherTool } from './tools/get-weather.tool';
65
67
 
66
68
  @App({
67
69
  name: 'Weather',
@@ -78,8 +80,7 @@ export class WeatherApp {}
78
80
 
79
81
  ```typescript
80
82
  // src/tools/get-weather.tool.ts
81
- import { Tool, ToolContext } from '@frontmcp/sdk';
82
- import { z } from 'zod';
83
+ import { Tool, ToolContext, z } from '@frontmcp/sdk';
83
84
 
84
85
  @Tool({
85
86
  name: 'get_weather',
@@ -149,6 +150,7 @@ export class CitiesResource extends ResourceContext {
149
150
  ```typescript
150
151
  // test/get-weather.tool.spec.ts
151
152
  import { ToolContext } from '@frontmcp/sdk';
153
+
152
154
  import { GetWeatherTool } from '../src/tools/get-weather.tool';
153
155
 
154
156
  describe('GetWeatherTool', () => {
@@ -239,6 +241,7 @@ describe('GetWeatherTool', () => {
239
241
  ```typescript
240
242
  // test/weather.e2e.spec.ts
241
243
  import { McpTestClient, TestServer } from '@frontmcp/testing';
244
+
242
245
  import Server from '../src/main';
243
246
 
244
247
  describe('Weather Server E2E', () => {
@@ -19,15 +19,14 @@ Create child spans, events, and attributes inside a tool's execute method using
19
19
 
20
20
  ```typescript
21
21
  // src/apps/my-app/tools/weather.tool.ts
22
- import { Tool, ToolContext } from '@frontmcp/sdk';
23
- import { z } from 'zod';
22
+ import { Tool, ToolContext, z } from '@frontmcp/sdk';
24
23
 
25
24
  @Tool({
26
25
  name: 'get_weather',
27
26
  description: 'Get weather for a city',
28
27
  inputSchema: { city: z.string() },
29
28
  })
30
- export class GetWeatherTool extends ToolContext<typeof GetWeatherTool> {
29
+ export class GetWeatherTool extends ToolContext {
31
30
  async execute({ city }: { city: string }) {
32
31
  // Event on the "tool get_weather" span
33
32
  this.telemetry.addEvent('request-received', { city });
@@ -27,7 +27,9 @@ setupOTel({ serviceName: 'my-server', exporter: 'console' });
27
27
  ```typescript
28
28
  // src/server.ts
29
29
  import './setup-otel'; // Must be first import
30
+
30
31
  import { FrontMcp } from '@frontmcp/sdk';
32
+
31
33
  import { MyApp } from './apps/my-app';
32
34
 
33
35
  @FrontMcp({
@@ -40,15 +42,14 @@ export default class Server {}
40
42
 
41
43
  ```typescript
42
44
  // src/apps/my-app/tools/hello.tool.ts
43
- import { Tool, ToolContext } from '@frontmcp/sdk';
44
- import { z } from 'zod';
45
+ import { Tool, ToolContext, z } from '@frontmcp/sdk';
45
46
 
46
47
  @Tool({
47
48
  name: 'hello',
48
49
  description: 'Say hello',
49
50
  inputSchema: { name: z.string() },
50
51
  })
51
- export class HelloTool extends ToolContext<typeof HelloTool> {
52
+ export class HelloTool extends ToolContext {
52
53
  async execute({ name }: { name: string }) {
53
54
  return { greeting: `Hello, ${name}!` };
54
55
  }
@@ -22,15 +22,14 @@ Every execution context (tools, resources, prompts, agents) gets a `this.telemet
22
22
  ## Usage in Tools
23
23
 
24
24
  ```typescript
25
- import { Tool, ToolContext } from '@frontmcp/sdk';
26
- import { z } from 'zod';
25
+ import { Tool, ToolContext, z } from '@frontmcp/sdk';
27
26
 
28
27
  @Tool({
29
28
  name: 'analyze_data',
30
29
  description: 'Analyze dataset with custom telemetry',
31
30
  inputSchema: { datasetId: z.string() },
32
31
  })
33
- class AnalyzeDataTool extends ToolContext<typeof AnalyzeDataTool> {
32
+ class AnalyzeDataTool extends ToolContext {
34
33
  async execute({ datasetId }: { datasetId: string }) {
35
34
  // Events go on the "tool analyze_data" span
36
35
  this.telemetry.addEvent('analysis-started', { datasetId });
@@ -19,8 +19,7 @@ Shows how to configure structured logging, error handling with MCP error codes,
19
19
 
20
20
  ```typescript
21
21
  // src/tools/monitored-tool.tool.ts
22
- import { Tool, ToolContext } from '@frontmcp/sdk';
23
- import { z } from 'zod';
22
+ import { Tool, ToolContext, z } from '@frontmcp/sdk';
24
23
 
25
24
  @Tool({
26
25
  name: 'monitored_operation',
@@ -19,8 +19,8 @@ Shows how to configure authentication, CORS, input validation, and rate limiting
19
19
 
20
20
  ```typescript
21
21
  // src/main.ts
22
- import { FrontMcp } from '@frontmcp/sdk';
23
- import { z } from 'zod';
22
+ import { FrontMcp, z } from '@frontmcp/sdk';
23
+
24
24
  import { MyApp } from './my.app';
25
25
 
26
26
  @FrontMcp({
@@ -59,8 +59,7 @@ export default class SecureServer {}
59
59
 
60
60
  ```typescript
61
61
  // src/tools/safe-query.tool.ts
62
- import { Tool, ToolContext } from '@frontmcp/sdk';
63
- import { z } from 'zod';
62
+ import { Tool, ToolContext, z } from '@frontmcp/sdk';
64
63
 
65
64
  @Tool({
66
65
  name: 'safe_query',
@@ -0,0 +1,229 @@
1
+ ---
2
+ name: ha-kubernetes-3-replicas
3
+ reference: distributed-ha
4
+ level: intermediate
5
+ description: Deploy FrontMCP with 3 replicas, Redis, and automatic session failover on Kubernetes
6
+ tags: [ha, kubernetes, redis, distributed, session-takeover, heartbeat]
7
+ features:
8
+ - Configuring @FrontMcp with Redis for distributed deployment
9
+ - Kubernetes Deployment YAML with 3 replicas and readiness probes
10
+ - Verifying heartbeat keys and session takeover via redis-cli
11
+ - NGINX sticky sessions for session affinity
12
+ ---
13
+
14
+ # HA Kubernetes Deployment with 3 Replicas
15
+
16
+ Deploy FrontMCP with 3 replicas, Redis, and automatic session failover on Kubernetes
17
+
18
+ ## Code
19
+
20
+ ### Server Configuration
21
+
22
+ ```typescript
23
+ // src/main.ts
24
+ import { App, FrontMcp, Tool, ToolContext, z } from '@frontmcp/sdk';
25
+
26
+ @Tool({
27
+ name: 'echo',
28
+ description: 'Echo a message',
29
+ inputSchema: { message: z.string() },
30
+ })
31
+ class EchoTool extends ToolContext {
32
+ async execute(input: { message: string }) {
33
+ return { echo: input.message };
34
+ }
35
+ }
36
+
37
+ @App({ name: 'main', tools: [EchoTool] })
38
+ class MainApp {}
39
+
40
+ @FrontMcp({
41
+ info: { name: 'ha-demo', version: '1.0.0' },
42
+ apps: [MainApp],
43
+ redis: {
44
+ provider: 'redis',
45
+ host: process.env['REDIS_HOST'] || 'redis',
46
+ port: 6379,
47
+ },
48
+ transport: {
49
+ persistence: {
50
+ redis: {
51
+ provider: 'redis',
52
+ host: process.env['REDIS_HOST'] || 'redis',
53
+ port: 6379,
54
+ },
55
+ },
56
+ },
57
+ })
58
+ class Server {}
59
+ ```
60
+
61
+ ### Config File
62
+
63
+ ```typescript
64
+ // frontmcp.config.ts
65
+ import { defineConfig } from '@frontmcp/cli';
66
+
67
+ export default defineConfig({
68
+ name: 'ha-demo',
69
+ version: '1.0.0',
70
+ deployments: [
71
+ {
72
+ target: 'distributed',
73
+ ha: {
74
+ heartbeatIntervalMs: 10000,
75
+ heartbeatTtlMs: 30000,
76
+ },
77
+ server: {
78
+ headers: {
79
+ hsts: 'max-age=31536000',
80
+ contentTypeOptions: 'nosniff',
81
+ frameOptions: 'DENY',
82
+ },
83
+ },
84
+ },
85
+ ],
86
+ });
87
+ ```
88
+
89
+ ### Dockerfile
90
+
91
+ ```dockerfile
92
+ FROM node:24-alpine AS builder
93
+ WORKDIR /app
94
+ COPY package.json yarn.lock ./
95
+ RUN yarn install --frozen-lockfile
96
+ COPY . .
97
+ RUN FRONTMCP_DEPLOYMENT_MODE=distributed npx frontmcp build --target distributed
98
+
99
+ FROM node:24-alpine
100
+ WORKDIR /app
101
+ ENV NODE_ENV=production
102
+ COPY --from=builder /app/dist/distributed ./dist
103
+ COPY --from=builder /app/package.json ./
104
+ RUN yarn install --frozen-lockfile --production && yarn cache clean
105
+ EXPOSE 3000
106
+ HEALTHCHECK --interval=15s --timeout=5s --retries=3 --start-period=10s \
107
+ CMD wget -qO- http://localhost:3000/healthz || exit 1
108
+ CMD ["node", "dist/main.js"]
109
+ ```
110
+
111
+ ### Kubernetes Manifests
112
+
113
+ ```yaml
114
+ # k8s/deployment.yaml
115
+ apiVersion: apps/v1
116
+ kind: Deployment
117
+ metadata:
118
+ name: mcp-server
119
+ spec:
120
+ replicas: 3
121
+ selector:
122
+ matchLabels:
123
+ app: mcp-server
124
+ template:
125
+ metadata:
126
+ labels:
127
+ app: mcp-server
128
+ spec:
129
+ containers:
130
+ - name: mcp-server
131
+ image: my-registry/ha-demo:latest
132
+ env:
133
+ - name: FRONTMCP_DEPLOYMENT_MODE
134
+ value: distributed
135
+ - name: REDIS_HOST
136
+ value: redis
137
+ ports:
138
+ - containerPort: 3000
139
+ livenessProbe:
140
+ httpGet:
141
+ path: /healthz
142
+ port: 3000
143
+ initialDelaySeconds: 5
144
+ periodSeconds: 10
145
+ readinessProbe:
146
+ httpGet:
147
+ path: /readyz
148
+ port: 3000
149
+ initialDelaySeconds: 10
150
+ periodSeconds: 15
151
+ ---
152
+ apiVersion: v1
153
+ kind: Service
154
+ metadata:
155
+ name: mcp-server
156
+ spec:
157
+ selector:
158
+ app: mcp-server
159
+ ports:
160
+ - port: 3000
161
+ targetPort: 3000
162
+ ---
163
+ apiVersion: apps/v1
164
+ kind: Deployment
165
+ metadata:
166
+ name: redis
167
+ spec:
168
+ replicas: 1
169
+ selector:
170
+ matchLabels:
171
+ app: redis
172
+ template:
173
+ metadata:
174
+ labels:
175
+ app: redis
176
+ spec:
177
+ containers:
178
+ - name: redis
179
+ image: redis:7-alpine
180
+ ports:
181
+ - containerPort: 6379
182
+ ---
183
+ apiVersion: v1
184
+ kind: Service
185
+ metadata:
186
+ name: redis
187
+ spec:
188
+ selector:
189
+ app: redis
190
+ ports:
191
+ - port: 6379
192
+ ```
193
+
194
+ ### Verification
195
+
196
+ ```bash
197
+ # Deploy
198
+ kubectl apply -f k8s/
199
+
200
+ # Check pods
201
+ kubectl get pods -l app=mcp-server
202
+ # NAME READY STATUS RESTARTS
203
+ # mcp-server-7b8f9-abc12 1/1 Running 0
204
+ # mcp-server-7b8f9-def34 1/1 Running 0
205
+ # mcp-server-7b8f9-ghi56 1/1 Running 0
206
+
207
+ # Check heartbeat keys in Redis
208
+ kubectl exec -it deploy/redis -- redis-cli KEYS "mcp:ha:heartbeat:*"
209
+ # 1) "mcp:ha:heartbeat:mcp-server-7b8f9-abc12"
210
+ # 2) "mcp:ha:heartbeat:mcp-server-7b8f9-def34"
211
+ # 3) "mcp:ha:heartbeat:mcp-server-7b8f9-ghi56"
212
+
213
+ # Kill a pod and watch takeover
214
+ kubectl delete pod mcp-server-7b8f9-abc12
215
+ # After ~30s, its heartbeat expires and sessions are claimed by surviving pods
216
+ ```
217
+
218
+ ## What This Demonstrates
219
+
220
+ - Configuring @FrontMcp with Redis for distributed deployment
221
+ - Kubernetes Deployment YAML with 3 replicas and readiness probes
222
+ - Verifying heartbeat keys and session takeover via redis-cli
223
+ - NGINX sticky sessions for session affinity
224
+
225
+ ## Related
226
+
227
+ - See `distributed-ha` for the full HA architecture reference
228
+ - See `deploy-to-node` for single-pod Docker deployment
229
+ - See `frontmcp-config` for configuration file options
@@ -20,10 +20,9 @@ Shows how to use `@frontmcp/utils` for cross-platform crypto operations that wor
20
20
 
21
21
  ```typescript
22
22
  // src/tools/browser-safe-hash.tool.ts
23
- import { Tool, ToolContext } from '@frontmcp/sdk';
24
- import { z } from 'zod';
23
+ import { Tool, ToolContext, z } from '@frontmcp/sdk';
25
24
  // @frontmcp/utils wraps Web Crypto API — works in browsers
26
- import { sha256Hex, sha256Base64url, randomUUID } from '@frontmcp/utils';
25
+ import { randomUUID, sha256Base64url, sha256Hex } from '@frontmcp/utils';
27
26
 
28
27
  @Tool({
29
28
  name: 'hash_data',
@@ -81,8 +81,7 @@ main();
81
81
 
82
82
  ```typescript
83
83
  // src/tools/safe-tool.tool.ts
84
- import { Tool, ToolContext } from '@frontmcp/sdk';
85
- import { z } from 'zod';
84
+ import { Tool, ToolContext, z } from '@frontmcp/sdk';
86
85
 
87
86
  @Tool({
88
87
  name: 'process_file',
@@ -46,8 +46,7 @@ new_classes = ["RateLimiterDO"]
46
46
 
47
47
  ```typescript
48
48
  // src/tools/rate-limited-action.tool.ts
49
- import { Tool, ToolContext } from '@frontmcp/sdk';
50
- import { z } from 'zod';
49
+ import { Tool, ToolContext, z } from '@frontmcp/sdk';
51
50
 
52
51
  @Tool({
53
52
  name: 'rate_limited_action',
@@ -85,8 +84,7 @@ export class RateLimitedActionTool extends ToolContext {
85
84
 
86
85
  ```typescript
87
86
  // src/tools/file-upload.tool.ts
88
- import { Tool, ToolContext } from '@frontmcp/sdk';
89
- import { z } from 'zod';
87
+ import { Tool, ToolContext, z } from '@frontmcp/sdk';
90
88
 
91
89
  @Tool({
92
90
  name: 'upload_file',
@@ -20,10 +20,9 @@ Shows how to write tools that are compatible with the Cloudflare Workers runtime
20
20
 
21
21
  ```typescript
22
22
  // src/tools/worker-safe.tool.ts
23
- import { Tool, ToolContext } from '@frontmcp/sdk';
24
- import { z } from 'zod';
23
+ import { Tool, ToolContext, z } from '@frontmcp/sdk';
25
24
  // Use @frontmcp/utils — wraps Web Crypto API, works in Workers
26
- import { sha256Hex, randomUUID, base64urlEncode } from '@frontmcp/utils';
25
+ import { base64urlEncode, randomUUID, sha256Hex } from '@frontmcp/utils';
27
26
 
28
27
  @Tool({
29
28
  name: 'transform_data',
@@ -60,8 +60,8 @@ export class DbConnectionProvider {
60
60
 
61
61
  ```typescript
62
62
  // src/tools/optimized-query.tool.ts
63
- import { Tool, ToolContext } from '@frontmcp/sdk';
64
- import { z } from 'zod';
63
+ import { Tool, ToolContext, z } from '@frontmcp/sdk';
64
+
65
65
  import { DB_CLIENT } from '../providers/db-connection.provider';
66
66
 
67
67
  @Tool({
@@ -96,6 +96,7 @@ export class OptimizedQueryTool extends ToolContext {
96
96
  ```typescript
97
97
  // src/main.ts
98
98
  import { FrontMcp } from '@frontmcp/sdk';
99
+
99
100
  // Only import lightweight modules at the top level
100
101
  // Heavy imports happen lazily in providers
101
102
  import { MyApp } from './my.app';