@frontmcp/skills 1.0.4 → 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 (133) 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/examples/create-agent/basic-agent-with-tools.md +3 -6
  63. package/catalog/frontmcp-development/examples/create-agent/custom-multi-pass-agent.md +1 -2
  64. package/catalog/frontmcp-development/examples/create-agent/nested-agents-with-swarm.md +2 -4
  65. package/catalog/frontmcp-development/examples/create-agent-llm-config/anthropic-config.md +1 -2
  66. package/catalog/frontmcp-development/examples/create-agent-llm-config/openai-config.md +1 -2
  67. package/catalog/frontmcp-development/examples/create-job/basic-report-job.md +1 -2
  68. package/catalog/frontmcp-development/examples/create-job/job-with-permissions.md +2 -3
  69. package/catalog/frontmcp-development/examples/create-job/job-with-retry.md +1 -2
  70. package/catalog/frontmcp-development/examples/create-plugin-hooks/tool-level-hooks-and-stage-replacement.md +2 -5
  71. package/catalog/frontmcp-development/examples/create-provider/basic-database-provider.md +4 -3
  72. package/catalog/frontmcp-development/examples/create-skill-with-tools/directory-skill-with-tools.md +2 -3
  73. package/catalog/frontmcp-development/examples/create-tool/basic-class-tool.md +1 -2
  74. package/catalog/frontmcp-development/examples/create-tool/tool-with-di-and-errors.md +2 -2
  75. package/catalog/frontmcp-development/examples/create-tool/tool-with-rate-limiting-and-progress.md +1 -2
  76. package/catalog/frontmcp-development/examples/create-tool-annotations/destructive-delete-tool.md +2 -4
  77. package/catalog/frontmcp-development/examples/create-tool-annotations/readonly-query-tool.md +1 -2
  78. package/catalog/frontmcp-development/examples/create-tool-output-schema-types/primitive-and-media-outputs.md +3 -6
  79. package/catalog/frontmcp-development/examples/create-tool-output-schema-types/zod-raw-shape-output.md +1 -2
  80. package/catalog/frontmcp-development/examples/create-tool-output-schema-types/zod-schema-advanced-output.md +2 -4
  81. package/catalog/frontmcp-development/examples/decorators-guide/agent-skill-job-workflow.md +3 -5
  82. package/catalog/frontmcp-development/examples/decorators-guide/basic-server-with-app-and-tools.md +5 -5
  83. package/catalog/frontmcp-development/examples/decorators-guide/multi-app-with-plugins-and-providers.md +4 -6
  84. package/catalog/frontmcp-development/examples/official-plugins/cache-and-feature-flags.md +3 -5
  85. package/catalog/frontmcp-development/examples/official-plugins/production-multi-plugin-setup.md +4 -5
  86. package/catalog/frontmcp-development/examples/official-plugins/remember-plugin-session-memory.md +3 -5
  87. package/catalog/frontmcp-development/references/create-agent.md +4 -7
  88. package/catalog/frontmcp-development/references/create-job.md +3 -6
  89. package/catalog/frontmcp-development/references/create-plugin-hooks.md +12 -16
  90. package/catalog/frontmcp-development/references/create-skill-with-tools.md +2 -3
  91. package/catalog/frontmcp-development/references/create-tool.md +93 -23
  92. package/catalog/frontmcp-development/references/create-workflow.md +2 -3
  93. package/catalog/frontmcp-development/references/decorators-guide.md +32 -36
  94. package/catalog/frontmcp-extensibility/examples/vectoriadb/product-catalog-search.md +4 -4
  95. package/catalog/frontmcp-extensibility/examples/vectoriadb/semantic-search-with-persistence.md +4 -4
  96. package/catalog/frontmcp-extensibility/examples/vectoriadb/tfidf-keyword-search.md +4 -3
  97. package/catalog/frontmcp-guides/SKILL.md +3 -3
  98. package/catalog/frontmcp-guides/examples/example-knowledge-base/agent-and-plugin.md +4 -5
  99. package/catalog/frontmcp-guides/examples/example-knowledge-base/vector-search-and-resources.md +4 -3
  100. package/catalog/frontmcp-guides/examples/example-task-manager/auth-and-crud-tools.md +4 -4
  101. package/catalog/frontmcp-guides/examples/example-weather-api/weather-tool-with-schemas.md +1 -2
  102. package/catalog/frontmcp-guides/references/example-knowledge-base.md +22 -17
  103. package/catalog/frontmcp-guides/references/example-task-manager.md +16 -11
  104. package/catalog/frontmcp-guides/references/example-weather-api.md +6 -3
  105. package/catalog/frontmcp-observability/examples/telemetry-api/tool-custom-spans.md +2 -3
  106. package/catalog/frontmcp-observability/examples/tracing-setup/basic-tracing.md +4 -3
  107. package/catalog/frontmcp-observability/references/telemetry-api.md +2 -3
  108. package/catalog/frontmcp-production-readiness/examples/common-checklist/observability-setup.md +1 -2
  109. package/catalog/frontmcp-production-readiness/examples/common-checklist/security-hardening.md +3 -4
  110. package/catalog/frontmcp-production-readiness/examples/distributed-ha/ha-kubernetes-3-replicas.md +229 -0
  111. package/catalog/frontmcp-production-readiness/examples/production-browser/cross-platform-crypto.md +2 -3
  112. package/catalog/frontmcp-production-readiness/examples/production-cli-binary/stdio-transport-error-handling.md +1 -2
  113. package/catalog/frontmcp-production-readiness/examples/production-cloudflare/durable-objects-state.md +2 -4
  114. package/catalog/frontmcp-production-readiness/examples/production-cloudflare/workers-runtime-constraints.md +2 -3
  115. package/catalog/frontmcp-production-readiness/examples/production-lambda/cold-start-connection-reuse.md +3 -2
  116. package/catalog/frontmcp-production-readiness/examples/production-vercel/cold-start-optimization.md +2 -2
  117. package/catalog/frontmcp-production-readiness/examples/production-vercel/stateless-serverless-design.md +3 -3
  118. package/catalog/frontmcp-production-readiness/references/distributed-ha.md +194 -0
  119. package/catalog/frontmcp-setup/SKILL.md +11 -11
  120. package/catalog/frontmcp-setup/examples/project-structure-standalone/feature-folder-organization.md +5 -3
  121. package/catalog/frontmcp-setup/examples/project-structure-standalone/minimal-standalone-layout.md +4 -2
  122. package/catalog/frontmcp-setup/examples/setup-project/basic-node-server.md +4 -2
  123. package/catalog/frontmcp-setup/examples/setup-project/vercel-serverless-server.md +4 -2
  124. package/catalog/frontmcp-setup/examples/setup-redis/hybrid-vercel-kv-with-pubsub.md +8 -7
  125. package/catalog/frontmcp-setup/references/setup-project.md +10 -9
  126. package/catalog/frontmcp-setup/references/setup-redis.md +19 -16
  127. package/catalog/frontmcp-testing/examples/test-direct-client/basic-create-test.md +1 -3
  128. package/catalog/frontmcp-testing/examples/test-direct-client/openai-claude-format-test.md +1 -3
  129. package/catalog/frontmcp-testing/examples/test-tool-unit/schema-validation-test.md +2 -2
  130. package/catalog/frontmcp-testing/references/test-direct-client.md +1 -3
  131. package/catalog/frontmcp-testing/references/test-tool-unit.md +2 -2
  132. package/catalog/skills-manifest.json +325 -3
  133. package/package.json +1 -1
@@ -0,0 +1,214 @@
1
+ ---
2
+ name: configure-deployment-targets
3
+ description: Configure multi-target builds with frontmcp.config.ts for node, distributed, vercel, lambda, cloudflare, browser, cli, and sdk targets
4
+ ---
5
+
6
+ # Configure Deployment Targets
7
+
8
+ FrontMCP's configuration file defines one or more deployment targets, each with independent server settings, security headers, and HA configuration. Use `defineConfig()` for full TypeScript autocomplete.
9
+
10
+ ## When to Use This Skill
11
+
12
+ ### Must Use
13
+
14
+ - Deploying to multiple platforms (e.g., node + vercel + distributed) from the same codebase
15
+ - Configuring per-target server settings (port, CSP, CORS, HA)
16
+ - Setting up security headers for production deployment
17
+
18
+ ### Recommended
19
+
20
+ - Any project that benefits from typed configuration with IDE autocomplete
21
+ - Multi-environment setups (dev vs staging vs production targets)
22
+
23
+ ### Skip When
24
+
25
+ - Single-target projects using CLI flags only (`frontmcp build --target node`)
26
+ - You only need to configure auth modes or sessions (see `configure-auth-modes`, `configure-session`)
27
+
28
+ > **Decision:** Use this skill when you need a configuration file with multi-target or per-target server settings. Skip for simple single-target CLI builds.
29
+
30
+ ## Prerequisites
31
+
32
+ - `@frontmcp/cli` installed
33
+ - A working FrontMCP server (see `frontmcp-development`)
34
+
35
+ ## Step 1: Create Configuration File
36
+
37
+ ```typescript
38
+ // frontmcp.config.ts
39
+ import { defineConfig } from '@frontmcp/cli';
40
+
41
+ export default defineConfig({
42
+ name: 'my-server',
43
+ version: '1.0.0',
44
+ deployments: [{ target: 'node' }],
45
+ });
46
+ ```
47
+
48
+ ## Step 2: Add Deployment Targets
49
+
50
+ ```typescript
51
+ export default defineConfig({
52
+ name: 'my-server',
53
+ deployments: [
54
+ { target: 'node', server: { http: { port: 3000 } } },
55
+ {
56
+ target: 'distributed',
57
+ ha: { heartbeatIntervalMs: 5000, heartbeatTtlMs: 15000 },
58
+ },
59
+ { target: 'vercel' },
60
+ ],
61
+ });
62
+ ```
63
+
64
+ ## Step 3: Configure Server Settings
65
+
66
+ ```typescript
67
+ export default defineConfig({
68
+ name: 'my-server',
69
+ deployments: [
70
+ {
71
+ target: 'node',
72
+ server: {
73
+ http: { port: 3000, cors: { origin: 'https://app.example.com' } },
74
+ csp: {
75
+ enabled: true,
76
+ directives: "default-src 'self'; upgrade-insecure-requests",
77
+ },
78
+ headers: {
79
+ hsts: 'max-age=31536000; includeSubDomains',
80
+ contentTypeOptions: 'nosniff',
81
+ frameOptions: 'DENY',
82
+ },
83
+ },
84
+ },
85
+ ],
86
+ });
87
+ ```
88
+
89
+ ## Step 4: Build for Each Target
90
+
91
+ ```bash
92
+ frontmcp build --target node
93
+ frontmcp build --target distributed
94
+ frontmcp build --target vercel
95
+ ```
96
+
97
+ ## Configuration Reference
98
+
99
+ ### Top-Level Fields
100
+
101
+ | Field | Type | Required | Description |
102
+ | ------------- | ------ | -------- | ------------------------------ |
103
+ | `name` | string | Yes | Server name (kebab-case) |
104
+ | `version` | string | No | Server version |
105
+ | `entry` | string | No | Custom entry file path |
106
+ | `deployments` | array | Yes | One or more deployment targets |
107
+
108
+ ### Available Targets
109
+
110
+ | Target | Transport | Storage | Use Case |
111
+ | ------------- | ---------------- | --------------------- | ----------------------- |
112
+ | `node` | HTTP, SSE, stdio | Redis, SQLite, memory | VPS, Docker, bare metal |
113
+ | `distributed` | HTTP | Redis (required) | Multi-pod with HA |
114
+ | `vercel` | HTTP | Vercel KV | Serverless with Vercel |
115
+ | `lambda` | HTTP | DynamoDB, ElastiCache | AWS serverless |
116
+ | `cloudflare` | HTTP | KV, Durable Objects | Edge computing |
117
+ | `browser` | In-memory | Memory | Web browser |
118
+ | `cli` | stdio | SQLite, memory | Standalone binary |
119
+ | `sdk` | Direct | Configurable | Library embedding |
120
+
121
+ ### Server HTTP Options
122
+
123
+ | Field | Type | Default | Description |
124
+ | ------------- | ---------------- | ------- | ---------------------------- |
125
+ | `port` | number | 3000 | Listen port |
126
+ | `socketPath` | string | --- | Unix socket (overrides port) |
127
+ | `entryPath` | string | `/` | Base path |
128
+ | `cors.origin` | string | --- | CORS allowed origin |
129
+ | `portRange` | [number, number] | --- | Auto-find available port |
130
+
131
+ ### CSP Options
132
+
133
+ | Field | Type | Default | Description |
134
+ | ------------ | ------- | ------- | ------------------------------ |
135
+ | `enabled` | boolean | false | Enable CSP headers |
136
+ | `directives` | string | --- | Semicolon-separated directives |
137
+ | `reportUri` | string | --- | Violation report URI |
138
+ | `reportOnly` | boolean | false | Report-only mode |
139
+
140
+ ### Security Headers
141
+
142
+ | Field | Default | Header |
143
+ | -------------------- | --------- | --------------------------- |
144
+ | `hsts` | --- | `Strict-Transport-Security` |
145
+ | `contentTypeOptions` | `nosniff` | `X-Content-Type-Options` |
146
+ | `frameOptions` | `DENY` | `X-Frame-Options` |
147
+
148
+ ### HA Configuration (distributed target only)
149
+
150
+ | Field | Type | Default | Description |
151
+ | ----------------------- | ------ | --------- | ---------------------------- |
152
+ | `heartbeatIntervalMs` | number | 10000 | Heartbeat write interval |
153
+ | `heartbeatTtlMs` | number | 30000 | Heartbeat TTL |
154
+ | `takeoverGracePeriodMs` | number | 5000 | Grace period before takeover |
155
+ | `redisKeyPrefix` | string | `mcp:ha:` | Redis key prefix |
156
+
157
+ ## File Resolution Order
158
+
159
+ 1. `frontmcp.config.ts`
160
+ 2. `frontmcp.config.js`
161
+ 3. `frontmcp.config.json`
162
+ 4. `frontmcp.config.mjs`
163
+ 5. `frontmcp.config.cjs`
164
+ 6. Fallback: `package.json` (derives name, default node target)
165
+
166
+ ## JSON Schema for IDE Support
167
+
168
+ For JSON configs, add `$schema` for autocomplete:
169
+
170
+ ```json
171
+ {
172
+ "$schema": "./node_modules/@frontmcp/cli/frontmcp.schema.json",
173
+ "name": "my-server",
174
+ "deployments": [{ "target": "node" }]
175
+ }
176
+ ```
177
+
178
+ ## Common Patterns
179
+
180
+ | Pattern | Correct | Incorrect | Why |
181
+ | -------------- | ---------------------------- | ---------------------------- | ----------------------------- |
182
+ | Config helper | `defineConfig({...})` | Plain object export | Loses IDE autocomplete |
183
+ | HA config | Only on `distributed` target | On `node` or `vercel` target | HA requires Redis + multi-pod |
184
+ | CSP directives | Semicolon-separated string | Object or array | Schema expects a string |
185
+
186
+ ## Verification Checklist
187
+
188
+ ### Configuration
189
+
190
+ - [ ] `frontmcp.config.ts` exists in project root
191
+ - [ ] `name` is kebab-case with no spaces
192
+ - [ ] At least one deployment target defined
193
+ - [ ] HA config only on `distributed` target
194
+
195
+ ### Runtime
196
+
197
+ - [ ] `frontmcp build --target <target>` succeeds for each target
198
+ - [ ] Security headers visible in response (`curl -I http://localhost:3000/healthz`)
199
+ - [ ] CSP header present when `csp.enabled: true`
200
+
201
+ ## Examples
202
+
203
+ | Example | Level | Description |
204
+ | ------------------------------------------------------------------------------------------------------ | ------------ | -------------------------------------------------------------------------------------------------------------------------------- |
205
+ | [`multi-target-with-security`](../examples/configure-deployment-targets/multi-target-with-security.md) | Intermediate | Configure a FrontMCP project with node + distributed targets, CSP headers, and HSTS |
206
+ | [`distributed-ha-config`](../examples/configure-deployment-targets/distributed-ha-config.md) | Advanced | Configure a distributed deployment target with HA settings for heartbeat, session takeover, and Redis-backed session persistence |
207
+ | [`json-schema-ide-support`](../examples/configure-deployment-targets/json-schema-ide-support.md) | Basic | Use frontmcp.config.json with JSON Schema for VS Code and WebStorm autocomplete |
208
+
209
+ > See all examples in [`examples/configure-deployment-targets/`](../examples/configure-deployment-targets/)
210
+
211
+ ## Reference
212
+
213
+ - [Documentation](https://docs.agentfront.dev/frontmcp/deployment/frontmcp-config)
214
+ - Related skills: `frontmcp-deployment`, `distributed-ha`, `deploy-to-node`, `deploy-to-vercel`
@@ -72,8 +72,7 @@ interface ElicitationOptionsInput {
72
72
  When elicitation is enabled, tools can request user input via the MCP elicitation protocol:
73
73
 
74
74
  ```typescript
75
- import { Tool, ToolContext } from '@frontmcp/sdk';
76
- import { z } from 'zod';
75
+ import { Tool, ToolContext, z } from '@frontmcp/sdk';
77
76
 
78
77
  @Tool({
79
78
  name: 'delete_records',
@@ -0,0 +1,198 @@
1
+ ---
2
+ name: configure-security-headers
3
+ description: Configure CSP, HSTS, X-Frame-Options, and X-Content-Type-Options via frontmcp.config server settings
4
+ ---
5
+
6
+ # Configure Security Headers
7
+
8
+ Set Content Security Policy (CSP), HSTS, and other security headers on every HTTP response. Configure them in `frontmcp.config` per deployment target — the build adapter injects them as environment variables that the built-in middleware reads at runtime.
9
+
10
+ ## When to Use This Skill
11
+
12
+ ### Must Use
13
+
14
+ - Deploying to production and need CSP headers to prevent XSS
15
+ - Required to send HSTS headers for HTTPS enforcement
16
+ - Compliance requires specific X-Frame-Options or X-Content-Type-Options values
17
+
18
+ ### Recommended
19
+
20
+ - Any production deployment behind HTTPS
21
+ - Testing CSP policies in report-only mode before enforcement
22
+
23
+ ### Skip When
24
+
25
+ - Local development only (security headers are unnecessary on localhost)
26
+ - Browser target (no HTTP server to set headers on)
27
+ - You manage headers via NGINX/CDN instead of the application
28
+
29
+ > **Decision:** Use this skill when the FrontMCP server must emit its own security headers. Skip if a reverse proxy handles them.
30
+
31
+ ## Prerequisites
32
+
33
+ - `@frontmcp/cli` installed
34
+ - A `frontmcp.config.ts` or `.json` file (see `configure-deployment-targets`)
35
+
36
+ ## Step 1: Add CSP to Your Config
37
+
38
+ CSP directives are specified as a record (object) mapping directive names to values:
39
+
40
+ ```typescript
41
+ // frontmcp.config.ts
42
+ import { defineConfig } from '@frontmcp/cli';
43
+
44
+ export default defineConfig({
45
+ name: 'my-server',
46
+ deployments: [
47
+ {
48
+ target: 'node',
49
+ server: {
50
+ csp: {
51
+ enabled: true,
52
+ directives: {
53
+ 'default-src': "'self'",
54
+ 'script-src': "'self' https://cdn.example.com",
55
+ 'style-src': "'self' 'unsafe-inline'",
56
+ 'img-src': '* data:',
57
+ 'upgrade-insecure-requests': '', // value-less directive
58
+ },
59
+ },
60
+ },
61
+ },
62
+ ],
63
+ });
64
+ ```
65
+
66
+ ## Step 2: Add Security Headers
67
+
68
+ ```typescript
69
+ server: {
70
+ headers: {
71
+ hsts: 'max-age=31536000; includeSubDomains; preload',
72
+ contentTypeOptions: 'nosniff', // default, can omit
73
+ frameOptions: 'DENY', // default, can omit
74
+ },
75
+ }
76
+ ```
77
+
78
+ ## Step 3: Build and Verify
79
+
80
+ ```bash
81
+ frontmcp build --target node
82
+ node dist/node/main.js
83
+
84
+ # Verify headers
85
+ curl -I http://localhost:3000/healthz
86
+ # Content-Security-Policy: default-src 'self'; script-src 'self' https://cdn.example.com; ...
87
+ # Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
88
+ # X-Content-Type-Options: nosniff
89
+ # X-Frame-Options: DENY
90
+ ```
91
+
92
+ ## Configuration Reference
93
+
94
+ ### CSP Options (`server.csp`)
95
+
96
+ | Field | Type | Default | Description |
97
+ | ------------ | ------------------------------------ | ------- | ----------------------------------------- |
98
+ | `enabled` | boolean | false | Enable CSP headers |
99
+ | `directives` | `Record<string, string \| string[]>` | --- | Directive-to-value map |
100
+ | `reportUri` | string | --- | URI for violation reports |
101
+ | `reportOnly` | boolean | false | Use `Content-Security-Policy-Report-Only` |
102
+
103
+ ### Security Headers (`server.headers`)
104
+
105
+ | Field | Type | Default | Header |
106
+ | -------------------- | ----------------------- | --------- | --------------------------- |
107
+ | `hsts` | `string \| false` | --- | `Strict-Transport-Security` |
108
+ | `contentTypeOptions` | `string \| false` | `nosniff` | `X-Content-Type-Options` |
109
+ | `frameOptions` | `string \| false` | `DENY` | `X-Frame-Options` |
110
+ | `custom` | `Record<string,string>` | --- | Any custom headers |
111
+
112
+ Set any of the first three fields to `false` to explicitly disable that header.
113
+
114
+ ### Value-Less CSP Directives
115
+
116
+ Directives like `upgrade-insecure-requests` and `block-all-mixed-content` have no value. Set them with an empty string:
117
+
118
+ ```typescript
119
+ directives: {
120
+ 'upgrade-insecure-requests': '',
121
+ 'block-all-mixed-content': '',
122
+ }
123
+ ```
124
+
125
+ ### Report-Only Mode
126
+
127
+ Test CSP rules without blocking content:
128
+
129
+ ```typescript
130
+ csp: {
131
+ enabled: true,
132
+ directives: { 'default-src': "'self'" },
133
+ reportUri: 'https://report.example.com/csp',
134
+ reportOnly: true, // violations reported, not blocked
135
+ }
136
+ ```
137
+
138
+ ### Environment Variables
139
+
140
+ The build adapter converts config to these env vars (can also be overridden at runtime):
141
+
142
+ | Variable | Config Path |
143
+ | ------------------------------- | ------------------------------------ |
144
+ | `FRONTMCP_CSP_ENABLED` | `server.csp.enabled` |
145
+ | `FRONTMCP_CSP_DIRECTIVES` | `server.csp.directives` (serialized) |
146
+ | `FRONTMCP_CSP_REPORT_URI` | `server.csp.reportUri` |
147
+ | `FRONTMCP_CSP_REPORT_ONLY` | `server.csp.reportOnly` |
148
+ | `FRONTMCP_HSTS` | `server.headers.hsts` |
149
+ | `FRONTMCP_CONTENT_TYPE_OPTIONS` | `server.headers.contentTypeOptions` |
150
+ | `FRONTMCP_FRAME_OPTIONS` | `server.headers.frameOptions` |
151
+
152
+ ## Common Patterns
153
+
154
+ | Pattern | Correct | Incorrect | Why |
155
+ | --------------------- | --------------------------------- | ------------------------------- | ---------------------------------------------------- |
156
+ | CSP directives format | `{ 'default-src': "'self'" }` | `"default-src 'self'"` (string) | Config schema expects a record, not a string |
157
+ | Value-less directives | `'upgrade-insecure-requests': ''` | Omitting them | Empty string preserves the directive in output |
158
+ | Testing CSP | Start with `reportOnly: true` | Enforce immediately | Report-only lets you fix violations without blocking |
159
+ | HSTS in dev | Omit `hsts` in dev config | `max-age=31536000` in dev | HSTS persists in browser cache, hard to undo locally |
160
+
161
+ ## Verification Checklist
162
+
163
+ ### Configuration
164
+
165
+ - [ ] `csp.enabled: true` in production deployment
166
+ - [ ] `directives` covers at least `default-src`
167
+ - [ ] `reportUri` set for CSP violation monitoring
168
+ - [ ] `hsts` set with appropriate `max-age` for production
169
+
170
+ ### Runtime
171
+
172
+ - [ ] `curl -I` shows `Content-Security-Policy` header
173
+ - [ ] `X-Content-Type-Options: nosniff` present
174
+ - [ ] `X-Frame-Options: DENY` present (or `SAMEORIGIN` if iframes needed)
175
+ - [ ] Report-only mode tested before enforcement
176
+
177
+ ## Troubleshooting
178
+
179
+ | Problem | Cause | Solution |
180
+ | ------------------------------------- | --------------------------------------------- | ------------------------------------------------------- |
181
+ | CSP header missing | `csp.enabled` not set or build not rebuilt | Set `enabled: true` and rebuild |
182
+ | Assets blocked by CSP | Missing directive for CDN/external source | Add the source to the appropriate directive |
183
+ | Browser forced to HTTPS unexpectedly | HSTS set before HTTPS configured | Clear browser HSTS cache or use `max-age=0` temporarily |
184
+ | `Invalid frontmcp.config: directives` | Using string instead of record for directives | Change to `{ 'directive-name': 'value' }` object format |
185
+
186
+ ## Examples
187
+
188
+ | Example | Level | Description |
189
+ | ---------------------------------------------------------------------------------------------- | ------------ | ---------------------------------------------------------------------------------------------------------------------- |
190
+ | [`csp-report-only`](../examples/configure-security-headers/csp-report-only.md) | Basic | Test CSP policies in report-only mode to identify violations before enforcement |
191
+ | [`full-production-headers`](../examples/configure-security-headers/full-production-headers.md) | Intermediate | Complete security headers configuration for production with CSP enforcement, HSTS preload, and clickjacking protection |
192
+
193
+ > See all examples in [`examples/configure-security-headers/`](../examples/configure-security-headers/)
194
+
195
+ ## Reference
196
+
197
+ - [Documentation](https://docs.agentfront.dev/frontmcp/deployment/security-headers)
198
+ - Related skills: `configure-deployment-targets`, `configure-http`, `frontmcp-deployment`
@@ -64,6 +64,7 @@ Entry point for deploying and building FrontMCP servers. This skill helps you ch
64
64
  | Embed MCP into an existing Node.js application | `build-for-sdk` | Library build for programmatic usage without standalone server |
65
65
  | Write a Dockerfile for Node.js deployment | `deploy-to-node-dockerfile` | Dockerfile configuration for Node.js deployment |
66
66
  | Configure Vercel-specific settings (vercel.json) | `deploy-to-vercel-config` | Vercel-specific configuration (vercel.json) |
67
+ | Connect MCP clients (Claude, Cursor, VS Code) | `mcp-client-integration` | Configure .mcp.json for stdio, HTTP, or Unix socket transport |
67
68
 
68
69
  ### CLI Commands for Deployment and Operations
69
70
 
@@ -18,8 +18,7 @@ Build a FrontMCP server as a standalone binary using Node.js Single Executable A
18
18
 
19
19
  ```typescript
20
20
  // src/main.ts
21
- import { FrontMcp, App, Tool, ToolContext } from '@frontmcp/sdk';
22
- import { z } from 'zod';
21
+ import { App, FrontMcp, Tool, ToolContext, z } from '@frontmcp/sdk';
23
22
 
24
23
  @Tool({
25
24
  name: 'greet',
@@ -18,8 +18,7 @@ Run a FrontMCP server as a local daemon accessible via Unix socket for IDE exten
18
18
 
19
19
  ```typescript
20
20
  // src/main.ts
21
- import { FrontMcp, App, Tool, ToolContext } from '@frontmcp/sdk';
22
- import { z } from 'zod';
21
+ import { App, FrontMcp, Tool, ToolContext, z } from '@frontmcp/sdk';
23
22
 
24
23
  @Tool({
25
24
  name: 'lookup',
@@ -0,0 +1,117 @@
1
+ ---
2
+ name: mcpb-bundle-build
3
+ reference: build-for-mcpb
4
+ level: basic
5
+ description: 'Produce a .mcpb archive for Claude Desktop with metadata, tools, and install-time user_config.'
6
+ tags: [deployment, mcpb, bundle, claude-desktop, user-config]
7
+ features:
8
+ - 'Using `frontmcp build --target mcpb` to produce a single `.mcpb` archive'
9
+ - 'Translating `setup.steps` into MCPB `user_config` + `${user_config.KEY}` env bindings'
10
+ - 'Validating the archive round-trip with `frontmcp mcpb validate`'
11
+ ---
12
+
13
+ # MCPB Bundle Build
14
+
15
+ Produce a .mcpb archive for Claude Desktop with metadata, tools, and install-time user_config.
16
+
17
+ ## Code
18
+
19
+ ```typescript
20
+ // src/main.ts
21
+ import { App, FrontMcp, Tool, ToolContext, z } from '@frontmcp/sdk';
22
+
23
+ @Tool({
24
+ name: 'greet',
25
+ description: 'Greet a user by name',
26
+ inputSchema: { name: z.string() },
27
+ })
28
+ class GreetTool extends ToolContext<{ name: string }> {
29
+ async execute(input: { name: string }) {
30
+ const apiBase = process.env.API_BASE ?? 'https://api.example.com';
31
+ return {
32
+ content: [{ type: 'text' as const, text: `Hello, ${input.name}! (via ${apiBase})` }],
33
+ };
34
+ }
35
+ }
36
+
37
+ @App({ name: 'GreeterApp', tools: [GreetTool] })
38
+ class GreeterApp {}
39
+
40
+ @FrontMcp({
41
+ info: { name: 'greeter-mcpb', version: '1.0.0' },
42
+ apps: [GreeterApp],
43
+ })
44
+ export default class GreeterServer {}
45
+ ```
46
+
47
+ ```js
48
+ // frontmcp.config.js
49
+ const { z } = require('zod');
50
+
51
+ module.exports = {
52
+ name: 'greeter-mcpb',
53
+ version: '1.0.0',
54
+ entry: './src/main.ts',
55
+ nodeVersion: '>=22.0.0',
56
+ deployments: [
57
+ {
58
+ target: 'mcpb',
59
+ displayName: 'Greeter',
60
+ longDescription: '# Greeter\n\nSays hi to the configured API.',
61
+ author: { name: 'Acme', email: 'hello@acme.dev' },
62
+ license: 'Apache-2.0',
63
+ homepage: 'https://acme.dev/greeter',
64
+ repository: 'https://github.com/acme/greeter',
65
+ icon: 'assets/icon.png',
66
+ keywords: ['greeting', 'demo'],
67
+ compatibility: {
68
+ claude_desktop: '>=1.0.0',
69
+ platforms: ['darwin', 'linux', 'win32'],
70
+ runtimes: { node: '>=22.0.0' },
71
+ },
72
+ sea: { enabled: true },
73
+ },
74
+ ],
75
+ // Install-time questions — each step becomes a user_config entry + env var.
76
+ setup: {
77
+ steps: [
78
+ {
79
+ id: 'api-base',
80
+ prompt: 'API Base URL',
81
+ description: 'Endpoint the greeter should call',
82
+ env: 'API_BASE',
83
+ schema: z.string().url().default('https://api.example.com'),
84
+ },
85
+ {
86
+ id: 'api-token',
87
+ prompt: 'API Token',
88
+ description: 'Personal access token for the API',
89
+ env: 'API_TOKEN',
90
+ sensitive: true,
91
+ schema: z.string().min(1),
92
+ },
93
+ ],
94
+ },
95
+ };
96
+ ```
97
+
98
+ ```bash
99
+ # Build — produces dist/mcpb/greeter-mcpb-1.0.0.mcpb
100
+ frontmcp build --target mcpb
101
+
102
+ # Validate the archive
103
+ frontmcp mcpb validate dist/mcpb/greeter-mcpb-1.0.0.mcpb
104
+
105
+ # Open in Claude Desktop to install
106
+ open dist/mcpb/greeter-mcpb-1.0.0.mcpb
107
+ ```
108
+
109
+ ## What This Demonstrates
110
+
111
+ - Using `frontmcp build --target mcpb` to produce a single `.mcpb` archive
112
+ - Translating `setup.steps` into MCPB `user_config` + `${user_config.KEY}` env bindings
113
+ - Validating the archive round-trip with `frontmcp mcpb validate`
114
+
115
+ ## Related
116
+
117
+ - See `build-for-mcpb` for the full manifest reference, user_config type resolution, SEA binary packaging, and cross-platform `--merge-from` workflow.
@@ -18,9 +18,7 @@ Use `connectOpenAI()` to get tools formatted for OpenAI's function-calling API.
18
18
 
19
19
  ```typescript
20
20
  // src/openai-integration.ts
21
- import { FrontMcp, App, Tool, ToolContext } from '@frontmcp/sdk';
22
- import { connectOpenAI } from '@frontmcp/sdk';
23
- import { z } from 'zod';
21
+ import { App, connectOpenAI, FrontMcp, Tool, ToolContext, z } from '@frontmcp/sdk';
24
22
 
25
23
  @Tool({
26
24
  name: 'search_docs',
@@ -18,8 +18,7 @@ Spin up an in-memory FrontMCP server from a flat config object using `create()`.
18
18
 
19
19
  ```typescript
20
20
  // src/embedded-server.ts
21
- import { create, tool } from '@frontmcp/sdk';
22
- import { z } from 'zod';
21
+ import { create, tool, z } from '@frontmcp/sdk';
23
22
 
24
23
  async function main() {
25
24
  const server = await create({
@@ -18,8 +18,7 @@ Connect the same FrontMCP server to multiple LLM platforms using platform-specif
18
18
 
19
19
  ```typescript
20
20
  // src/server.ts
21
- import { FrontMcp, App, Tool, ToolContext } from '@frontmcp/sdk';
22
- import { z } from 'zod';
21
+ import { App, FrontMcp, Tool, ToolContext, z } from '@frontmcp/sdk';
23
22
 
24
23
  @Tool({
25
24
  name: 'translate',
@@ -49,7 +48,8 @@ export default TranslateSDK;
49
48
 
50
49
  ```typescript
51
50
  // src/connect-all-platforms.ts
52
- import { connectOpenAI, connectClaude, connectLangChain, connectVercelAI } from '@frontmcp/sdk';
51
+ import { connectClaude, connectLangChain, connectOpenAI, connectVercelAI } from '@frontmcp/sdk';
52
+
53
53
  import TranslateSDK from './server';
54
54
 
55
55
  async function main() {
@@ -18,8 +18,7 @@ Deploy a FrontMCP server to Cloudflare Workers with a minimal configuration.
18
18
 
19
19
  ```typescript
20
20
  // src/server.ts
21
- import { FrontMcp, App, Tool, ToolContext } from '@frontmcp/sdk';
22
- import { z } from 'zod';
21
+ import { App, FrontMcp, Tool, ToolContext, z } from '@frontmcp/sdk';
23
22
 
24
23
  @Tool({
25
24
  name: 'echo',
@@ -24,8 +24,7 @@ cd my-app
24
24
 
25
25
  ```typescript
26
26
  // src/server.ts
27
- import { FrontMcp, App, Tool, ToolContext } from '@frontmcp/sdk';
28
- import { z } from 'zod';
27
+ import { App, FrontMcp, Tool, ToolContext, z } from '@frontmcp/sdk';
29
28
 
30
29
  @Tool({
31
30
  name: 'translate',
@@ -18,8 +18,7 @@ Deploy a FrontMCP server to Cloudflare Workers with KV namespace for session and
18
18
 
19
19
  ```typescript
20
20
  // src/server.ts
21
- import { FrontMcp, App, Tool, ToolContext } from '@frontmcp/sdk';
22
- import { z } from 'zod';
21
+ import { App, FrontMcp, Tool, ToolContext, z } from '@frontmcp/sdk';
23
22
 
24
23
  @Tool({
25
24
  name: 'store_value',
@@ -19,8 +19,7 @@ Create a custom Lambda handler with an explicit API Gateway definition for CORS
19
19
  ```typescript
20
20
  // src/lambda.ts
21
21
  import { createLambdaHandler } from '@frontmcp/adapters/lambda';
22
- import { FrontMcp, App, Tool, ToolContext } from '@frontmcp/sdk';
23
- import { z } from 'zod';
22
+ import { App, FrontMcp, Tool, ToolContext, z } from '@frontmcp/sdk';
24
23
 
25
24
  @Tool({
26
25
  name: 'analyze',
@@ -18,8 +18,7 @@ Deploy a FrontMCP server to Vercel serverless functions with Vercel KV for sessi
18
18
 
19
19
  ```typescript
20
20
  // src/server.ts
21
- import { FrontMcp, App, Tool, ToolContext } from '@frontmcp/sdk';
22
- import { z } from 'zod';
21
+ import { App, FrontMcp, Tool, ToolContext, z } from '@frontmcp/sdk';
23
22
 
24
23
  @Tool({
25
24
  name: 'greet',