@frontmcp/skills 1.2.0 → 1.3.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.
Files changed (30) hide show
  1. package/catalog/frontmcp-config/SKILL.md +5 -5
  2. package/catalog/frontmcp-config/references/configure-deployment-targets.md +84 -1
  3. package/catalog/frontmcp-config/references/configure-http.md +57 -2
  4. package/catalog/frontmcp-config/references/configure-session.md +14 -7
  5. package/catalog/frontmcp-deployment/SKILL.md +3 -3
  6. package/catalog/frontmcp-deployment/references/build-for-mcpb.md +1 -1
  7. package/catalog/frontmcp-deployment/references/mcp-client-integration.md +107 -0
  8. package/catalog/frontmcp-development/SKILL.md +7 -7
  9. package/catalog/frontmcp-development/examples/create-provider/basic-database-provider.md +14 -0
  10. package/catalog/frontmcp-development/examples/create-provider/config-and-api-providers.md +85 -9
  11. package/catalog/frontmcp-development/examples/create-tool/basic-class-tool.md +30 -11
  12. package/catalog/frontmcp-development/examples/create-tool/tool-with-di-and-errors.md +62 -14
  13. package/catalog/frontmcp-development/examples/create-tool/tool-with-rate-limiting-and-progress.md +30 -12
  14. package/catalog/frontmcp-development/references/create-job.md +45 -11
  15. package/catalog/frontmcp-development/references/create-provider.md +80 -8
  16. package/catalog/frontmcp-development/references/create-skill-with-tools.md +31 -0
  17. package/catalog/frontmcp-development/references/create-skill.md +45 -0
  18. package/catalog/frontmcp-development/references/create-tool.md +124 -46
  19. package/catalog/frontmcp-guides/SKILL.md +7 -7
  20. package/catalog/frontmcp-observability/SKILL.md +15 -7
  21. package/catalog/frontmcp-observability/examples/metrics-endpoint/enable-metrics-endpoint.md +77 -0
  22. package/catalog/frontmcp-observability/references/metrics-endpoint.md +161 -0
  23. package/catalog/frontmcp-setup/SKILL.md +11 -11
  24. package/catalog/frontmcp-setup/examples/frontmcp-skills-usage/install-and-search-skills.md +19 -1
  25. package/catalog/frontmcp-setup/references/frontmcp-skills-usage.md +260 -19
  26. package/catalog/frontmcp-setup/references/setup-project.md +29 -0
  27. package/catalog/frontmcp-setup/references/setup-sqlite.md +68 -9
  28. package/catalog/frontmcp-testing/SKILL.md +17 -17
  29. package/catalog/skills-manifest.json +32 -6
  30. package/package.json +1 -1
@@ -0,0 +1,77 @@
1
+ ---
2
+ name: enable-metrics-endpoint
3
+ reference: metrics-endpoint
4
+ level: basic
5
+ description: 'Turn on the /metrics endpoint with defaults and scrape it with curl.'
6
+ tags: [observability, metrics, prometheus]
7
+ features:
8
+ - 'Setting `metrics: { enabled: true }` on `@FrontMcp` to register `GET /metrics`'
9
+ - 'Verifying the Prometheus text-exposition response with `curl`'
10
+ - 'Reading process metrics + framework counters from a single scrape'
11
+ ---
12
+
13
+ # Enable the /metrics endpoint
14
+
15
+ Turn on the /metrics endpoint with defaults and scrape it with curl.
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: 'echo',
25
+ description: 'Echo the input back',
26
+ inputSchema: { message: z.string() },
27
+ outputSchema: { message: z.string() },
28
+ })
29
+ class EchoTool extends ToolContext {
30
+ async execute(input: { message: string }): Promise<{ message: string }> {
31
+ return { message: input.message };
32
+ }
33
+ }
34
+
35
+ @App({ name: 'main', tools: [EchoTool] })
36
+ class MainApp {}
37
+
38
+ @FrontMcp({
39
+ info: { name: 'my-server', version: '1.0.0' },
40
+ apps: [MainApp],
41
+ // Off by default — turn it on explicitly.
42
+ metrics: { enabled: true },
43
+ })
44
+ export default class Server {}
45
+ ```
46
+
47
+ ```bash
48
+ # In a terminal:
49
+ $ frontmcp dev
50
+ [dev] listening on port 3000
51
+
52
+ # In a second terminal:
53
+ $ curl -s http://localhost:3000/metrics | head -20
54
+ # HELP frontmcp_process_resident_memory_bytes Resident memory size in bytes
55
+ # TYPE frontmcp_process_resident_memory_bytes gauge
56
+ frontmcp_process_resident_memory_bytes 50331648
57
+ # HELP frontmcp_process_uptime_seconds Time since process start in seconds
58
+ # TYPE frontmcp_process_uptime_seconds gauge
59
+ frontmcp_process_uptime_seconds 14
60
+ # HELP frontmcp_process_cpu_seconds_total CPU time consumed since collector start, by mode (seconds)
61
+ # TYPE frontmcp_process_cpu_seconds_total counter
62
+ frontmcp_process_cpu_seconds_total{mode="user"} 0.123
63
+ frontmcp_process_cpu_seconds_total{mode="system"} 0.045
64
+
65
+ $ curl -sI http://localhost:3000/metrics | grep -i content-type
66
+ content-type: text/plain; version=0.0.4; charset=utf-8
67
+ ```
68
+
69
+ ## What This Demonstrates
70
+
71
+ - Setting `metrics: { enabled: true }` on `@FrontMcp` to register `GET /metrics`
72
+ - Verifying the Prometheus text-exposition response with `curl`
73
+ - Reading process metrics + framework counters from a single scrape
74
+
75
+ ## Related
76
+
77
+ - See `metrics-endpoint` for full configuration (auth, format, include filter, custom counters via `createCounter()`)
@@ -0,0 +1,161 @@
1
+ ---
2
+ name: metrics-endpoint
3
+ description: Configure the off-by-default /metrics endpoint that exposes process metrics and framework counters in Prometheus text format
4
+ ---
5
+
6
+ # /metrics Endpoint (issue #397)
7
+
8
+ Expose process metrics (CPU, RSS, heap, event-loop lag) and every framework counter (`frontmcp_skills_*_total`, plus any counter emitted via `createCounter()`) as a Prometheus scrape endpoint on the same HTTP listener as `/healthz`. The endpoint is **OFF by default** — turn it on with `metrics: { enabled: true }`.
9
+
10
+ ## When to use
11
+
12
+ - Cluster operators want a `/metrics` URL for Prometheus / Grafana Agent / OpenTelemetry Collector to scrape.
13
+ - Kubernetes HPA / Vercel autoscaling needs a pull endpoint instead of an OTel push pipeline.
14
+ - On-call engineers need `curl :PORT/metrics | grep event_loop` without installing cluster-side tooling first.
15
+ - The host wants both push (via OTel `MeterProvider`) and pull (this endpoint) — they read from the same in-memory counter store, so values stay consistent.
16
+
17
+ ## Enable with defaults
18
+
19
+ ```typescript
20
+ import { FrontMcp } from '@frontmcp/sdk';
21
+
22
+ @FrontMcp({
23
+ info: { name: 'my-server', version: '1.0.0' },
24
+ apps: [MyApp],
25
+ metrics: { enabled: true },
26
+ })
27
+ class Server {}
28
+ ```
29
+
30
+ Then scrape: `curl http://localhost:3001/metrics` — Content-Type is the canonical Prometheus `text/plain; version=0.0.4; charset=utf-8`.
31
+
32
+ ## Configuration
33
+
34
+ ```typescript
35
+ @FrontMcp({
36
+ metrics: {
37
+ enabled: true, // default: false
38
+ path: '/metrics', // default: '/metrics'
39
+ format: 'prometheus', // 'prometheus' | 'json'
40
+ auth: 'public', // 'public' | 'token' | { token: string }
41
+ tokenEnv: 'FRONTMCP_METRICS_TOKEN', // env var read at startup when auth: 'token'
42
+ include: ['process', 'skills'], // optional category filter
43
+ process: {
44
+ eventLoopLag: true, // mean + p99 event-loop lag gauge
45
+ fdCount: true, // Linux /proc/self/fd count
46
+ activeHandles: true, // libuv handle / request counts
47
+ },
48
+ },
49
+ })
50
+ ```
51
+
52
+ ## What gets emitted
53
+
54
+ | Category | Examples |
55
+ | ------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |
56
+ | Process gauges | `frontmcp_process_resident_memory_bytes`, `frontmcp_process_heap_bytes`, `frontmcp_process_uptime_seconds`, `frontmcp_process_cpu_seconds_total{mode}` |
57
+ | Node.js gauges | `frontmcp_nodejs_eventloop_lag_seconds{quantile}`, `frontmcp_nodejs_active_handles`, `frontmcp_nodejs_active_requests`, `frontmcp_nodejs_open_fds` (Linux only) |
58
+ | Framework counters | `frontmcp_skills_bundle_pulls_total`, `frontmcp_skills_signature_*_total`, `frontmcp_skills_replay_*_total`, `frontmcp_skills_audit_*_total` |
59
+ | Custom counters | Anything emitted via `createCounter('my_total').inc()` from `@frontmcp/observability` |
60
+
61
+ ## Token auth
62
+
63
+ ```typescript
64
+ metrics: {
65
+ enabled: true,
66
+ auth: 'token',
67
+ tokenEnv: 'FRONTMCP_METRICS_TOKEN',
68
+ }
69
+ ```
70
+
71
+ Fails fast at startup with `MetricsTokenNotConfiguredError` when the env var is unset — a token-gated endpoint never silently downgrades to public.
72
+
73
+ | Request | Status |
74
+ | --------------------------------- | ------ |
75
+ | no `Authorization` header | 401 |
76
+ | `Authorization: Bearer <wrong>` | 403 |
77
+ | `Authorization: Bearer <correct>` | 200 |
78
+
79
+ ## Off-by-default rationale
80
+
81
+ Process metrics, framework counter names, and tool vocabularies can hint at deployment scale and feature usage (e.g. `frontmcp_skills_signature_failures_total` reveals a signing infra exists). Recommendations:
82
+
83
+ - **Internet-exposed deployments**: use `auth: 'token'` or terminate at a sidecar/ingress with a network ACL.
84
+ - **Cluster-local deployments**: `auth: 'public'` matches the Prometheus / Kubernetes convention.
85
+
86
+ ## Add custom counters
87
+
88
+ ```typescript
89
+ import { createCounter } from '@frontmcp/observability';
90
+
91
+ const cacheHits = createCounter('my_cache_hits_total', 'Cache hits by tier');
92
+
93
+ // In a tool / provider:
94
+ cacheHits.inc(1, { tier: 'l1' });
95
+ ```
96
+
97
+ The next scrape will include:
98
+
99
+ ```text
100
+ # TYPE my_cache_hits_total counter
101
+ my_cache_hits_total{tier="l1"} 1
102
+ ```
103
+
104
+ Keep label values bounded (status codes, enum members, tool names) — unbounded values blow up the timeseries count.
105
+
106
+ ## Path conflict guard
107
+
108
+ `metrics.path` MUST NOT collide with MCP transport paths (`/mcp`, `/sse`, `/messages`). The service constructor throws `MetricsPathConflictError` at startup if it detects an overlap.
109
+
110
+ ## Common Patterns
111
+
112
+ | Pattern | Correct | Incorrect | Why |
113
+ | ----------------- | ------------------------------------------------------------------------------- | ------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- |
114
+ | Enable endpoint | `metrics: { enabled: true }` | Omit `metrics:` and hope it's on | The endpoint is opt-in; default is OFF for security |
115
+ | Internet exposure | `metrics: { enabled: true, auth: 'token', tokenEnv: 'FRONTMCP_METRICS_TOKEN' }` | `metrics: { enabled: true, auth: 'public' }` on a public host | `auth: 'public'` is for cluster-local convention only |
116
+ | Custom counters | `createCounter('foo_total').inc(1, { status: 'ok' })` | `prom-client` `new Counter({...})` | The framework reads from `@frontmcp/observability`'s in-memory store; only `createCounter()` flows through it |
117
+ | Label cardinality | `{ status: 'ok' \| 'error' }` | `{ user_id: '<jwt-sub>' }` | Unbounded label values blow up the timeseries count |
118
+
119
+ ## Verification Checklist
120
+
121
+ ### Configuration
122
+
123
+ - [ ] `metrics: { enabled: true }` is set in `@FrontMcp({ ... })`
124
+ - [ ] For internet-exposed deployments, `auth: 'token'` + `tokenEnv` are set AND the env var is exported in the deployment
125
+ - [ ] `metrics.path` does NOT start with `/mcp`, `/sse`, or `/messages`
126
+ - [ ] If using `include[]`, every category name is from the enum (`process` | `tools` | `resources` | `http` | `storage` | `skills` | `auth` | `sessions`)
127
+
128
+ ### Runtime
129
+
130
+ - [ ] `curl http://<host>:<port>/metrics` returns 200 with Content-Type `text/plain; version=0.0.4; charset=utf-8`
131
+ - [ ] Output contains at least one `frontmcp_process_*` gauge (proves the process-stats collector ran)
132
+ - [ ] Output contains every `frontmcp_skills_*_total` counter incremented since startup
133
+ - [ ] When `auth: 'token'`, requests without `Authorization: Bearer …` return 401 and wrong tokens return 403
134
+ - [ ] Default `@FrontMcp({})` (no `metrics:` key) → `GET /metrics` returns 404 (route was never registered)
135
+
136
+ ## Troubleshooting
137
+
138
+ | Problem | Cause | Solution |
139
+ | ------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- |
140
+ | `GET /metrics` returns 404 | `metrics.enabled` is `false` (default) | Set `metrics: { enabled: true }` |
141
+ | Server throws `MetricsTokenNotConfiguredError` at boot | `auth: 'token'` set but the env var is empty | Export the env var, or switch `auth` to `'public'` / `{ token: '...' }` |
142
+ | Server throws `MetricsPathConflictError` at boot | `metrics.path` starts with `/mcp`, `/sse`, or `/messages` | Pick a non-MCP path like `/metrics` or `/internal/metrics` |
143
+ | Custom `createCounter()` values missing from the scrape | Counter was created on a different `@frontmcp/observability` module instance (e.g. duplicated in node_modules) | Ensure single `@frontmcp/observability` install via `yarn dedupe` / `npm ls @frontmcp/observability` |
144
+ | OTel push pipeline and `/metrics` show different values | Counters created outside `createCounter()` (e.g. raw `prom-client`) bypass the in-memory store | Use `createCounter()` from `@frontmcp/observability` for everything; both paths read the same store |
145
+
146
+ ## Examples
147
+
148
+ | Example | Level | Description |
149
+ | ------------------------------------------------------------------------------------ | ----- | -------------------------------------------------------------------- |
150
+ | [`enable-metrics-endpoint`](../examples/metrics-endpoint/enable-metrics-endpoint.md) | Basic | Turn on the /metrics endpoint with defaults and scrape it with curl. |
151
+
152
+ ## Accessing This Skill
153
+
154
+ This skill is available over MCP under `skill://frontmcp-observability/SKILL.md` per SEP-2640. This reference page is served at `skill://frontmcp-observability/references/metrics-endpoint.md`.
155
+
156
+ ## Reference
157
+
158
+ - Docs: https://docs.agentfront.dev/frontmcp/deployment/metrics
159
+ - Issue tracker: https://github.com/agentfront/frontmcp/issues/397
160
+ - SDK exports: `MetricsService`, `registerMetricsRoutes`, `MetricsPathConflictError`, `MetricsTokenNotConfiguredError`
161
+ - Observability exports: `renderPrometheusExposition`, `renderJsonExposition`, `ProcessStatsCollector`, `PROMETHEUS_CONTENT_TYPE`
@@ -52,17 +52,17 @@ Entry point for project setup and scaffolding. This skill helps you find the rig
52
52
 
53
53
  ## Scenario Routing Table
54
54
 
55
- | Scenario | Reference | Description |
56
- | --------------------------------------------- | -------------------------------------------- | --------------------------------------------------------------------------------------------- |
57
- | Scaffold a new project with `frontmcp create` | `references/setup-project.md` | CLI scaffolder (flags: `--target`, `--redis`, `--skills <bundle>`, `--cicd`, `--nx`, `--pm`) |
58
- | Organize a standalone (non-Nx) project | `references/project-structure-standalone.md` | File layout, naming conventions (`<name>.<type>.ts`), folder hierarchy |
59
- | Organize an Nx monorepo | `references/project-structure-nx.md` | apps/, libs/, servers/ layout, generators, dependency rules |
60
- | Set up Redis for production storage | `references/setup-redis.md` | Docker Redis, Vercel KV, pub/sub for distributed subscriptions (single-server uses in-memory) |
61
- | Set up SQLite for local development | `references/setup-sqlite.md` | WAL mode, migration helpers, encryption |
62
- | Compose multiple apps into one server | `references/multi-app-composition.md` | `@FrontMcp` with multiple `@App` classes, cross-app providers |
63
- | Use Nx build, test, and CI commands | `references/nx-workflow.md` | `nx build`, `nx test`, `nx run-many`, caching, affected commands |
64
- | Browse, install, and manage skills | `references/frontmcp-skills-usage.md` | CLI commands, bundles, categories, search |
65
- | Generate or update project README.md | `references/readme-guide.md` | Deployment-target-aware README for npm, CLI, Docker, serverless |
55
+ | Scenario | Reference | Description |
56
+ | --------------------------------------------- | -------------------------------------------- | ---------------------------------------------------------------------------------------------- |
57
+ | Scaffold a new project with `frontmcp create` | `references/setup-project.md` | CLI scaffolder (flags: `--target`, `--redis`, `--skills <bundle>`, `--cicd`, `--nx`, `--pm`) |
58
+ | Organize a standalone (non-Nx) project | `references/project-structure-standalone.md` | File layout, naming conventions (`<name>.<type>.ts`), folder hierarchy |
59
+ | Organize an Nx monorepo | `references/project-structure-nx.md` | apps/, libs/, servers/ layout, generators, dependency rules |
60
+ | Set up Redis for production storage | `references/setup-redis.md` | Docker Redis, Vercel KV, pub/sub for distributed subscriptions (single-server uses in-memory) |
61
+ | Set up SQLite for local development | `references/setup-sqlite.md` | WAL mode, migration helpers, encryption |
62
+ | Compose multiple apps into one server | `references/multi-app-composition.md` | `@FrontMcp` with multiple `@App` classes, cross-app providers |
63
+ | Use Nx build, test, and CI commands | `references/nx-workflow.md` | `nx build`, `nx test`, `nx run-many`, caching, affected commands |
64
+ | Browse, install, and manage skills | `references/frontmcp-skills-usage.md` | CLI commands (search, list, install, read, export, publish), bundles, categories, bulk install |
65
+ | Generate or update project README.md | `references/readme-guide.md` | Deployment-target-aware README for npm, CLI, Docker, serverless |
66
66
 
67
67
  ## Recommended Reading Order
68
68
 
@@ -3,11 +3,13 @@ name: install-and-search-skills
3
3
  reference: frontmcp-skills-usage
4
4
  level: basic
5
5
  description: 'Install skills statically for Claude Code and use dynamic CLI search for on-demand discovery.'
6
- tags: [setup, cli, anthropic, skills, usage, install]
6
+ tags: [setup, cli, anthropic, skills, usage, install, bulk, export]
7
7
  features:
8
8
  - '`frontmcp skills list` and `search` for discovering available skills'
9
9
  - '`frontmcp skills read` for viewing skill content and references on demand'
10
10
  - '`frontmcp skills install --provider claude` for static installation to `.claude/skills/`'
11
+ - '`frontmcp skills install --all` / `--category` / `--tag` for bulk install in one command'
12
+ - '`frontmcp skills export` to ship a skill to Cursor / Windsurf / Copilot rule files'
11
13
  - 'Installed skills are auto-loaded by Claude Code in its system prompt context'
12
14
  ---
13
15
 
@@ -52,6 +54,20 @@ frontmcp skills install frontmcp-development --provider codex
52
54
 
53
55
  # Install to a custom directory
54
56
  frontmcp skills install frontmcp-guides --dir ./my-skills
57
+
58
+ # Bulk install — every skill in a category in one command
59
+ frontmcp skills install --category development --provider claude
60
+
61
+ # Bulk install — every skill in the catalog
62
+ frontmcp skills install --all --provider claude
63
+
64
+ # Bulk install by tag
65
+ frontmcp skills install --tag middleware --provider codex
66
+
67
+ # Export a skill as a Cursor / Windsurf / Copilot rule file (for skills-unaware IDEs)
68
+ frontmcp skills export --name frontmcp-development --target cursor
69
+ frontmcp skills export --all --target windsurf
70
+ frontmcp skills export --all --target copilot --out ./.github
55
71
  ```
56
72
 
57
73
  After installation, the directory structure:
@@ -76,6 +92,8 @@ my-project/
76
92
  - `frontmcp skills list` and `search` for discovering available skills
77
93
  - `frontmcp skills read` for viewing skill content and references on demand
78
94
  - `frontmcp skills install --provider claude` for static installation to `.claude/skills/`
95
+ - `frontmcp skills install --all` / `--category` / `--tag` for bulk install in one command
96
+ - `frontmcp skills export` to ship a skill to Cursor / Windsurf / Copilot rule files
79
97
  - Installed skills are auto-loaded by Claude Code in its system prompt context
80
98
 
81
99
  ## Related