@frontmcp/skills 1.3.0 → 1.4.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/README.md +38 -29
- package/catalog/TEMPLATE.md +26 -0
- package/catalog/create-tool/SKILL.md +318 -0
- package/catalog/create-tool/examples/01-basic-class-tool.md +112 -0
- package/catalog/create-tool/examples/02-basic-function-tool.md +80 -0
- package/catalog/create-tool/examples/03-tool-with-zod-shape-output.md +78 -0
- package/catalog/create-tool/examples/04-tool-with-zod-schema-output.md +97 -0
- package/catalog/create-tool/examples/05-tool-with-primitive-output.md +93 -0
- package/catalog/create-tool/examples/06-tool-with-media-output.md +109 -0
- package/catalog/create-tool/examples/08-tool-with-provider-injection.md +110 -0
- package/catalog/create-tool/examples/09-tool-with-multiple-providers.md +107 -0
- package/catalog/create-tool/examples/11-tool-with-fetch.md +94 -0
- package/catalog/create-tool/examples/12-tool-with-fetch-and-retries.md +115 -0
- package/catalog/create-tool/examples/13-tool-with-single-auth-provider.md +85 -0
- package/catalog/create-tool/examples/14-tool-with-multiple-auth-providers.md +105 -0
- package/catalog/create-tool/examples/15-tool-with-credential-vault.md +115 -0
- package/catalog/create-tool/examples/16-tool-with-rate-limit.md +71 -0
- package/catalog/create-tool/examples/17-tool-with-concurrency-and-timeout.md +101 -0
- package/catalog/create-tool/examples/18-tool-with-progress-and-notify.md +96 -0
- package/catalog/create-tool/examples/19-tool-with-elicitation.md +102 -0
- package/catalog/create-tool/examples/20-tool-with-annotations.md +125 -0
- package/catalog/create-tool/examples/21-tool-with-availability-constraints.md +107 -0
- package/catalog/create-tool/examples/22-tool-with-ui-html-template.md +93 -0
- package/catalog/create-tool/examples/23-tool-with-ui-filesource-tsx.md +112 -0
- package/catalog/create-tool/examples/24-tool-with-ui-csp-and-bridge.md +127 -0
- package/catalog/create-tool/examples/25-tool-handing-off-to-job.md +143 -0
- package/catalog/create-tool/examples/26-tool-with-resource-link-output.md +94 -0
- package/catalog/create-tool/examples/27-tool-with-examples-metadata.md +90 -0
- package/catalog/create-tool/references/annotations.md +96 -0
- package/catalog/create-tool/references/auth-providers.md +167 -0
- package/catalog/create-tool/references/availability.md +106 -0
- package/catalog/create-tool/references/decorator-options.md +95 -0
- package/catalog/create-tool/references/derived-types.md +102 -0
- package/catalog/create-tool/references/elicitation.md +128 -0
- package/catalog/create-tool/references/error-handling.md +128 -0
- package/catalog/create-tool/references/execution-context.md +158 -0
- package/catalog/create-tool/references/file-layout.md +96 -0
- package/catalog/create-tool/references/function-style-builder.md +118 -0
- package/catalog/create-tool/references/input-schema.md +141 -0
- package/catalog/create-tool/references/output-schema.md +175 -0
- package/catalog/create-tool/references/quick-start.md +124 -0
- package/catalog/create-tool/references/registration.md +132 -0
- package/catalog/create-tool/references/remote-and-esm.md +68 -0
- package/catalog/create-tool/references/testing.md +59 -0
- package/catalog/create-tool/references/throttling.md +109 -0
- package/catalog/create-tool/references/ui-widgets.md +198 -0
- package/catalog/create-tool/rules/always-define-output-schema.md +77 -0
- package/catalog/create-tool/rules/derive-execute-types.md +57 -0
- package/catalog/create-tool/rules/input-schema-is-raw-shape.md +76 -0
- package/catalog/create-tool/rules/no-toolcontext-generics.md +50 -0
- package/catalog/create-tool/rules/no-try-catch-around-execute.md +79 -0
- package/catalog/create-tool/rules/register-in-app.md +76 -0
- package/catalog/create-tool/rules/snake-case-tool-names.md +45 -0
- package/catalog/create-tool/rules/use-this-fail-for-business-errors.md +75 -0
- package/catalog/create-tool/rules/widget-paths-anchor-with-import-meta-url.md +76 -0
- package/catalog/create-tool/rules/widget-resource-mode-host-detect.md +61 -0
- package/catalog/frontmcp-auth-ui/SKILL.md +146 -0
- package/catalog/frontmcp-auth-ui/examples/custom-auth-ui/login-slot.md +97 -0
- package/catalog/frontmcp-auth-ui/examples/custom-auth-ui/multi-step-auth-extra.md +133 -0
- package/catalog/frontmcp-auth-ui/references/custom-auth-ui.md +162 -0
- package/catalog/frontmcp-authorities/SKILL.md +55 -18
- package/catalog/frontmcp-authorities/references/authority-profiles.md +25 -1
- package/catalog/frontmcp-authorities/references/custom-evaluators.md +1 -1
- package/catalog/frontmcp-authorities/references/rbac-abac-rebac.md +9 -0
- package/catalog/frontmcp-channels/SKILL.md +7 -1
- package/catalog/frontmcp-config/SKILL.md +9 -2
- package/catalog/frontmcp-config/examples/configure-auth/local-credential-vault.md +94 -0
- package/catalog/frontmcp-config/examples/configure-auth/local-secure-store.md +138 -0
- package/catalog/frontmcp-config/examples/configure-auth/remote-oauth-with-vault.md +45 -23
- package/catalog/frontmcp-config/examples/configure-auth-modes/local-behind-tunnel.md +73 -0
- package/catalog/frontmcp-config/examples/configure-auth-modes/local-consent-enforcement.md +87 -0
- package/catalog/frontmcp-config/examples/configure-auth-modes/local-dcr-control.md +67 -0
- package/catalog/frontmcp-config/examples/configure-auth-modes/local-minimal.md +62 -0
- package/catalog/frontmcp-config/examples/configure-auth-modes/local-multi-provider-orchestration.md +93 -0
- package/catalog/frontmcp-config/examples/configure-auth-modes/local-self-signed-tokens.md +18 -20
- package/catalog/frontmcp-config/examples/configure-auth-modes/local-single-operator.md +66 -0
- package/catalog/frontmcp-config/examples/configure-auth-modes/remote-enterprise-oauth.md +37 -23
- package/catalog/frontmcp-config/examples/configure-http/custom-http-routes.md +98 -0
- package/catalog/frontmcp-config/examples/configure-skills-http/audit-log-redis.md +17 -9
- package/catalog/frontmcp-config/references/configure-auth-modes.md +86 -23
- package/catalog/frontmcp-config/references/configure-auth.md +296 -50
- package/catalog/frontmcp-config/references/configure-http.md +149 -15
- package/catalog/frontmcp-deployment/SKILL.md +15 -13
- package/catalog/frontmcp-deployment/references/deploy-manifest-yaml.md +308 -0
- package/catalog/frontmcp-deployment/references/deploy-to-cloudflare-skills-only.md +174 -0
- package/catalog/frontmcp-deployment/references/mcp-client-integration.md +38 -2
- package/catalog/frontmcp-development/SKILL.md +30 -44
- package/catalog/frontmcp-development/references/decorators-guide.md +15 -15
- package/catalog/frontmcp-extensibility/SKILL.md +1 -1
- package/catalog/frontmcp-extensibility/examples/skill-audit-log/verify-chain.md +8 -6
- package/catalog/frontmcp-extensibility/references/skill-audit-log.md +7 -2
- package/catalog/frontmcp-guides/SKILL.md +1 -1
- package/catalog/frontmcp-observability/SKILL.md +1 -1
- package/catalog/frontmcp-production-readiness/SKILL.md +1 -1
- package/catalog/frontmcp-production-readiness/examples/common-checklist/security-hardening.md +3 -2
- package/catalog/frontmcp-setup/SKILL.md +1 -1
- package/catalog/frontmcp-setup/examples/multi-app-composition/per-app-auth-and-isolation.md +7 -4
- package/catalog/frontmcp-setup/references/multi-app-composition.md +6 -5
- package/catalog/frontmcp-testing/SKILL.md +9 -1
- package/catalog/frontmcp-testing/references/test-auth.md +24 -0
- package/catalog/skills-manifest.json +653 -149
- package/package.json +1 -1
- package/src/manifest.d.ts +72 -1
- package/src/manifest.js +4 -1
- package/src/manifest.js.map +1 -1
- package/catalog/frontmcp-development/examples/create-tool/basic-class-tool.md +0 -80
- package/catalog/frontmcp-development/examples/create-tool/tool-with-di-and-errors.md +0 -132
- package/catalog/frontmcp-development/examples/create-tool/tool-with-rate-limiting-and-progress.md +0 -110
- package/catalog/frontmcp-development/examples/create-tool-annotations/destructive-delete-tool.md +0 -92
- package/catalog/frontmcp-development/examples/create-tool-annotations/readonly-query-tool.md +0 -59
- package/catalog/frontmcp-development/examples/create-tool-output-schema-types/primitive-and-media-outputs.md +0 -101
- package/catalog/frontmcp-development/examples/create-tool-output-schema-types/zod-raw-shape-output.md +0 -62
- package/catalog/frontmcp-development/examples/create-tool-output-schema-types/zod-schema-advanced-output.md +0 -101
- package/catalog/frontmcp-development/references/create-tool-annotations.md +0 -48
- package/catalog/frontmcp-development/references/create-tool-output-schema-types.md +0 -71
- package/catalog/frontmcp-development/references/create-tool.md +0 -806
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: deploy-to-cloudflare-skills-only
|
|
3
|
+
description: Deploy a FrontMCP server to Cloudflare Workers using the v1.3 skills-only model — OpenAPI as capability inventory, AgentScript with namespaced bindings, four meta-tools, hot-reload via GitHub Action and a signed-bundle webhook
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Deploy to Cloudflare Workers (Skills-Only Model)
|
|
7
|
+
|
|
8
|
+
The v1.3 Cloudflare Worker target hosts FrontMCP as a control plane where the MCP surface is just **four meta-tools** (`searchSkills`, `searchKnowledge`, `describe`, `execute`) and every capability is reached through a skill. OpenAPI specs ship to the project but are NEVER directly exposed — they are the capability inventory, classified by HTTP semantics into resources / tools, with auto-derived `notifications/resources/*` events.
|
|
9
|
+
|
|
10
|
+
For the conceptual picture, see [Skills-Only Deployment](https://docs.agentfront.dev/frontmcp/features/skills-only-deployment).
|
|
11
|
+
For the older Express-to-Workers adapter, see [`deploy-to-cloudflare.md`](./deploy-to-cloudflare.md).
|
|
12
|
+
|
|
13
|
+
## When to Use This Skill
|
|
14
|
+
|
|
15
|
+
### Must Use
|
|
16
|
+
|
|
17
|
+
- Deploying a FrontMCP server using the v1.3 skills-only model on Cloudflare
|
|
18
|
+
- Setting up GitHub-Action-driven hot-reload of skills + OpenAPI specs without a wrangler redeploy on every push
|
|
19
|
+
- Configuring AgentScript with namespaced OpenAPI bindings (`acme.getUser({...})`)
|
|
20
|
+
|
|
21
|
+
### Recommended
|
|
22
|
+
|
|
23
|
+
- Standing up the first hosted FrontMCP runtime
|
|
24
|
+
- Migrating from the flat-tools model to skills-only
|
|
25
|
+
|
|
26
|
+
### Skip When
|
|
27
|
+
|
|
28
|
+
- You want a long-running Node process — use `deploy-to-node`
|
|
29
|
+
- You need the full `@enclave-vm/core` CodeCall VM (pause / rerun) — host on Node; the Worker uses AST-preflight only
|
|
30
|
+
- You're shipping `scripts/` skill blobs (Anthropic Agent Skills spec) — that ships in v1.7
|
|
31
|
+
|
|
32
|
+
## Worker Entry File
|
|
33
|
+
|
|
34
|
+
```ts
|
|
35
|
+
// worker.ts (~10 lines)
|
|
36
|
+
import { createWorker } from '@frontmcp/worker';
|
|
37
|
+
|
|
38
|
+
import deployBundle from './frontmcp.deploy.bundle.js'; // emitted by the GH Action
|
|
39
|
+
|
|
40
|
+
const { handler, durableObjects } = createWorker({
|
|
41
|
+
bundle: deployBundle,
|
|
42
|
+
env: 'production',
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
export default handler;
|
|
46
|
+
export const { SessionDO, EventStoreDO, BundleDO } = durableObjects;
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
`createWorker` parses the manifest, applies the `environments.production` overlay, verifies the signed envelope against `TRUSTED_KEYS`, and assembles the FrontMCP runtime.
|
|
50
|
+
|
|
51
|
+
## Storage Layout (Opinionated Default)
|
|
52
|
+
|
|
53
|
+
| Binding | Class / kind | Purpose |
|
|
54
|
+
| -------------- | ------------------- | ----------------------------------------------------------- |
|
|
55
|
+
| `SESSIONS` | DO (`SessionDO`) | MCP session store; survives Worker restarts |
|
|
56
|
+
| `EVENTS` | DO (`EventStoreDO`) | Event store for Streamable HTTP + SSE resumability |
|
|
57
|
+
| `BUNDLE` | DO (`BundleDO`) | Last-good envelope + active classifications (hot-swappable) |
|
|
58
|
+
| `AUDIT` | D1 | Hash-chained skill action audit log (v1.2 audit spec) |
|
|
59
|
+
| `BUNDLE_CACHE` | KV | Fallback bundle reused if a resync push fails |
|
|
60
|
+
| `REPLAY_NONCE` | KV | Replay-guard nonce dedupe (`signing.replay.windowSeconds`) |
|
|
61
|
+
| `SKILL_DATA` | R2 | Large skill `data/` blobs |
|
|
62
|
+
|
|
63
|
+
## Hot-Reload Cycle
|
|
64
|
+
|
|
65
|
+
```text
|
|
66
|
+
GitHub push → frontmcp/deploy-action@v1
|
|
67
|
+
1. Parse + cross-validate frontmcp.deploy.yaml
|
|
68
|
+
2. Apply environments.<env> overlay
|
|
69
|
+
3. Walk skills/; run the markdown op-reference harvester
|
|
70
|
+
4. Run the OpenAPI → MCP classifier
|
|
71
|
+
5. Inline & content-address artifacts
|
|
72
|
+
6. Sign envelope (Ed25519 by default)
|
|
73
|
+
7. POST → worker/_frontmcp/resync
|
|
74
|
+
↓
|
|
75
|
+
Worker:
|
|
76
|
+
- Verify signature against signing.trustRoots[].publicKeySecret
|
|
77
|
+
- Replay-guard via REPLAY_NONCE KV
|
|
78
|
+
- Diff: structural change (DO classes, bindings) → require redeploy
|
|
79
|
+
- Otherwise: atomic swap of skill + classification registries
|
|
80
|
+
- Emit notifications/{skills,tools,resources,prompts}/list_changed
|
|
81
|
+
- Persist envelope into BUNDLE_CACHE KV
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Day-to-day skill / OpenAPI edits are pure hot-reload. `wrangler deploy` is only needed for structural changes.
|
|
85
|
+
|
|
86
|
+
## Isolation Strategy
|
|
87
|
+
|
|
88
|
+
`codecall:execute` runs agent-authored AgentScript inside the Worker isolate. Two layers:
|
|
89
|
+
|
|
90
|
+
1. **AST preflight on every call** via `@enclave-vm/ast` (pure-JS, Acorn-based, Worker-safe). Rejects `eval`, `Function`, `process`, `require`, dynamic `import`, raw `fetch`, prototype-walks, etc. before the script runs.
|
|
91
|
+
2. **Frozen capability scope.** Script executes with `new Function('skills', 'ctx', code)` against a frozen object that holds only the active skills' generated namespaces + `callTool` / `getTool` / `mcpLog` / `mcpNotify`.
|
|
92
|
+
|
|
93
|
+
`@enclave-vm/core` (full VM) needs `node:vm` and is NOT Worker-safe — the Worker target uses AST-preflight + frozen scope only.
|
|
94
|
+
|
|
95
|
+
## Auth at the Edge
|
|
96
|
+
|
|
97
|
+
```yaml
|
|
98
|
+
auth:
|
|
99
|
+
provider: frontegg
|
|
100
|
+
frontegg:
|
|
101
|
+
tenantResolver: subdomain
|
|
102
|
+
audience: acme-mcp
|
|
103
|
+
issuerSecret: FRONTEGG_ISSUER_URL
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
Frontegg JWT verification runs at the Worker edge — no upstream hop. Other providers (`oauth`, `apiKey`, `none`) share the same shape.
|
|
107
|
+
|
|
108
|
+
## Secrets
|
|
109
|
+
|
|
110
|
+
Names-only in the manifest:
|
|
111
|
+
|
|
112
|
+
```yaml
|
|
113
|
+
secrets:
|
|
114
|
+
- { name: TRUSTED_PUBKEY_PROD, required: true, description: 'Signing trust root (PEM)' }
|
|
115
|
+
- { name: FRONTEGG_ISSUER_URL, required: true }
|
|
116
|
+
- { name: ACME_API_TOKEN, required: true }
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
Bind values out-of-band:
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
wrangler secret put TRUSTED_PUBKEY_PROD
|
|
123
|
+
wrangler secret put FRONTEGG_ISSUER_URL
|
|
124
|
+
wrangler secret put ACME_API_TOKEN
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
The cross-validator REJECTS any manifest that references a secret name not declared in `secrets[]`.
|
|
128
|
+
|
|
129
|
+
## Sample `.github/workflows/deploy.yml`
|
|
130
|
+
|
|
131
|
+
```yaml
|
|
132
|
+
name: Deploy
|
|
133
|
+
on:
|
|
134
|
+
push: { branches: [main] }
|
|
135
|
+
jobs:
|
|
136
|
+
deploy:
|
|
137
|
+
runs-on: ubuntu-latest
|
|
138
|
+
permissions: { contents: read }
|
|
139
|
+
steps:
|
|
140
|
+
- uses: actions/checkout@v6
|
|
141
|
+
- uses: frontmcp/deploy-action@v1
|
|
142
|
+
with:
|
|
143
|
+
environment: production
|
|
144
|
+
signingKey: ${{ secrets.FRONTMCP_SIGNING_KEY }}
|
|
145
|
+
secrets: |
|
|
146
|
+
TRUSTED_PUBKEY_PROD
|
|
147
|
+
FRONTEGG_ISSUER_URL
|
|
148
|
+
ACME_API_TOKEN
|
|
149
|
+
env:
|
|
150
|
+
TRUSTED_PUBKEY_PROD: ${{ secrets.TRUSTED_PUBKEY_PROD }}
|
|
151
|
+
FRONTEGG_ISSUER_URL: ${{ secrets.FRONTEGG_ISSUER_URL }}
|
|
152
|
+
ACME_API_TOKEN: ${{ secrets.ACME_API_TOKEN }}
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
Action outputs:
|
|
156
|
+
|
|
157
|
+
- `deployment-url` — the Worker URL
|
|
158
|
+
- `bundle-sha256` — content-addressed envelope digest (pin in release notes)
|
|
159
|
+
|
|
160
|
+
## Common Mistakes
|
|
161
|
+
|
|
162
|
+
- **Embedding secrets in `wrangler.toml` or the deploy YAML.** The cross-validator + schema both reject inline secret values. Always `wrangler secret put`.
|
|
163
|
+
- **Using `wrangler deploy` for every push.** Once the Worker has its DO + KV + D1 bindings, day-to-day skill changes flow through `POST /_frontmcp/resync`. Only structural changes need a redeploy.
|
|
164
|
+
- **Forgetting to declare `signing.replay.nonceKv`.** The cross-validator requires the value to match a binding in `bindings.kvNamespaces[]`. Without it the Worker can't dedupe replays.
|
|
165
|
+
- **Mixing `acme-api` as both a spec id AND an AgentScript namespace.** Dashes aren't valid JS identifiers — add `bindingName: acmeApi` on the spec entry, or rename the spec.
|
|
166
|
+
- **Assuming `notifications/resources/updated` carries no URI.** It does — `notifications/resources/list_changed` is the one with empty params.
|
|
167
|
+
|
|
168
|
+
## See Also
|
|
169
|
+
|
|
170
|
+
- `references/deploy-manifest-yaml.md` — full `frontmcp.deploy.yaml` schema reference
|
|
171
|
+
- `references/deploy-to-cloudflare.md` — the older Express-to-Workers adapter path
|
|
172
|
+
- `references/wrangler-config.md` — wrangler.toml checklist
|
|
173
|
+
- Docs: https://docs.agentfront.dev/frontmcp/deployment/cloudflare-worker
|
|
174
|
+
- Docs: https://docs.agentfront.dev/frontmcp/features/skills-only-deployment
|
|
@@ -61,6 +61,16 @@ When building a FrontMCP server with a coding agent (Claude Code, Cursor, Windsu
|
|
|
61
61
|
```
|
|
62
62
|
3. Code and iterate — every file save triggers a server reload
|
|
63
63
|
|
|
64
|
+
> **The endpoint path must match the `url`.** `frontmcp dev` serves the MCP
|
|
65
|
+
> endpoint at `transport.http.path` from `frontmcp.config.ts` (default `/`). The
|
|
66
|
+
> `url` above ends in `/mcp`, so set `transport: { default: 'http', http: { path: '/mcp' } }`
|
|
67
|
+
> in `frontmcp.config.ts` — otherwise the client hits `/mcp` while the server
|
|
68
|
+
> listens on `/` and every request 404s (issue #446). `dev` honors the configured
|
|
69
|
+
> path (it propagates it to the server via `FRONTMCP_HTTP_ENTRY_PATH`), and the
|
|
70
|
+
> generated `clients.*.url` derives from the same `transport.http.path`, so
|
|
71
|
+
> `frontmcp eject` and `dev` stay in sync. (A hard-coded
|
|
72
|
+
> `@FrontMcp({ http: { entryPath } })` in metadata wins over both — keep them aligned.)
|
|
73
|
+
|
|
64
74
|
### Why HTTP for development (not stdio)
|
|
65
75
|
|
|
66
76
|
- **Hot reload:** Server restarts on file change (~200ms), client reconnects automatically
|
|
@@ -109,6 +119,8 @@ The most common transport. The MCP client spawns your server as a child process
|
|
|
109
119
|
- All logs are automatically redirected to stderr and `~/.frontmcp/logs/`
|
|
110
120
|
- stdout contains ONLY MCP JSON-RPC protocol messages
|
|
111
121
|
- One client per process (no multiplexing)
|
|
122
|
+
- **Stdio binds no TCP port** — the HTTP server is disabled, so multiple stdio
|
|
123
|
+
instances of the same server run without an `EADDRINUSE` conflict
|
|
112
124
|
|
|
113
125
|
### npx (published npm package)
|
|
114
126
|
|
|
@@ -139,19 +151,43 @@ The most common transport. The MCP client spawns your server as a child process
|
|
|
139
151
|
}
|
|
140
152
|
```
|
|
141
153
|
|
|
142
|
-
### Node.js bundle
|
|
154
|
+
### Node.js CLI bundle
|
|
155
|
+
|
|
156
|
+
Run the **CLI bundle** (`frontmcp build --target cli`) — it parses `--stdio`
|
|
157
|
+
itself before any framework initialization:
|
|
143
158
|
|
|
144
159
|
```json
|
|
145
160
|
{
|
|
146
161
|
"mcpServers": {
|
|
147
162
|
"my-server": {
|
|
148
163
|
"command": "node",
|
|
149
|
-
"args": ["/path/to/my-server.bundle.js", "--stdio"]
|
|
164
|
+
"args": ["/path/to/my-server-cli.bundle.js", "--stdio"]
|
|
150
165
|
}
|
|
151
166
|
}
|
|
152
167
|
}
|
|
153
168
|
```
|
|
154
169
|
|
|
170
|
+
### Server runner (`--target node`)
|
|
171
|
+
|
|
172
|
+
`frontmcp build --target node` emits a runner at `dist/node/<name>`. Pass
|
|
173
|
+
`--stdio` to serve over stdin/stdout instead of HTTP — the runner sets
|
|
174
|
+
`FRONTMCP_STDIO=1`, so the server connects over stdio and binds no port:
|
|
175
|
+
|
|
176
|
+
```json
|
|
177
|
+
{
|
|
178
|
+
"mcpServers": {
|
|
179
|
+
"my-server": {
|
|
180
|
+
"command": "/path/to/dist/node/my-server",
|
|
181
|
+
"args": ["--stdio"]
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
> Do not run the raw `--target node` bundle as `node dist/node/my-server.bundle.js --stdio`
|
|
188
|
+
> — that bundle is your `@FrontMcp` server module and starts the HTTP server on
|
|
189
|
+
> import. Use the runner above, or set `FRONTMCP_STDIO=1` before the bundle loads.
|
|
190
|
+
|
|
155
191
|
## HTTP Transport
|
|
156
192
|
|
|
157
193
|
Connect to a running FrontMCP HTTP server. The server must be started separately.
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: frontmcp-development
|
|
3
|
-
description: 'Use when
|
|
3
|
+
description: 'Use when building any FrontMCP server component other than a tool (for tools, use create-tool). Covers @Resource static resources and parameterized URI templates; @Prompt reusable prompts (RAG, multi-turn); @Provider singleton dependency-injection providers (database pools, API clients); @Agent autonomous LLM agents (Anthropic, OpenAI) and swarms; @Job background jobs (retry, progress, permissions) and @Workflow DAG pipelines; framework adapters and the OpenAPI adapter (turn OpenAPI 3.x specs into MCP tools with auth, polling, transforms); plugins, plugin lifecycle hooks (before / after / around / stage), and the official plugins; instruction-only skills and skills that reference tools; and the hierarchical decorator system from @FrontMcp down to @App. Triggers: create a resource, build a prompt, write a provider, add an agent, job, workflow, plugin, adapter, or OpenAPI integration.'
|
|
4
|
+
when_to_use: |
|
|
5
|
+
Trigger when creating or editing a non-tool FrontMCP component: a
|
|
6
|
+
*.resource.ts, *.prompt.ts, *.provider.ts, *.agent.ts, *.job.ts,
|
|
7
|
+
*.workflow.ts, *.plugin.ts, or *.skill.ts file, or adding @Resource, @Prompt,
|
|
8
|
+
@Provider, @Agent, @Job, @Workflow, a plugin, an adapter, or an OpenAPI
|
|
9
|
+
integration. For tools (*.tool.ts) use create-tool instead.
|
|
10
|
+
paths: '**/*.resource.ts, **/*.prompt.ts, **/*.provider.ts, **/*.agent.ts, **/*.job.ts, **/*.workflow.ts, **/*.plugin.ts, **/*.skill.ts'
|
|
4
11
|
tags: [router, development, tools, resources, prompts, agents, skills, guide]
|
|
5
12
|
category: development
|
|
6
13
|
targets: [all]
|
|
@@ -55,31 +62,29 @@ This is a router skill. The "steps" here are how to choose the right reference (
|
|
|
55
62
|
|
|
56
63
|
## Scenario Routing Table
|
|
57
64
|
|
|
58
|
-
| Scenario
|
|
59
|
-
|
|
|
60
|
-
| Expose an executable action that AI clients can call
|
|
61
|
-
| Expose read-only data via a URI
|
|
62
|
-
| Create a reusable conversation template or system prompt
|
|
63
|
-
| Build an autonomous AI loop that orchestrates tools
|
|
64
|
-
| Register shared services or configuration via DI
|
|
65
|
-
| Run a background task with progress and retries
|
|
66
|
-
| Chain multiple jobs into a sequential pipeline
|
|
67
|
-
| Write instruction-only AI guidance (no code execution)
|
|
68
|
-
| Write AI guidance that also orchestrates tools
|
|
69
|
-
| Look up any decorator signature or option
|
|
70
|
-
| Overview of all official adapters
|
|
71
|
-
| Integrate an external API via OpenAPI spec
|
|
72
|
-
| Use official plugins (caching, remember, feature flags)
|
|
73
|
-
| Connect to an external data source via a custom adapter
|
|
74
|
-
| Configure LLM settings for an agent component
|
|
75
|
-
| Add will/did/around lifecycle hooks to a plugin
|
|
76
|
-
| Annotate tools with client hints for AI clients | `create-tool-annotations` | Add MCP tool annotations for client hints |
|
|
77
|
-
| Define typed output schemas for tool responses | `create-tool-output-schema-types` | Define typed output schemas for tools |
|
|
65
|
+
| Scenario | Reference | Description |
|
|
66
|
+
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
67
|
+
| Expose an executable action that AI clients can call (full surface: schemas, DI, errors, throttling, auth, availability, elicitation, UI widgets, annotations, examples metadata, registration) | **[`create-tool` (top-level skill)](../create-tool/SKILL.md)** | Single source of truth for everything inside `@Tool({...})`. Subsumes the former `create-tool`, `create-tool-annotations`, `create-tool-output-schema-types`, and `create-tool-ui` references. |
|
|
68
|
+
| Expose read-only data via a URI | `create-resource` | Static resources or URI template resources for dynamic data |
|
|
69
|
+
| Create a reusable conversation template or system prompt | `create-prompt` | Prompt entries with arguments and multi-turn message sequences |
|
|
70
|
+
| Build an autonomous AI loop that orchestrates tools | `create-agent` | Agent entries with LLM config, inner tools, and swarm handoff |
|
|
71
|
+
| Register shared services or configuration via DI | `create-provider` | Dependency injection tokens, lifecycle hooks, factory providers |
|
|
72
|
+
| Run a background task with progress and retries | `create-job` | Job entries with attempt tracking, retry config, and progress |
|
|
73
|
+
| Chain multiple jobs into a sequential pipeline | `create-workflow` | Workflow entries that compose jobs with data passing |
|
|
74
|
+
| Write instruction-only AI guidance (no code execution) | `create-skill` | Skill entries with markdown instructions from files, strings, or URLs |
|
|
75
|
+
| Write AI guidance that also orchestrates tools | `create-skill-with-tools` | Skill entries that combine instructions with registered tools |
|
|
76
|
+
| Look up any decorator signature or option | `decorators-guide` | Complete reference for @Tool, @Resource, @Prompt, @Agent, @App, @FrontMcp, and more |
|
|
77
|
+
| Overview of all official adapters | `official-adapters` | Router to all adapter types; adapter vs plugin comparison |
|
|
78
|
+
| Integrate an external API via OpenAPI spec | `openapi-adapter` | OpenapiAdapter with auth, polling, filtering, transforms, format resolution, $ref security |
|
|
79
|
+
| Use official plugins (caching, remember, feature flags) | `official-plugins` | Built-in plugins for caching, session memory, approval, and feature flags (dashboard is beta) |
|
|
80
|
+
| Connect to an external data source via a custom adapter | `create-adapter` | Create custom adapters for external data sources |
|
|
81
|
+
| Configure LLM settings for an agent component | `create-agent-llm-config` | Configure LLM settings for agent components |
|
|
82
|
+
| Add will/did/around lifecycle hooks to a plugin | `create-plugin-hooks` | Add lifecycle hooks to plugins (will/did/around) |
|
|
78
83
|
|
|
79
84
|
## Recommended Reading Order
|
|
80
85
|
|
|
81
86
|
1. **`decorators-guide`** — Start here to understand the full decorator landscape
|
|
82
|
-
2.
|
|
87
|
+
2. **[`create-tool`](../create-tool/SKILL.md)** — The most common building block (top-level skill — covers schemas, DI, errors, throttling, auth, UI widgets, annotations); learn tools first
|
|
83
88
|
3. **`create-resource`** — Expose data alongside tools
|
|
84
89
|
4. **`create-prompt`** — Add reusable conversation templates
|
|
85
90
|
5. **`create-provider`** — Share services across tools and resources via DI
|
|
@@ -225,28 +230,9 @@ Each reference has matching examples under [`examples/<reference>/`](./examples/
|
|
|
225
230
|
| [`directory-based-skill`](./examples/create-skill/directory-based-skill.md) | Advanced | A skill loaded from a directory structure with SKILL.md frontmatter, plus file-based and URL-based instruction sources. |
|
|
226
231
|
| [`parameterized-skill`](./examples/create-skill/parameterized-skill.md) | Intermediate | A skill with customizable parameters, usage examples for AI guidance, and controlled visibility. |
|
|
227
232
|
|
|
228
|
-
### `create-tool-
|
|
233
|
+
### `create-tool` (migrated to top-level skill)
|
|
229
234
|
|
|
230
|
-
|
|
231
|
-
| ------------------------------------------------------------------------------------------ | ------------ | ------------------------------------------------------------------------------------------------------------------------------- |
|
|
232
|
-
| [`destructive-delete-tool`](./examples/create-tool-annotations/destructive-delete-tool.md) | Intermediate | Demonstrates annotating a tool that deletes data, enabling MCP clients to warn users before execution. |
|
|
233
|
-
| [`readonly-query-tool`](./examples/create-tool-annotations/readonly-query-tool.md) | Basic | Demonstrates annotating a tool that only reads data, signaling to MCP clients that it has no side effects and is safe to retry. |
|
|
234
|
-
|
|
235
|
-
### `create-tool-output-schema-types`
|
|
236
|
-
|
|
237
|
-
| Example | Level | Description |
|
|
238
|
-
| ---------------------------------------------------------------------------------------------------------- | ------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
239
|
-
| [`primitive-and-media-outputs`](./examples/create-tool-output-schema-types/primitive-and-media-outputs.md) | Intermediate | Demonstrates using primitive string literals and media types as `outputSchema` for tools that return plain text, images, or multi-content arrays. |
|
|
240
|
-
| [`zod-raw-shape-output`](./examples/create-tool-output-schema-types/zod-raw-shape-output.md) | Basic | Demonstrates the recommended approach of using a Zod raw shape as `outputSchema` for structured, validated JSON output. |
|
|
241
|
-
| [`zod-schema-advanced-output`](./examples/create-tool-output-schema-types/zod-schema-advanced-output.md) | Advanced | Demonstrates using full Zod schema objects (not raw shapes) as `outputSchema`, including `z.object()`, `z.array()`, `z.union()`, and `z.discriminatedUnion()`. |
|
|
242
|
-
|
|
243
|
-
### `create-tool`
|
|
244
|
-
|
|
245
|
-
| Example | Level | Description |
|
|
246
|
-
| -------------------------------------------------------------------------------------------------------- | ------------ | -------------------------------------------------------------------------------------------------------------- |
|
|
247
|
-
| [`basic-class-tool`](./examples/create-tool/basic-class-tool.md) | Basic | A minimal tool using the class-based pattern with Zod input validation and output schema. |
|
|
248
|
-
| [`tool-with-di-and-errors`](./examples/create-tool/tool-with-di-and-errors.md) | Intermediate | A tool that resolves a database service via DI and uses `this.fail()` for business-logic errors. |
|
|
249
|
-
| [`tool-with-rate-limiting-and-progress`](./examples/create-tool/tool-with-rate-limiting-and-progress.md) | Advanced | A batch processing tool that uses rate limiting, concurrency control, progress notifications, and annotations. |
|
|
235
|
+
The full `@Tool({...})` surface — including the former `create-tool-annotations`, `create-tool-output-schema-types`, and `create-tool-ui` references — now lives in the top-level [`create-tool`](../create-tool/SKILL.md) skill. See its [`examples/`](../create-tool/examples/) directory for 25 combination examples covering schemas, DI, errors, throttling, auth, availability, elicitation, UI widgets, annotations, examples metadata, and job hand-off.
|
|
250
236
|
|
|
251
237
|
### `create-workflow`
|
|
252
238
|
|
|
@@ -299,4 +285,4 @@ when a server has been configured to host this skill.
|
|
|
299
285
|
## Reference
|
|
300
286
|
|
|
301
287
|
- [FrontMCP Overview](https://docs.agentfront.dev/frontmcp/fundamentals/overview)
|
|
302
|
-
- Related skills: `create-tool
|
|
288
|
+
- Related skills: [`create-tool`](../create-tool/SKILL.md) (top-level), `create-resource`, `create-prompt`, `create-agent`, `create-provider`, `create-job`, `create-workflow`, `create-skill`, `create-skill-with-tools`, `decorators-guide`, `official-adapters`, `openapi-adapter`, `official-plugins`
|
|
@@ -156,21 +156,21 @@ class AnalyticsApp {}
|
|
|
156
156
|
|
|
157
157
|
**Key fields:**
|
|
158
158
|
|
|
159
|
-
| Field | Description
|
|
160
|
-
| -------------------- |
|
|
161
|
-
| `name` | Tool name (used in MCP protocol, snake_case)
|
|
162
|
-
| `description` | Human-readable description for the LLM
|
|
163
|
-
| `inputSchema` | Zod raw shape defining input parameters
|
|
164
|
-
| `outputSchema?` | Output type: Zod schema, `'string'`, `'image'`, `'audio'`, etc.
|
|
165
|
-
| `annotations?` | MCP tool annotations (`readOnlyHint`, `destructiveHint`, etc.)
|
|
166
|
-
| `tags?` | Categorization tags for filtering
|
|
167
|
-
| `hideFromDiscovery?` | Hide from `tools/list` (still callable directly)
|
|
168
|
-
| `examples?` | Usage examples: `[{ description, input, output? }]`
|
|
169
|
-
| `authProviders?` | Per-tool auth providers: `['
|
|
170
|
-
| `rateLimit?` | Rate limiting: `{ maxRequests, windowMs, partitionBy }`
|
|
171
|
-
| `concurrency?` | Concurrency control: `{ maxConcurrent }`
|
|
172
|
-
| `timeout?` | Execution timeout: `{ executeMs }`
|
|
173
|
-
| `ui?` | UI widget configuration for tool rendering
|
|
159
|
+
| Field | Description |
|
|
160
|
+
| -------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
161
|
+
| `name` | Tool name (used in MCP protocol, snake_case) |
|
|
162
|
+
| `description` | Human-readable description for the LLM |
|
|
163
|
+
| `inputSchema` | Zod raw shape defining input parameters |
|
|
164
|
+
| `outputSchema?` | Output type: Zod schema, `'string'`, `'image'`, `'audio'`, etc. |
|
|
165
|
+
| `annotations?` | MCP tool annotations (`readOnlyHint`, `destructiveHint`, etc.) |
|
|
166
|
+
| `tags?` | Categorization tags for filtering |
|
|
167
|
+
| `hideFromDiscovery?` | Hide from `tools/list` (still callable directly) |
|
|
168
|
+
| `examples?` | Usage examples: `[{ description, input, output? }]` |
|
|
169
|
+
| `authProviders?` | Per-tool auth providers: `['github']` or `[{ name, required?, scopes?, alias? }]` (default `required: true` — a missing required credential aborts the call before `execute()` with `-32001`; `scopes` feed PRM `scopes_supported`) |
|
|
170
|
+
| `rateLimit?` | Rate limiting: `{ maxRequests, windowMs, partitionBy }` |
|
|
171
|
+
| `concurrency?` | Concurrency control: `{ maxConcurrent }` |
|
|
172
|
+
| `timeout?` | Execution timeout: `{ executeMs }` |
|
|
173
|
+
| `ui?` | UI widget configuration for tool rendering |
|
|
174
174
|
|
|
175
175
|
```typescript
|
|
176
176
|
import { Tool, ToolContext, z } from '@frontmcp/sdk';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: frontmcp-extensibility
|
|
3
|
-
description: '
|
|
3
|
+
description: 'Use when extending FrontMCP beyond the core SDK by integrating external npm packages, libraries, or third-party services into providers and tools. Covers VectoriaDB for in-memory semantic and vector search (ML-based embeddings or TF-IDF keyword engines, with persistence) and the tamper-evident, hash-chained skill audit log (pluggable signer and store, with chain verification). Triggers: add semantic search, vector search, embeddings, similarity search, recommendations, ML features, audit logging, or integrate an external library, database, or API beyond the built-in SDK.'
|
|
4
4
|
tags: [extensibility, vectoriadb, search, integration, npm, provider, external-services]
|
|
5
5
|
category: extensibility
|
|
6
6
|
targets: [all]
|
|
@@ -20,14 +20,16 @@ Verify a stored chain offline using verifyChain and the bundle-signing key regis
|
|
|
20
20
|
```typescript
|
|
21
21
|
// scripts/verify-audit-chain.ts
|
|
22
22
|
import { defaultAuditSignatureVerifier, StorageAdapterAuditStore, verifyChain } from '@frontmcp/adapters/skills';
|
|
23
|
-
import {
|
|
23
|
+
import { createStorage } from '@frontmcp/utils';
|
|
24
24
|
|
|
25
25
|
async function main() {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
26
|
+
// createStorage() returns a RootStorage, which is a StorageAdapter.
|
|
27
|
+
const storage = await createStorage({
|
|
28
|
+
type: 'redis',
|
|
29
|
+
redis: {
|
|
30
|
+
config: { host: process.env.REDIS_HOST!, port: 6379 },
|
|
31
|
+
keyPrefix: 'mcp:skill-audit:',
|
|
32
|
+
},
|
|
31
33
|
});
|
|
32
34
|
|
|
33
35
|
const store = new StorageAdapterAuditStore(storage);
|
|
@@ -124,10 +124,15 @@ const signer = new Rs256AuditSigner(privateJwk, 'bundle-signing-2026-01');
|
|
|
124
124
|
|
|
125
125
|
```typescript
|
|
126
126
|
import { StorageAdapterAuditStore } from '@frontmcp/adapters/skills';
|
|
127
|
-
import {
|
|
127
|
+
import { createStorage } from '@frontmcp/utils';
|
|
128
128
|
|
|
129
|
-
|
|
129
|
+
// createStorage() returns a RootStorage, which is a StorageAdapter.
|
|
130
|
+
const storage = await createStorage({ type: 'redis', redis: { config: { host: 'localhost', port: 6379 } } });
|
|
130
131
|
const store = new StorageAdapterAuditStore(storage);
|
|
132
|
+
|
|
133
|
+
// Or construct a concrete adapter directly:
|
|
134
|
+
// import { RedisStorageAdapter } from '@frontmcp/utils';
|
|
135
|
+
// const store = new StorageAdapterAuditStore(new RedisStorageAdapter({ config: { host: 'localhost', port: 6379 } }));
|
|
131
136
|
```
|
|
132
137
|
|
|
133
138
|
A custom store implements:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: frontmcp-guides
|
|
3
|
-
description: 'Tutorials,
|
|
3
|
+
description: 'Tutorials, end-to-end walkthroughs, and complete reference projects for FrontMCP. Use when you want a getting-started guide, a full worked example, or to learn best practices by following a step-by-step build rather than a single API reference. Includes a beginner weather-API server (tool plus static resource, Zod schemas, E2E tests), an authenticated task manager (CRUD tools, Redis storage, OAuth, Vercel deploy, authenticated E2E tests), and a multi-app knowledge base (vector search, semantic resources, an AI research agent, audit logging). Triggers: tutorial, walkthrough, how do I build, getting started, end-to-end example, sample project, learn FrontMCP, full app example.'
|
|
4
4
|
tags: [guides, examples, best-practices, architecture, walkthrough, end-to-end]
|
|
5
5
|
category: guides
|
|
6
6
|
targets: [all]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: frontmcp-observability
|
|
3
|
-
description: 'Use when
|
|
3
|
+
description: 'Use when adding tracing, structured logging, metrics, or monitoring to a FrontMCP server. Covers zero-config OpenTelemetry distributed tracing across all flows; the this.telemetry API for custom spans, events, and attributes in tools, plugins, agents, and skills; structured JSON logging with trace correlation and configurable sinks (Winston, Pino, stdout); the off-by-default /metrics endpoint (process and framework metrics, Prometheus-compatible); vendor integrations (Coralogix, Datadog, Logz.io, Grafana Cloud, or any OTLP backend); and testing spans, log correlation, and instrumentation. Triggers: observability, telemetry, tracing, logging, monitoring, OpenTelemetry, OTel, spans, metrics, Prometheus, Datadog, Coralogix, Logz.io, Grafana, Winston, Pino.'
|
|
4
4
|
tags: [router, observability, telemetry, tracing, logging, monitoring, opentelemetry, otel, spans]
|
|
5
5
|
category: observability
|
|
6
6
|
targets: [all]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: frontmcp-production-readiness
|
|
3
|
-
description: 'Pre-production audit and
|
|
3
|
+
description: 'Pre-production audit, hardening, and go-live checklists for FrontMCP servers. Use before shipping to verify security hardening, performance, reliability, and observability, and for target-specific production checklists: Node server (Docker, graceful shutdown, Redis session scaling), Vercel and edge (cold-start, stateless design), AWS Lambda (cold start, scaling, monitoring), Cloudflare Workers (KV, Durable Objects, runtime limits), CLI binary and local daemon (stdio and socket transport), browser SDK bundle, and embedded npm SDK. Also configuring /healthz and /readyz health and readiness endpoints with custom probes, and distributed high-availability (multi-pod heartbeat, session takeover, notification relay). Triggers: production ready, security audit, hardening, performance check, production checklist, go live, pre-launch review.'
|
|
4
4
|
tags: [production, security, performance, reliability, observability, audit, best-practices]
|
|
5
5
|
category: production
|
|
6
6
|
targets: [all]
|
package/catalog/frontmcp-production-readiness/examples/common-checklist/security-hardening.md
CHANGED
|
@@ -105,7 +105,7 @@ import {
|
|
|
105
105
|
SkillAuditWriterToken,
|
|
106
106
|
StorageAdapterAuditStore,
|
|
107
107
|
} from '@frontmcp/adapters/skills';
|
|
108
|
-
import {
|
|
108
|
+
import { createStorage } from '@frontmcp/utils';
|
|
109
109
|
|
|
110
110
|
// 1. Audit subsystem
|
|
111
111
|
//
|
|
@@ -127,8 +127,9 @@ export const auditSigner = new Rs256AuditSigner(
|
|
|
127
127
|
'bundle-signing-2026-01',
|
|
128
128
|
);
|
|
129
129
|
|
|
130
|
+
// createStorage() returns a RootStorage, which is a StorageAdapter.
|
|
130
131
|
export const auditStore = new StorageAdapterAuditStore(
|
|
131
|
-
await
|
|
132
|
+
await createStorage({ type: 'redis', redis: { config: { host: process.env.REDIS_HOST!, port: 6379 } } }),
|
|
132
133
|
);
|
|
133
134
|
|
|
134
135
|
// 2. Meter provider — exports framework counters (bundle pulls, signature failures, ...)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: frontmcp-setup
|
|
3
|
-
description:
|
|
3
|
+
description: 'Use when starting, scaffolding, or organizing a FrontMCP project. Covers creating a new project (CLI scaffold or manual) for Node, Vercel, and other targets; standalone versus Nx-monorepo layout, naming conventions, generators, and dependency rules; composing multiple @App classes, ESM packages, and remote MCP servers into one server; provisioning session and storage backends (Redis, Vercel KV, SQLite with WAL and optional encryption); generating deployment-target-aware README files; and searching, installing, and managing the FrontMCP skill catalog for AI agents (Claude Code, Codex). Triggers: create a new project, how do I start, scaffold, project layout, folder structure, Nx monorepo, add Redis, set up SQLite or a database, compose apps, create a new app, manage skills.'
|
|
4
4
|
tags: [router, setup, scaffold, project, nx, redis, sqlite, structure, guide]
|
|
5
5
|
category: setup
|
|
6
6
|
targets: [all]
|
|
@@ -21,7 +21,8 @@ Configure mixed authentication modes and scope isolation for different apps in a
|
|
|
21
21
|
```typescript
|
|
22
22
|
// src/main.ts
|
|
23
23
|
import 'reflect-metadata';
|
|
24
|
-
|
|
24
|
+
|
|
25
|
+
import { App, FrontMcp } from '@frontmcp/sdk';
|
|
25
26
|
|
|
26
27
|
// Public app - no auth required
|
|
27
28
|
@App({
|
|
@@ -39,8 +40,9 @@ class PublicApp {}
|
|
|
39
40
|
plugins: [BillingAuditPlugin],
|
|
40
41
|
auth: {
|
|
41
42
|
mode: 'remote',
|
|
42
|
-
|
|
43
|
-
|
|
43
|
+
provider: 'https://auth.billing.com',
|
|
44
|
+
clientId: process.env['BILLING_OAUTH_CLIENT_ID']!,
|
|
45
|
+
expectedAudience: 'billing-api',
|
|
44
46
|
},
|
|
45
47
|
})
|
|
46
48
|
class BillingApp {}
|
|
@@ -52,7 +54,8 @@ class BillingApp {}
|
|
|
52
54
|
standalone: true,
|
|
53
55
|
auth: {
|
|
54
56
|
mode: 'remote',
|
|
55
|
-
|
|
57
|
+
provider: 'https://auth.admin.com',
|
|
58
|
+
clientId: process.env['ADMIN_OAUTH_CLIENT_ID']!,
|
|
56
59
|
},
|
|
57
60
|
})
|
|
58
61
|
class AdminApp {}
|
|
@@ -51,7 +51,7 @@ import { App } from '@frontmcp/sdk';
|
|
|
51
51
|
agents: [BillingAgent],
|
|
52
52
|
jobs: [ReconcileJob],
|
|
53
53
|
workflows: [MonthlyBillingWorkflow],
|
|
54
|
-
auth: { mode: 'remote',
|
|
54
|
+
auth: { mode: 'remote', provider: 'https://auth.billing.com', clientId: process.env['BILLING_OAUTH_CLIENT_ID']! },
|
|
55
55
|
standalone: false, // default - included in multi-app server
|
|
56
56
|
})
|
|
57
57
|
export class BillingApp {}
|
|
@@ -270,8 +270,9 @@ class PublicApp {}
|
|
|
270
270
|
tools: [UserManagementTool, AuditLogTool],
|
|
271
271
|
auth: {
|
|
272
272
|
mode: 'remote',
|
|
273
|
-
|
|
274
|
-
|
|
273
|
+
provider: 'https://auth.example.com',
|
|
274
|
+
clientId: process.env['ADMIN_OAUTH_CLIENT_ID']!,
|
|
275
|
+
expectedAudience: 'admin-api',
|
|
275
276
|
},
|
|
276
277
|
})
|
|
277
278
|
class AdminApp {}
|
|
@@ -321,7 +322,7 @@ import { App, app, FrontMcp } from '@frontmcp/sdk';
|
|
|
321
322
|
name: 'Billing',
|
|
322
323
|
tools: [ChargeTool, RefundTool],
|
|
323
324
|
plugins: [BillingAuditPlugin],
|
|
324
|
-
auth: { mode: 'remote',
|
|
325
|
+
auth: { mode: 'remote', provider: 'https://auth.billing.com', clientId: process.env['BILLING_OAUTH_CLIENT_ID']! },
|
|
325
326
|
})
|
|
326
327
|
class BillingApp {}
|
|
327
328
|
|
|
@@ -365,7 +366,7 @@ export default class Server {}
|
|
|
365
366
|
| App namespacing | `@App({ id: 'billing', name: 'Billing', tools: [ChargeTool] })` | Omitting `id` when multiple apps have tools with the same name | The `id` field controls the namespace prefix (`billing:charge_card`); without it collisions occur |
|
|
366
367
|
| Remote auth | `remoteAuth: { mode: 'static', credentials: { type: 'bearer', value: token } }` | Passing the token directly as a string to `remoteAuth` | `remoteAuth` expects a structured object with `mode` and `credentials` fields |
|
|
367
368
|
| Standalone isolation | `standalone: true` for fully isolated apps | `standalone: true` when you still want tools visible in the parent server | Use `standalone: 'includeInParent'` to get scope isolation with parent visibility |
|
|
368
|
-
| Per-app auth | `auth: { mode: 'remote',
|
|
369
|
+
| Per-app auth | `auth: { mode: 'remote', provider: '...', clientId: '...' }` on `@App` | Configuring auth only at the `@FrontMcp` level when apps need different modes | Apps without their own `auth` inherit server-level config; set per-app `auth` for mixed modes |
|
|
369
370
|
|
|
370
371
|
## Verification Checklist
|
|
371
372
|
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: frontmcp-testing
|
|
3
|
-
description: 'Use
|
|
3
|
+
description: 'Use for anything about testing FrontMCP servers: writing or running unit, integration, and E2E tests and reaching the 95%+ coverage bar. Covers Jest setup and coverage gating; unit-testing a ToolContext execute() with mock context, inputs, and Zod schema validation; testing resources and prompts; in-memory testing via create() and connectOpenAI / connectClaude (no HTTP); full MCP-protocol E2E over HTTP with McpTestClient and TestServer; authenticated tests with TestTokenFactory, MockOAuthServer, and role-based access; browser-bundle validation with Playwright; and CLI-binary / SEA startup tests. Triggers: write tests, run tests, add e2e tests, improve coverage, test a tool / resource / prompt, mock auth, jest config. The skill for ALL testing needs.'
|
|
4
|
+
when_to_use: |
|
|
5
|
+
Trigger when writing or running tests for a FrontMCP server: editing a
|
|
6
|
+
*.spec.ts / *.e2e.spec.ts file or a jest config, setting up Jest or coverage
|
|
7
|
+
gating, unit-testing a ToolContext execute(), writing MCP-protocol E2E tests
|
|
8
|
+
with McpTestClient / TestServer, testing auth with TestTokenFactory /
|
|
9
|
+
MockOAuthServer, validating a browser bundle with Playwright, or testing a
|
|
10
|
+
CLI / SEA binary.
|
|
11
|
+
paths: '**/*.spec.ts, **/*.e2e.spec.ts, **/jest.config.*, **/jest.e2e.config.*'
|
|
4
12
|
tags: [router, testing, jest, e2e, coverage, quality, guide]
|
|
5
13
|
category: testing
|
|
6
14
|
targets: [all]
|