@frontmcp/skills 1.0.0-beta.9 → 1.0.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 +2 -2
- package/catalog/TEMPLATE.md +69 -0
- package/catalog/frontmcp-config/SKILL.md +38 -22
- package/catalog/frontmcp-config/examples/configure-auth/multi-app-auth.md +87 -0
- package/catalog/frontmcp-config/examples/configure-auth/public-mode-setup.md +63 -0
- package/catalog/frontmcp-config/examples/configure-auth/remote-oauth-with-vault.md +76 -0
- package/catalog/frontmcp-config/examples/configure-auth-modes/local-self-signed-tokens.md +77 -0
- package/catalog/frontmcp-config/examples/configure-auth-modes/remote-enterprise-oauth.md +73 -0
- package/catalog/frontmcp-config/examples/configure-auth-modes/transparent-jwt-validation.md +64 -0
- package/catalog/frontmcp-config/examples/configure-elicitation/basic-confirmation-gate.md +83 -0
- package/catalog/frontmcp-config/examples/configure-elicitation/distributed-elicitation-redis.md +87 -0
- package/catalog/frontmcp-config/examples/configure-http/cors-restricted-origins.md +52 -0
- package/catalog/frontmcp-config/examples/configure-http/entry-path-reverse-proxy.md +72 -0
- package/catalog/frontmcp-config/examples/configure-http/unix-socket-local.md +64 -0
- package/catalog/frontmcp-config/examples/configure-session/multi-server-key-prefix.md +68 -0
- package/catalog/frontmcp-config/examples/configure-session/redis-session-store.md +52 -0
- package/catalog/frontmcp-config/examples/configure-session/vercel-kv-session.md +52 -0
- package/catalog/frontmcp-config/examples/configure-throttle/distributed-redis-throttle.md +94 -0
- package/catalog/frontmcp-config/examples/configure-throttle/per-tool-rate-limit.md +92 -0
- package/catalog/frontmcp-config/examples/configure-throttle/server-level-rate-limit.md +83 -0
- package/catalog/frontmcp-config/examples/configure-throttle-guard-config/full-guard-config.md +99 -0
- package/catalog/frontmcp-config/examples/configure-throttle-guard-config/minimal-guard-config.md +55 -0
- package/catalog/frontmcp-config/examples/configure-transport/custom-protocol-flags.md +74 -0
- package/catalog/frontmcp-config/examples/configure-transport/distributed-sessions-redis.md +86 -0
- package/catalog/frontmcp-config/examples/configure-transport/stateless-serverless.md +69 -0
- package/catalog/frontmcp-config/examples/configure-transport-protocol-presets/legacy-preset-nodejs.md +65 -0
- package/catalog/frontmcp-config/examples/configure-transport-protocol-presets/stateless-api-serverless.md +69 -0
- package/catalog/frontmcp-config/references/configure-auth-modes.md +15 -0
- package/catalog/frontmcp-config/references/configure-auth.md +15 -0
- package/catalog/frontmcp-config/references/configure-elicitation.md +14 -0
- package/catalog/frontmcp-config/references/configure-http.md +15 -0
- package/catalog/frontmcp-config/references/configure-session.md +15 -0
- package/catalog/frontmcp-config/references/configure-throttle-guard-config.md +14 -0
- package/catalog/frontmcp-config/references/configure-throttle.md +15 -0
- package/catalog/frontmcp-config/references/configure-transport-protocol-presets.md +14 -0
- package/catalog/frontmcp-config/references/configure-transport.md +15 -0
- package/catalog/frontmcp-config/references/setup-redis.md +10 -0
- package/catalog/frontmcp-config/references/setup-sqlite.md +10 -0
- package/catalog/frontmcp-deployment/SKILL.md +40 -12
- package/catalog/frontmcp-deployment/examples/build-for-browser/browser-build-with-custom-entry.md +43 -0
- package/catalog/frontmcp-deployment/examples/build-for-browser/browser-crypto-and-storage.md +85 -0
- package/catalog/frontmcp-deployment/examples/build-for-browser/react-provider-setup.md +61 -0
- package/catalog/frontmcp-deployment/examples/build-for-cli/cli-binary-build.md +66 -0
- package/catalog/frontmcp-deployment/examples/build-for-cli/unix-socket-daemon.md +76 -0
- package/catalog/frontmcp-deployment/examples/build-for-sdk/connect-openai.md +78 -0
- package/catalog/frontmcp-deployment/examples/build-for-sdk/create-flat-config.md +85 -0
- package/catalog/frontmcp-deployment/examples/build-for-sdk/multi-platform-connect.md +104 -0
- package/catalog/frontmcp-deployment/examples/deploy-to-cloudflare/basic-worker-deploy.md +82 -0
- package/catalog/frontmcp-deployment/examples/deploy-to-cloudflare/worker-custom-domain.md +97 -0
- package/catalog/frontmcp-deployment/examples/deploy-to-cloudflare/worker-with-kv-storage.md +92 -0
- package/catalog/frontmcp-deployment/examples/deploy-to-lambda/cdk-deployment.md +92 -0
- package/catalog/frontmcp-deployment/examples/deploy-to-lambda/lambda-handler-with-cors.md +113 -0
- package/catalog/frontmcp-deployment/examples/deploy-to-lambda/sam-template-basic.md +100 -0
- package/catalog/frontmcp-deployment/examples/deploy-to-node/docker-compose-with-redis.md +101 -0
- package/catalog/frontmcp-deployment/examples/deploy-to-node/pm2-with-nginx.md +79 -0
- package/catalog/frontmcp-deployment/examples/deploy-to-node/resource-limits.md +92 -0
- package/catalog/frontmcp-deployment/examples/deploy-to-node-dockerfile/basic-multistage-dockerfile.md +63 -0
- package/catalog/frontmcp-deployment/examples/deploy-to-node-dockerfile/secure-nonroot-dockerfile.md +89 -0
- package/catalog/frontmcp-deployment/examples/deploy-to-vercel/vercel-mcp-endpoint-test.md +69 -0
- package/catalog/frontmcp-deployment/examples/deploy-to-vercel/vercel-with-kv.md +82 -0
- package/catalog/frontmcp-deployment/examples/deploy-to-vercel/vercel-with-skills-cache.md +90 -0
- package/catalog/frontmcp-deployment/examples/deploy-to-vercel-config/minimal-vercel-config.md +49 -0
- package/catalog/frontmcp-deployment/examples/deploy-to-vercel-config/vercel-config-with-security-headers.md +92 -0
- package/catalog/frontmcp-deployment/references/build-for-browser.md +15 -0
- package/catalog/frontmcp-deployment/references/build-for-cli.md +65 -3
- package/catalog/frontmcp-deployment/references/build-for-sdk.md +15 -0
- package/catalog/frontmcp-deployment/references/deploy-to-cloudflare.md +15 -0
- package/catalog/frontmcp-deployment/references/deploy-to-lambda.md +18 -3
- package/catalog/frontmcp-deployment/references/deploy-to-node-dockerfile.md +16 -2
- package/catalog/frontmcp-deployment/references/deploy-to-node.md +19 -4
- package/catalog/frontmcp-deployment/references/deploy-to-vercel-config.md +14 -0
- package/catalog/frontmcp-deployment/references/deploy-to-vercel.md +15 -0
- package/catalog/frontmcp-development/SKILL.md +25 -17
- package/catalog/frontmcp-development/examples/create-adapter/basic-api-adapter.md +92 -0
- package/catalog/frontmcp-development/examples/create-adapter/namespaced-adapter.md +124 -0
- package/catalog/frontmcp-development/examples/create-agent/basic-agent-with-tools.md +121 -0
- package/catalog/frontmcp-development/examples/create-agent/custom-multi-pass-agent.md +95 -0
- package/catalog/frontmcp-development/examples/create-agent/nested-agents-with-swarm.md +111 -0
- package/catalog/frontmcp-development/examples/create-agent-llm-config/anthropic-config.md +81 -0
- package/catalog/frontmcp-development/examples/create-agent-llm-config/openai-config.md +80 -0
- package/catalog/frontmcp-development/examples/create-job/basic-report-job.md +87 -0
- package/catalog/frontmcp-development/examples/create-job/job-with-permissions.md +117 -0
- package/catalog/frontmcp-development/examples/create-job/job-with-retry.md +88 -0
- package/catalog/frontmcp-development/examples/create-plugin/basic-plugin-with-provider.md +69 -0
- package/catalog/frontmcp-development/examples/create-plugin/configurable-dynamic-plugin.md +178 -0
- package/catalog/frontmcp-development/examples/create-plugin/plugin-with-context-extension.md +107 -0
- package/catalog/frontmcp-development/examples/create-plugin-hooks/basic-logging-plugin.md +69 -0
- package/catalog/frontmcp-development/examples/create-plugin-hooks/caching-with-around.md +80 -0
- package/catalog/frontmcp-development/examples/create-plugin-hooks/tool-level-hooks-and-stage-replacement.md +100 -0
- package/catalog/frontmcp-development/examples/create-prompt/basic-prompt.md +72 -0
- package/catalog/frontmcp-development/examples/create-prompt/dynamic-rag-prompt.md +92 -0
- package/catalog/frontmcp-development/examples/create-prompt/multi-turn-debug-session.md +86 -0
- package/catalog/frontmcp-development/examples/create-provider/basic-database-provider.md +113 -0
- package/catalog/frontmcp-development/examples/create-provider/config-and-api-providers.md +107 -0
- package/catalog/frontmcp-development/examples/create-resource/basic-static-resource.md +72 -0
- package/catalog/frontmcp-development/examples/create-resource/binary-and-multi-content.md +111 -0
- package/catalog/frontmcp-development/examples/create-resource/parameterized-template.md +84 -0
- package/catalog/frontmcp-development/examples/create-skill/basic-inline-skill.md +96 -0
- package/catalog/frontmcp-development/examples/create-skill/directory-based-skill.md +115 -0
- package/catalog/frontmcp-development/examples/create-skill/parameterized-skill.md +96 -0
- package/catalog/frontmcp-development/examples/create-skill-with-tools/basic-tool-orchestration.md +76 -0
- package/catalog/frontmcp-development/examples/create-skill-with-tools/directory-skill-with-tools.md +149 -0
- package/catalog/frontmcp-development/examples/create-skill-with-tools/incident-response-skill.md +92 -0
- package/catalog/frontmcp-development/examples/create-tool/basic-class-tool.md +62 -0
- package/catalog/frontmcp-development/examples/create-tool/tool-with-di-and-errors.md +84 -0
- package/catalog/frontmcp-development/examples/create-tool/tool-with-rate-limiting-and-progress.md +93 -0
- package/catalog/frontmcp-development/examples/create-tool-annotations/destructive-delete-tool.md +94 -0
- package/catalog/frontmcp-development/examples/create-tool-annotations/readonly-query-tool.md +60 -0
- package/catalog/frontmcp-development/examples/create-tool-output-schema-types/primitive-and-media-outputs.md +104 -0
- package/catalog/frontmcp-development/examples/create-tool-output-schema-types/zod-raw-shape-output.md +63 -0
- package/catalog/frontmcp-development/examples/create-tool-output-schema-types/zod-schema-advanced-output.md +103 -0
- package/catalog/frontmcp-development/examples/create-workflow/basic-deploy-pipeline.md +91 -0
- package/catalog/frontmcp-development/examples/create-workflow/parallel-validation-pipeline.md +90 -0
- package/catalog/frontmcp-development/examples/create-workflow/webhook-triggered-workflow.md +136 -0
- package/catalog/frontmcp-development/examples/decorators-guide/agent-skill-job-workflow.md +145 -0
- package/catalog/frontmcp-development/examples/decorators-guide/basic-server-with-app-and-tools.md +124 -0
- package/catalog/frontmcp-development/examples/decorators-guide/multi-app-with-plugins-and-providers.md +149 -0
- package/catalog/frontmcp-development/examples/official-adapters/authenticated-adapter-with-polling.md +84 -0
- package/catalog/frontmcp-development/examples/official-adapters/basic-openapi-adapter.md +54 -0
- package/catalog/frontmcp-development/examples/official-adapters/multi-api-hub-with-inline-spec.md +130 -0
- package/catalog/frontmcp-development/examples/official-plugins/cache-and-feature-flags.md +117 -0
- package/catalog/frontmcp-development/examples/official-plugins/production-multi-plugin-setup.md +147 -0
- package/catalog/frontmcp-development/examples/official-plugins/remember-plugin-session-memory.md +104 -0
- package/catalog/frontmcp-development/references/create-adapter.md +14 -0
- package/catalog/frontmcp-development/references/create-agent-llm-config.md +14 -0
- package/catalog/frontmcp-development/references/create-agent.md +15 -0
- package/catalog/frontmcp-development/references/create-job.md +15 -0
- package/catalog/frontmcp-development/references/create-plugin-hooks.md +51 -0
- package/catalog/frontmcp-development/references/create-plugin.md +186 -11
- package/catalog/frontmcp-development/references/create-prompt.md +17 -0
- package/catalog/frontmcp-development/references/create-provider.md +14 -0
- package/catalog/frontmcp-development/references/create-resource.md +127 -0
- package/catalog/frontmcp-development/references/create-skill-with-tools.md +126 -7
- package/catalog/frontmcp-development/references/create-skill.md +57 -12
- package/catalog/frontmcp-development/references/create-tool-annotations.md +14 -0
- package/catalog/frontmcp-development/references/create-tool-output-schema-types.md +15 -0
- package/catalog/frontmcp-development/references/create-tool.md +205 -1
- package/catalog/frontmcp-development/references/create-workflow.md +15 -0
- package/catalog/frontmcp-development/references/decorators-guide.md +155 -78
- package/catalog/frontmcp-development/references/official-adapters.md +31 -16
- package/catalog/frontmcp-development/references/official-plugins.md +62 -28
- package/catalog/frontmcp-extensibility/SKILL.md +103 -0
- package/catalog/frontmcp-extensibility/examples/vectoriadb/product-catalog-search.md +175 -0
- package/catalog/frontmcp-extensibility/examples/vectoriadb/semantic-search-with-persistence.md +138 -0
- package/catalog/frontmcp-extensibility/examples/vectoriadb/tfidf-keyword-search.md +103 -0
- package/catalog/frontmcp-extensibility/references/vectoriadb.md +299 -0
- package/catalog/frontmcp-guides/SKILL.md +7 -4
- package/catalog/frontmcp-guides/examples/example-knowledge-base/agent-and-plugin.md +160 -0
- package/catalog/frontmcp-guides/examples/example-knowledge-base/multi-app-composition.md +92 -0
- package/catalog/frontmcp-guides/examples/example-knowledge-base/vector-search-and-resources.md +135 -0
- package/catalog/frontmcp-guides/examples/example-task-manager/auth-and-crud-tools.md +135 -0
- package/catalog/frontmcp-guides/examples/example-task-manager/authenticated-e2e-tests.md +148 -0
- package/catalog/frontmcp-guides/examples/example-task-manager/redis-provider-with-di.md +129 -0
- package/catalog/frontmcp-guides/examples/example-weather-api/server-and-app-setup.md +75 -0
- package/catalog/frontmcp-guides/examples/example-weather-api/unit-and-e2e-tests.md +142 -0
- package/catalog/frontmcp-guides/examples/example-weather-api/weather-tool-with-schemas.md +74 -0
- package/catalog/frontmcp-guides/references/example-knowledge-base.md +15 -0
- package/catalog/frontmcp-guides/references/example-task-manager.md +30 -21
- package/catalog/frontmcp-guides/references/example-weather-api.md +18 -6
- package/catalog/frontmcp-observability/SKILL.md +144 -0
- package/catalog/frontmcp-observability/examples/structured-logging/stdout-logging.md +71 -0
- package/catalog/frontmcp-observability/examples/structured-logging/winston-integration.md +70 -0
- package/catalog/frontmcp-observability/examples/telemetry-api/agent-nested-tracing.md +86 -0
- package/catalog/frontmcp-observability/examples/telemetry-api/plugin-telemetry.md +93 -0
- package/catalog/frontmcp-observability/examples/telemetry-api/tool-custom-spans.md +72 -0
- package/catalog/frontmcp-observability/examples/testing-observability/test-custom-spans.md +90 -0
- package/catalog/frontmcp-observability/examples/testing-observability/test-log-correlation.md +104 -0
- package/catalog/frontmcp-observability/examples/tracing-setup/basic-tracing.md +82 -0
- package/catalog/frontmcp-observability/examples/tracing-setup/production-tracing.md +73 -0
- package/catalog/frontmcp-observability/examples/vendor-integrations/coralogix-setup.md +74 -0
- package/catalog/frontmcp-observability/references/structured-logging.md +114 -0
- package/catalog/frontmcp-observability/references/telemetry-api.md +155 -0
- package/catalog/frontmcp-observability/references/testing-observability.md +169 -0
- package/catalog/frontmcp-observability/references/tracing-setup.md +146 -0
- package/catalog/frontmcp-observability/references/vendor-integrations.md +164 -0
- package/catalog/frontmcp-production-readiness/SKILL.md +99 -0
- package/catalog/frontmcp-production-readiness/examples/common-checklist/caching-and-performance.md +102 -0
- package/catalog/frontmcp-production-readiness/examples/common-checklist/observability-setup.md +104 -0
- package/catalog/frontmcp-production-readiness/examples/common-checklist/security-hardening.md +95 -0
- package/catalog/frontmcp-production-readiness/examples/health-readiness-endpoints/basic-health-setup.md +81 -0
- package/catalog/frontmcp-production-readiness/examples/health-readiness-endpoints/custom-probes.md +136 -0
- package/catalog/frontmcp-production-readiness/examples/production-browser/browser-bundle-config.md +93 -0
- package/catalog/frontmcp-production-readiness/examples/production-browser/cross-platform-crypto.md +116 -0
- package/catalog/frontmcp-production-readiness/examples/production-browser/security-and-performance.md +128 -0
- package/catalog/frontmcp-production-readiness/examples/production-cli-binary/binary-build-config.md +109 -0
- package/catalog/frontmcp-production-readiness/examples/production-cli-binary/stdio-transport-error-handling.md +132 -0
- package/catalog/frontmcp-production-readiness/examples/production-cli-daemon/daemon-socket-config.md +82 -0
- package/catalog/frontmcp-production-readiness/examples/production-cli-daemon/graceful-shutdown-cleanup.md +107 -0
- package/catalog/frontmcp-production-readiness/examples/production-cli-daemon/security-and-permissions.md +119 -0
- package/catalog/frontmcp-production-readiness/examples/production-cloudflare/durable-objects-state.md +124 -0
- package/catalog/frontmcp-production-readiness/examples/production-cloudflare/workers-runtime-constraints.md +103 -0
- package/catalog/frontmcp-production-readiness/examples/production-cloudflare/wrangler-config.md +89 -0
- package/catalog/frontmcp-production-readiness/examples/production-lambda/cold-start-connection-reuse.md +122 -0
- package/catalog/frontmcp-production-readiness/examples/production-lambda/sam-template.md +107 -0
- package/catalog/frontmcp-production-readiness/examples/production-lambda/scaling-and-monitoring.md +138 -0
- package/catalog/frontmcp-production-readiness/examples/production-node-sdk/basic-sdk-lifecycle.md +85 -0
- package/catalog/frontmcp-production-readiness/examples/production-node-sdk/multi-instance-cleanup.md +110 -0
- package/catalog/frontmcp-production-readiness/examples/production-node-sdk/package-json-config.md +107 -0
- package/catalog/frontmcp-production-readiness/examples/production-node-server/docker-multi-stage.md +103 -0
- package/catalog/frontmcp-production-readiness/examples/production-node-server/graceful-shutdown.md +87 -0
- package/catalog/frontmcp-production-readiness/examples/production-node-server/redis-session-scaling.md +97 -0
- package/catalog/frontmcp-production-readiness/examples/production-vercel/cold-start-optimization.md +104 -0
- package/catalog/frontmcp-production-readiness/examples/production-vercel/stateless-serverless-design.md +91 -0
- package/catalog/frontmcp-production-readiness/examples/production-vercel/vercel-edge-config.md +78 -0
- package/catalog/frontmcp-production-readiness/references/common-checklist.md +175 -0
- package/catalog/frontmcp-production-readiness/references/health-readiness-endpoints.md +198 -0
- package/catalog/frontmcp-production-readiness/references/production-browser.md +56 -0
- package/catalog/frontmcp-production-readiness/references/production-cli-binary.md +71 -0
- package/catalog/frontmcp-production-readiness/references/production-cli-daemon.md +71 -0
- package/catalog/frontmcp-production-readiness/references/production-cloudflare.md +62 -0
- package/catalog/frontmcp-production-readiness/references/production-lambda.md +63 -0
- package/catalog/frontmcp-production-readiness/references/production-node-sdk.md +76 -0
- package/catalog/frontmcp-production-readiness/references/production-node-server.md +71 -0
- package/catalog/frontmcp-production-readiness/references/production-vercel.md +62 -0
- package/catalog/frontmcp-setup/SKILL.md +19 -14
- package/catalog/frontmcp-setup/examples/frontmcp-skills-usage/bundle-presets-scaffolding.md +61 -0
- package/catalog/frontmcp-setup/examples/frontmcp-skills-usage/install-and-search-skills.md +83 -0
- package/catalog/frontmcp-setup/examples/multi-app-composition/local-apps-with-shared-tools.md +87 -0
- package/catalog/frontmcp-setup/examples/multi-app-composition/per-app-auth-and-isolation.md +88 -0
- package/catalog/frontmcp-setup/examples/multi-app-composition/remote-and-esm-apps.md +81 -0
- package/catalog/frontmcp-setup/examples/nx-workflow/build-test-affected.md +77 -0
- package/catalog/frontmcp-setup/examples/nx-workflow/multi-server-deployment.md +93 -0
- package/catalog/frontmcp-setup/examples/nx-workflow/scaffold-and-generate.md +62 -0
- package/catalog/frontmcp-setup/examples/project-structure-nx/nx-generator-scaffolding.md +73 -0
- package/catalog/frontmcp-setup/examples/project-structure-nx/nx-workspace-with-apps.md +85 -0
- package/catalog/frontmcp-setup/examples/project-structure-nx/shared-library-usage.md +89 -0
- package/catalog/frontmcp-setup/examples/project-structure-standalone/dev-workflow-commands.md +64 -0
- package/catalog/frontmcp-setup/examples/project-structure-standalone/feature-folder-organization.md +111 -0
- package/catalog/frontmcp-setup/examples/project-structure-standalone/minimal-standalone-layout.md +73 -0
- package/catalog/frontmcp-setup/examples/readme-guide/node-server-readme.md +89 -0
- package/catalog/frontmcp-setup/examples/readme-guide/vercel-deployment-readme.md +90 -0
- package/catalog/frontmcp-setup/examples/setup-project/basic-node-server.md +99 -0
- package/catalog/frontmcp-setup/examples/setup-project/cli-scaffold-with-flags.md +77 -0
- package/catalog/frontmcp-setup/examples/setup-project/vercel-serverless-server.md +89 -0
- package/catalog/frontmcp-setup/examples/setup-redis/docker-redis-local-dev.md +88 -0
- package/catalog/frontmcp-setup/examples/setup-redis/hybrid-vercel-kv-with-pubsub.md +78 -0
- package/catalog/frontmcp-setup/examples/setup-redis/vercel-kv-serverless.md +78 -0
- package/catalog/frontmcp-setup/examples/setup-sqlite/basic-sqlite-setup.md +75 -0
- package/catalog/frontmcp-setup/examples/setup-sqlite/encrypted-sqlite-storage.md +55 -0
- package/catalog/frontmcp-setup/examples/setup-sqlite/unix-socket-daemon.md +70 -0
- package/catalog/frontmcp-setup/references/frontmcp-skills-usage.md +33 -9
- package/catalog/frontmcp-setup/references/multi-app-composition.md +15 -0
- package/catalog/frontmcp-setup/references/nx-workflow.md +15 -0
- package/catalog/frontmcp-setup/references/project-structure-nx.md +15 -0
- package/catalog/frontmcp-setup/references/project-structure-standalone.md +15 -0
- package/catalog/frontmcp-setup/references/readme-guide.md +235 -0
- package/catalog/frontmcp-setup/references/setup-project.md +16 -1
- package/catalog/frontmcp-setup/references/setup-redis.md +15 -0
- package/catalog/frontmcp-setup/references/setup-sqlite.md +15 -0
- package/catalog/frontmcp-testing/SKILL.md +41 -27
- package/catalog/frontmcp-testing/examples/setup-testing/fixture-based-e2e-test.md +70 -0
- package/catalog/frontmcp-testing/examples/setup-testing/jest-config-with-coverage.md +59 -0
- package/catalog/frontmcp-testing/examples/setup-testing/unit-test-tool-resource-prompt.md +115 -0
- package/catalog/frontmcp-testing/examples/test-auth/oauth-flow-test.md +78 -0
- package/catalog/frontmcp-testing/examples/test-auth/role-based-access-test.md +88 -0
- package/catalog/frontmcp-testing/examples/test-auth/token-factory-test.md +71 -0
- package/catalog/frontmcp-testing/examples/test-browser-build/browser-bundle-validation.md +58 -0
- package/catalog/frontmcp-testing/examples/test-browser-build/playwright-browser-test.md +69 -0
- package/catalog/frontmcp-testing/examples/test-cli-binary/binary-startup-test.md +77 -0
- package/catalog/frontmcp-testing/examples/test-cli-binary/js-bundle-import-test.md +56 -0
- package/catalog/frontmcp-testing/examples/test-direct-client/basic-create-test.md +74 -0
- package/catalog/frontmcp-testing/examples/test-direct-client/openai-claude-format-test.md +79 -0
- package/catalog/frontmcp-testing/examples/test-e2e-handler/basic-e2e-test.md +67 -0
- package/catalog/frontmcp-testing/examples/test-e2e-handler/manual-client-with-transport.md +72 -0
- package/catalog/frontmcp-testing/examples/test-e2e-handler/tool-call-and-error-e2e.md +73 -0
- package/catalog/frontmcp-testing/examples/test-tool-unit/basic-tool-test.md +69 -0
- package/catalog/frontmcp-testing/examples/test-tool-unit/schema-validation-test.md +82 -0
- package/catalog/frontmcp-testing/examples/test-tool-unit/tool-error-handling-test.md +92 -0
- package/catalog/frontmcp-testing/references/setup-testing.md +17 -0
- package/catalog/frontmcp-testing/references/test-auth.md +15 -0
- package/catalog/frontmcp-testing/references/test-browser-build.md +14 -0
- package/catalog/frontmcp-testing/references/test-cli-binary.md +14 -0
- package/catalog/frontmcp-testing/references/test-direct-client.md +14 -0
- package/catalog/frontmcp-testing/references/test-e2e-handler.md +15 -0
- package/catalog/frontmcp-testing/references/test-tool-unit.md +15 -0
- package/catalog/skills-manifest.json +2849 -32
- package/package.json +2 -2
- package/src/index.d.ts +1 -1
- package/src/index.js.map +1 -1
- package/src/loader.js +0 -1
- package/src/loader.js.map +1 -1
- package/src/manifest.d.ts +36 -1
- package/src/manifest.js +6 -1
- package/src/manifest.js.map +1 -1
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: basic-plugin-with-provider
|
|
3
|
+
reference: create-plugin
|
|
4
|
+
level: basic
|
|
5
|
+
description: 'A minimal plugin that contributes an injectable service via the `providers` and `exports` arrays.'
|
|
6
|
+
tags: [development, plugin, provider]
|
|
7
|
+
features:
|
|
8
|
+
- 'Creating a plugin with `@Plugin` decorator that bundles a `@Provider` class'
|
|
9
|
+
- 'Listing providers in both `providers` (for DI registration) and `exports` (for external access)'
|
|
10
|
+
- 'Registering a plugin in the `plugins` array of `@FrontMcp`'
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# Basic Plugin with a Provider
|
|
14
|
+
|
|
15
|
+
A minimal plugin that contributes an injectable service via the `providers` and `exports` arrays.
|
|
16
|
+
|
|
17
|
+
## Code
|
|
18
|
+
|
|
19
|
+
```typescript
|
|
20
|
+
// src/plugins/audit-log/providers/audit-logger.provider.ts
|
|
21
|
+
import { Provider } from '@frontmcp/sdk';
|
|
22
|
+
|
|
23
|
+
@Provider()
|
|
24
|
+
export class AuditLogger {
|
|
25
|
+
async logToolCall(toolName: string, userId: string, input: unknown): Promise<void> {
|
|
26
|
+
console.log(`[AUDIT] ${userId} called ${toolName}`, input);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
```typescript
|
|
32
|
+
// src/plugins/audit-log/audit-log.plugin.ts
|
|
33
|
+
import { Plugin } from '@frontmcp/sdk';
|
|
34
|
+
import { AuditLogger } from './providers/audit-logger.provider';
|
|
35
|
+
|
|
36
|
+
@Plugin({
|
|
37
|
+
name: 'audit-log',
|
|
38
|
+
description: 'Logs tool executions for audit compliance',
|
|
39
|
+
providers: [AuditLogger],
|
|
40
|
+
exports: [AuditLogger],
|
|
41
|
+
})
|
|
42
|
+
export default class AuditLogPlugin {}
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
```typescript
|
|
46
|
+
// src/server.ts
|
|
47
|
+
import { FrontMcp, App } from '@frontmcp/sdk';
|
|
48
|
+
import AuditLogPlugin from './plugins/audit-log/audit-log.plugin';
|
|
49
|
+
|
|
50
|
+
@App({ name: 'MyApp' })
|
|
51
|
+
class MyApp {}
|
|
52
|
+
|
|
53
|
+
@FrontMcp({
|
|
54
|
+
info: { name: 'my-server', version: '1.0.0' },
|
|
55
|
+
apps: [MyApp],
|
|
56
|
+
plugins: [AuditLogPlugin],
|
|
57
|
+
})
|
|
58
|
+
class MyServer {}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## What This Demonstrates
|
|
62
|
+
|
|
63
|
+
- Creating a plugin with `@Plugin` decorator that bundles a `@Provider` class
|
|
64
|
+
- Listing providers in both `providers` (for DI registration) and `exports` (for external access)
|
|
65
|
+
- Registering a plugin in the `plugins` array of `@FrontMcp`
|
|
66
|
+
|
|
67
|
+
## Related
|
|
68
|
+
|
|
69
|
+
- See `create-plugin` for context extensions, DynamicPlugin, and metadata augmentation
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: configurable-dynamic-plugin
|
|
3
|
+
reference: create-plugin
|
|
4
|
+
level: advanced
|
|
5
|
+
description: 'A plugin that accepts runtime configuration via `DynamicPlugin` and extends decorator metadata with custom fields.'
|
|
6
|
+
tags: [development, plugin, configurable, dynamic]
|
|
7
|
+
features:
|
|
8
|
+
- 'Extending `DynamicPlugin<TOptions, TInput>` for runtime-configurable plugins'
|
|
9
|
+
- 'Implementing `static dynamicProviders()` to create providers from the input options'
|
|
10
|
+
- 'Using `TInput` with optional fields and applying defaults in the constructor'
|
|
11
|
+
- 'Extending decorator metadata via `declare global { interface ExtendFrontMcpToolMetadata }`'
|
|
12
|
+
- 'Augmenting both `ExecutionContextBase` and `PromptContext` for full context extension coverage'
|
|
13
|
+
- 'Registering the plugin with `MyPlugin.init({ ... })` in the `plugins` array'
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
# Configurable Plugin with DynamicPlugin and Metadata Extension
|
|
17
|
+
|
|
18
|
+
A plugin that accepts runtime configuration via `DynamicPlugin` and extends decorator metadata with custom fields.
|
|
19
|
+
|
|
20
|
+
## Code
|
|
21
|
+
|
|
22
|
+
```typescript
|
|
23
|
+
// src/plugins/my-plugin/my-plugin.types.ts
|
|
24
|
+
export interface MyPluginOptions {
|
|
25
|
+
endpoint: string;
|
|
26
|
+
refreshIntervalMs: number;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export type MyPluginOptionsInput = Omit<MyPluginOptions, 'refreshIntervalMs'> & {
|
|
30
|
+
refreshIntervalMs?: number;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
// Extend the @Tool decorator metadata with a custom field
|
|
34
|
+
declare global {
|
|
35
|
+
interface ExtendFrontMcpToolMetadata {
|
|
36
|
+
audit?: {
|
|
37
|
+
enabled: boolean;
|
|
38
|
+
level: 'info' | 'warn' | 'critical';
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
```typescript
|
|
45
|
+
// src/plugins/my-plugin/my-plugin.symbols.ts
|
|
46
|
+
import type { Token } from '@frontmcp/sdk';
|
|
47
|
+
import type { MyService } from './providers/my-service.provider';
|
|
48
|
+
|
|
49
|
+
export const MyServiceToken: Token<MyService> = Symbol('MyService');
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
```typescript
|
|
53
|
+
// src/plugins/my-plugin/providers/my-service.provider.ts
|
|
54
|
+
import { Provider } from '@frontmcp/sdk';
|
|
55
|
+
import type { MyPluginOptions } from '../my-plugin.types';
|
|
56
|
+
|
|
57
|
+
@Provider()
|
|
58
|
+
export class MyService {
|
|
59
|
+
private readonly endpoint: string;
|
|
60
|
+
private readonly refreshIntervalMs: number;
|
|
61
|
+
|
|
62
|
+
constructor(options: MyPluginOptions) {
|
|
63
|
+
this.endpoint = options.endpoint;
|
|
64
|
+
this.refreshIntervalMs = options.refreshIntervalMs;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
async query(params: Record<string, unknown>): Promise<unknown> {
|
|
68
|
+
const res = await globalThis.fetch(this.endpoint, {
|
|
69
|
+
method: 'POST',
|
|
70
|
+
headers: { 'Content-Type': 'application/json' },
|
|
71
|
+
body: JSON.stringify(params),
|
|
72
|
+
});
|
|
73
|
+
return res.json();
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
```typescript
|
|
79
|
+
// src/plugins/my-plugin/my-plugin.context-extension.ts
|
|
80
|
+
import type { MyService } from './providers/my-service.provider';
|
|
81
|
+
|
|
82
|
+
declare module '@frontmcp/sdk' {
|
|
83
|
+
interface ExecutionContextBase {
|
|
84
|
+
readonly myService: MyService;
|
|
85
|
+
}
|
|
86
|
+
interface PromptContext {
|
|
87
|
+
readonly myService: MyService;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
```typescript
|
|
93
|
+
// src/plugins/my-plugin/my-plugin.plugin.ts
|
|
94
|
+
import { Plugin, DynamicPlugin, ProviderType } from '@frontmcp/sdk';
|
|
95
|
+
import { MyService } from './providers/my-service.provider';
|
|
96
|
+
import { MyServiceToken } from './my-plugin.symbols';
|
|
97
|
+
import type { MyPluginOptions, MyPluginOptionsInput } from './my-plugin.types';
|
|
98
|
+
import './my-plugin.context-extension';
|
|
99
|
+
|
|
100
|
+
@Plugin({
|
|
101
|
+
name: 'my-plugin',
|
|
102
|
+
description: 'A configurable plugin with context extensions',
|
|
103
|
+
contextExtensions: [
|
|
104
|
+
{
|
|
105
|
+
property: 'myService',
|
|
106
|
+
token: MyServiceToken,
|
|
107
|
+
errorMessage: 'MyPlugin is not installed.',
|
|
108
|
+
},
|
|
109
|
+
],
|
|
110
|
+
})
|
|
111
|
+
export default class MyPlugin extends DynamicPlugin<MyPluginOptions, MyPluginOptionsInput> {
|
|
112
|
+
options: MyPluginOptions;
|
|
113
|
+
|
|
114
|
+
constructor(options: MyPluginOptionsInput = { endpoint: '' }) {
|
|
115
|
+
super();
|
|
116
|
+
this.options = { refreshIntervalMs: 30_000, ...options };
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
static override dynamicProviders(options: MyPluginOptionsInput): ProviderType[] {
|
|
120
|
+
return [
|
|
121
|
+
{
|
|
122
|
+
provide: MyServiceToken,
|
|
123
|
+
useFactory: () =>
|
|
124
|
+
new MyService({
|
|
125
|
+
refreshIntervalMs: 30_000,
|
|
126
|
+
...options,
|
|
127
|
+
}),
|
|
128
|
+
},
|
|
129
|
+
];
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
```typescript
|
|
135
|
+
// src/server.ts
|
|
136
|
+
import { FrontMcp, App, Tool, ToolContext } from '@frontmcp/sdk';
|
|
137
|
+
import MyPlugin from './plugins/my-plugin/my-plugin.plugin';
|
|
138
|
+
|
|
139
|
+
// Tool using the extended metadata field and context extension
|
|
140
|
+
@Tool({
|
|
141
|
+
name: 'delete_user',
|
|
142
|
+
audit: { enabled: true, level: 'critical' }, // Custom metadata from ExtendFrontMcpToolMetadata
|
|
143
|
+
})
|
|
144
|
+
class DeleteUserTool extends ToolContext {
|
|
145
|
+
async execute(input: { userId: string }) {
|
|
146
|
+
const result = await this.myService.query({ action: 'delete', userId: input.userId });
|
|
147
|
+
return result;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
@App({ name: 'MyApp', tools: [DeleteUserTool] })
|
|
152
|
+
class MyApp {}
|
|
153
|
+
|
|
154
|
+
@FrontMcp({
|
|
155
|
+
info: { name: 'my-server', version: '1.0.0' },
|
|
156
|
+
apps: [MyApp],
|
|
157
|
+
plugins: [
|
|
158
|
+
MyPlugin.init({
|
|
159
|
+
endpoint: 'https://api.example.com',
|
|
160
|
+
refreshIntervalMs: 60_000,
|
|
161
|
+
}),
|
|
162
|
+
],
|
|
163
|
+
})
|
|
164
|
+
class MyServer {}
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
## What This Demonstrates
|
|
168
|
+
|
|
169
|
+
- Extending `DynamicPlugin<TOptions, TInput>` for runtime-configurable plugins
|
|
170
|
+
- Implementing `static dynamicProviders()` to create providers from the input options
|
|
171
|
+
- Using `TInput` with optional fields and applying defaults in the constructor
|
|
172
|
+
- Extending decorator metadata via `declare global { interface ExtendFrontMcpToolMetadata }`
|
|
173
|
+
- Augmenting both `ExecutionContextBase` and `PromptContext` for full context extension coverage
|
|
174
|
+
- Registering the plugin with `MyPlugin.init({ ... })` in the `plugins` array
|
|
175
|
+
|
|
176
|
+
## Related
|
|
177
|
+
|
|
178
|
+
- See `create-plugin` for the full list of extensible metadata interfaces and the recommended folder structure
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: plugin-with-context-extension
|
|
3
|
+
reference: create-plugin
|
|
4
|
+
level: intermediate
|
|
5
|
+
description: 'A plugin that adds a `this.auditLog` property to all execution contexts using context extensions and module augmentation.'
|
|
6
|
+
tags: [development, sdk, plugin, context, extension]
|
|
7
|
+
features:
|
|
8
|
+
- "Defining a typed DI token with `Token<T> = Symbol('...')` in a dedicated symbols file"
|
|
9
|
+
- "Module augmentation via `declare module '@frontmcp/sdk'` to add `readonly auditLog` to `ExecutionContextBase`"
|
|
10
|
+
- 'Registering `contextExtensions` in `@Plugin` metadata with `property`, `token`, and `errorMessage`'
|
|
11
|
+
- 'Side-effect import of the context extension file in both the plugin and the barrel export'
|
|
12
|
+
- 'Accessing the extended property (`this.auditLog`) in tool execution contexts'
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
# Plugin with Context Extension
|
|
16
|
+
|
|
17
|
+
A plugin that adds a `this.auditLog` property to all execution contexts using context extensions and module augmentation.
|
|
18
|
+
|
|
19
|
+
## Code
|
|
20
|
+
|
|
21
|
+
```typescript
|
|
22
|
+
// src/plugins/audit-log/audit-log.symbols.ts
|
|
23
|
+
import type { Token } from '@frontmcp/sdk';
|
|
24
|
+
import type { AuditLogger } from './providers/audit-logger.provider';
|
|
25
|
+
|
|
26
|
+
export const AuditLoggerToken: Token<AuditLogger> = Symbol('AuditLogger');
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
```typescript
|
|
30
|
+
// src/plugins/audit-log/providers/audit-logger.provider.ts
|
|
31
|
+
import { Provider } from '@frontmcp/sdk';
|
|
32
|
+
|
|
33
|
+
@Provider()
|
|
34
|
+
export class AuditLogger {
|
|
35
|
+
async logToolCall(toolName: string, userId: string, input: unknown): Promise<void> {
|
|
36
|
+
console.log(`[AUDIT] ${userId} called ${toolName}`, input);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
```typescript
|
|
42
|
+
// src/plugins/audit-log/audit-log.context-extension.ts
|
|
43
|
+
import type { AuditLogger } from './providers/audit-logger.provider';
|
|
44
|
+
|
|
45
|
+
declare module '@frontmcp/sdk' {
|
|
46
|
+
interface ExecutionContextBase {
|
|
47
|
+
/** Audit logger provided by AuditLogPlugin */
|
|
48
|
+
readonly auditLog: AuditLogger;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
```typescript
|
|
54
|
+
// src/plugins/audit-log/audit-log.plugin.ts
|
|
55
|
+
import { Plugin } from '@frontmcp/sdk';
|
|
56
|
+
import { AuditLogger } from './providers/audit-logger.provider';
|
|
57
|
+
import { AuditLoggerToken } from './audit-log.symbols';
|
|
58
|
+
import './audit-log.context-extension'; // Side-effect import for type augmentation
|
|
59
|
+
|
|
60
|
+
@Plugin({
|
|
61
|
+
name: 'audit-log',
|
|
62
|
+
description: 'Logs tool executions for audit compliance',
|
|
63
|
+
providers: [{ provide: AuditLoggerToken, useClass: AuditLogger }],
|
|
64
|
+
exports: [AuditLoggerToken],
|
|
65
|
+
contextExtensions: [
|
|
66
|
+
{
|
|
67
|
+
property: 'auditLog',
|
|
68
|
+
token: AuditLoggerToken,
|
|
69
|
+
errorMessage: 'AuditLogPlugin is not installed. Add it to your @FrontMcp plugins array.',
|
|
70
|
+
},
|
|
71
|
+
],
|
|
72
|
+
})
|
|
73
|
+
export default class AuditLogPlugin {}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
```typescript
|
|
77
|
+
// src/plugins/audit-log/index.ts
|
|
78
|
+
import './audit-log.context-extension'; // Side-effect import for type augmentation
|
|
79
|
+
export { default as AuditLogPlugin } from './audit-log.plugin';
|
|
80
|
+
export { AuditLoggerToken } from './audit-log.symbols';
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
```typescript
|
|
84
|
+
// src/tools/delete-record.tool.ts
|
|
85
|
+
import { Tool, ToolContext } from '@frontmcp/sdk';
|
|
86
|
+
|
|
87
|
+
@Tool({ name: 'delete_record' })
|
|
88
|
+
class DeleteRecordTool extends ToolContext {
|
|
89
|
+
async execute(input: { recordId: string }) {
|
|
90
|
+
// this.auditLog is available because AuditLogPlugin is installed
|
|
91
|
+
await this.auditLog.logToolCall('delete_record', this.scope.userId, input);
|
|
92
|
+
return { deleted: true };
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## What This Demonstrates
|
|
98
|
+
|
|
99
|
+
- Defining a typed DI token with `Token<T> = Symbol('...')` in a dedicated symbols file
|
|
100
|
+
- Module augmentation via `declare module '@frontmcp/sdk'` to add `readonly auditLog` to `ExecutionContextBase`
|
|
101
|
+
- Registering `contextExtensions` in `@Plugin` metadata with `property`, `token`, and `errorMessage`
|
|
102
|
+
- Side-effect import of the context extension file in both the plugin and the barrel export
|
|
103
|
+
- Accessing the extended property (`this.auditLog`) in tool execution contexts
|
|
104
|
+
|
|
105
|
+
## Related
|
|
106
|
+
|
|
107
|
+
- See `create-plugin` for the full context extension pattern, metadata extensions, and DynamicPlugin
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: basic-logging-plugin
|
|
3
|
+
reference: create-plugin-hooks
|
|
4
|
+
level: basic
|
|
5
|
+
description: 'Demonstrates a plugin that logs tool execution using `@Will` and `@Did` hook decorators from the pre-built `ToolHook` export.'
|
|
6
|
+
tags: [development, plugin-hooks, plugin, hooks, logging]
|
|
7
|
+
features:
|
|
8
|
+
- "Using `ToolHook` pre-built export instead of calling `FlowHooksOf('tools:call-tool')` directly"
|
|
9
|
+
- 'Destructuring `Will` and `Did` decorators from the hook object'
|
|
10
|
+
- 'Setting `priority: 100` on `@Will` to ensure the logging hook runs early'
|
|
11
|
+
- 'Registering a plugin in the `plugins` array of `@App`'
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
# Basic Logging Plugin with @Will and @Did
|
|
15
|
+
|
|
16
|
+
Demonstrates a plugin that logs tool execution using `@Will` and `@Did` hook decorators from the pre-built `ToolHook` export.
|
|
17
|
+
|
|
18
|
+
## Code
|
|
19
|
+
|
|
20
|
+
```typescript
|
|
21
|
+
// src/plugins/logging.plugin.ts
|
|
22
|
+
import { Plugin } from '@frontmcp/sdk';
|
|
23
|
+
import { ToolHook } from '@frontmcp/sdk';
|
|
24
|
+
|
|
25
|
+
const { Will, Did } = ToolHook;
|
|
26
|
+
|
|
27
|
+
@Plugin({ name: 'logging-plugin' })
|
|
28
|
+
export class LoggingPlugin {
|
|
29
|
+
@Will('execute', { priority: 100 })
|
|
30
|
+
logBefore(ctx) {
|
|
31
|
+
console.log(`[LOG] Tool "${ctx.toolName}" called with`, ctx.input);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
@Did('execute')
|
|
35
|
+
logAfter(ctx) {
|
|
36
|
+
console.log(`[LOG] Tool "${ctx.toolName}" completed in ${ctx.elapsed()}ms`);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
```typescript
|
|
42
|
+
// src/server.ts
|
|
43
|
+
import { FrontMcp, App } from '@frontmcp/sdk';
|
|
44
|
+
import { LoggingPlugin } from './plugins/logging.plugin';
|
|
45
|
+
|
|
46
|
+
@App({
|
|
47
|
+
name: 'my-app',
|
|
48
|
+
plugins: [LoggingPlugin],
|
|
49
|
+
})
|
|
50
|
+
class MyApp {}
|
|
51
|
+
|
|
52
|
+
@FrontMcp({
|
|
53
|
+
info: { name: 'my-server', version: '1.0.0' },
|
|
54
|
+
apps: [MyApp],
|
|
55
|
+
})
|
|
56
|
+
class MyServer {}
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## What This Demonstrates
|
|
60
|
+
|
|
61
|
+
- Using `ToolHook` pre-built export instead of calling `FlowHooksOf('tools:call-tool')` directly
|
|
62
|
+
- Destructuring `Will` and `Did` decorators from the hook object
|
|
63
|
+
- Setting `priority: 100` on `@Will` to ensure the logging hook runs early
|
|
64
|
+
- Registering a plugin in the `plugins` array of `@App`
|
|
65
|
+
|
|
66
|
+
## Related
|
|
67
|
+
|
|
68
|
+
- See `create-plugin-hooks` for the full hook decorator API reference
|
|
69
|
+
- See `official-plugins` for ready-made plugins that include logging capabilities
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: caching-with-around
|
|
3
|
+
reference: create-plugin-hooks
|
|
4
|
+
level: intermediate
|
|
5
|
+
description: 'Demonstrates wrapping tool execution with an `@Around` hook to implement result caching with TTL-based expiry.'
|
|
6
|
+
tags: [development, cache, plugin-hooks, plugin, hooks, caching]
|
|
7
|
+
features:
|
|
8
|
+
- 'Using `@Around` to wrap the `execute` stage with before-and-after logic'
|
|
9
|
+
- 'Calling `await next()` to invoke the original stage and capture its result'
|
|
10
|
+
- 'Short-circuiting execution by returning cached data without calling `next()`'
|
|
11
|
+
- 'Building a cache key from `ctx.toolName` and `ctx.input`'
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
# Caching Plugin with @Around Hook
|
|
15
|
+
|
|
16
|
+
Demonstrates wrapping tool execution with an `@Around` hook to implement result caching with TTL-based expiry.
|
|
17
|
+
|
|
18
|
+
## Code
|
|
19
|
+
|
|
20
|
+
```typescript
|
|
21
|
+
// src/plugins/cache.plugin.ts
|
|
22
|
+
import { Plugin } from '@frontmcp/sdk';
|
|
23
|
+
import { ToolHook } from '@frontmcp/sdk';
|
|
24
|
+
|
|
25
|
+
const { Around } = ToolHook;
|
|
26
|
+
|
|
27
|
+
@Plugin({ name: 'cache-plugin' })
|
|
28
|
+
export class CachePlugin {
|
|
29
|
+
private cache = new Map<string, { data: unknown; expiry: number }>();
|
|
30
|
+
|
|
31
|
+
@Around('execute', { priority: 90 })
|
|
32
|
+
async cacheResults(ctx, next) {
|
|
33
|
+
const key = `${ctx.toolName}:${JSON.stringify(ctx.input)}`;
|
|
34
|
+
const cached = this.cache.get(key);
|
|
35
|
+
|
|
36
|
+
if (cached && cached.expiry > Date.now()) {
|
|
37
|
+
return cached.data;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const result = await next();
|
|
41
|
+
|
|
42
|
+
this.cache.set(key, {
|
|
43
|
+
data: result,
|
|
44
|
+
expiry: Date.now() + 60_000,
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
return result;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
```typescript
|
|
53
|
+
// src/server.ts
|
|
54
|
+
import { FrontMcp, App } from '@frontmcp/sdk';
|
|
55
|
+
import { CachePlugin } from './plugins/cache.plugin';
|
|
56
|
+
|
|
57
|
+
@App({
|
|
58
|
+
name: 'my-app',
|
|
59
|
+
plugins: [CachePlugin],
|
|
60
|
+
})
|
|
61
|
+
class MyApp {}
|
|
62
|
+
|
|
63
|
+
@FrontMcp({
|
|
64
|
+
info: { name: 'cached-server', version: '1.0.0' },
|
|
65
|
+
apps: [MyApp],
|
|
66
|
+
})
|
|
67
|
+
class MyServer {}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## What This Demonstrates
|
|
71
|
+
|
|
72
|
+
- Using `@Around` to wrap the `execute` stage with before-and-after logic
|
|
73
|
+
- Calling `await next()` to invoke the original stage and capture its result
|
|
74
|
+
- Short-circuiting execution by returning cached data without calling `next()`
|
|
75
|
+
- Building a cache key from `ctx.toolName` and `ctx.input`
|
|
76
|
+
|
|
77
|
+
## Related
|
|
78
|
+
|
|
79
|
+
- See `create-plugin-hooks` for all hook decorator types and their timing
|
|
80
|
+
- See `official-plugins` for the production-ready `CachePlugin` from `@frontmcp/plugin-cache`
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: tool-level-hooks-and-stage-replacement
|
|
3
|
+
reference: create-plugin-hooks
|
|
4
|
+
level: advanced
|
|
5
|
+
description: 'Demonstrates two advanced patterns: adding `@Will`/`@Did` hooks directly on a `@Tool` class (scoped to that tool only), and using `@Stage` in a plugin to replace a flow stage entirely with a filtered mock.'
|
|
6
|
+
tags: [development, plugin-hooks, plugin, hooks, tool, level]
|
|
7
|
+
features:
|
|
8
|
+
- "Placing `@Will('execute')` and `@Did('execute')` directly on a `@Tool` class so hooks fire only for that tool"
|
|
9
|
+
- 'Using `this.fail()` in a `@Will` hook to abort execution when preconditions are not met'
|
|
10
|
+
- 'Using `this.mark()` to record lifecycle checkpoints during hook execution'
|
|
11
|
+
- 'Using `@Stage` with a `filter` predicate to replace the `execute` stage only for a specific tool name'
|
|
12
|
+
- 'The difference between tool-level hooks (scoped to one tool) and plugin-level hooks (fire for all tools)'
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
# Tool-Level Hooks and Stage Replacement
|
|
16
|
+
|
|
17
|
+
Demonstrates two advanced patterns: adding `@Will`/`@Did` hooks directly on a `@Tool` class (scoped to that tool only), and using `@Stage` in a plugin to replace a flow stage entirely with a filtered mock.
|
|
18
|
+
|
|
19
|
+
## Code
|
|
20
|
+
|
|
21
|
+
```typescript
|
|
22
|
+
// src/tools/process-order.tool.ts
|
|
23
|
+
import { Tool, ToolContext } from '@frontmcp/sdk';
|
|
24
|
+
import { ToolHook } from '@frontmcp/sdk';
|
|
25
|
+
import { z } from 'zod';
|
|
26
|
+
|
|
27
|
+
const { Will, Did } = ToolHook;
|
|
28
|
+
|
|
29
|
+
@Tool({
|
|
30
|
+
name: 'process_order',
|
|
31
|
+
description: 'Process a customer order',
|
|
32
|
+
inputSchema: {
|
|
33
|
+
orderId: z.string(),
|
|
34
|
+
amount: z.number(),
|
|
35
|
+
},
|
|
36
|
+
outputSchema: { status: z.string(), receipt: z.string() },
|
|
37
|
+
})
|
|
38
|
+
class ProcessOrderTool extends ToolContext {
|
|
39
|
+
@Will('execute', { priority: 10 })
|
|
40
|
+
async beforeExecute() {
|
|
41
|
+
const db = this.get(DB_TOKEN);
|
|
42
|
+
const order = await db.findOrder(this.input.orderId);
|
|
43
|
+
if (!order) {
|
|
44
|
+
this.fail(new Error(`Order ${this.input.orderId} not found`));
|
|
45
|
+
}
|
|
46
|
+
if (order.status === 'completed') {
|
|
47
|
+
this.fail(new Error('Order already processed'));
|
|
48
|
+
}
|
|
49
|
+
this.mark('validated');
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
async execute(input: { orderId: string; amount: number }) {
|
|
53
|
+
const payment = this.get(PAYMENT_TOKEN);
|
|
54
|
+
const receipt = await payment.charge(input.orderId, input.amount);
|
|
55
|
+
return { status: 'completed', receipt: receipt.id };
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
@Did('execute')
|
|
59
|
+
async afterExecute() {
|
|
60
|
+
const analytics = this.tryGet(ANALYTICS_TOKEN);
|
|
61
|
+
if (analytics) {
|
|
62
|
+
await analytics.track('order_processed', {
|
|
63
|
+
orderId: this.input.orderId,
|
|
64
|
+
amount: this.input.amount,
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
```typescript
|
|
72
|
+
// src/plugins/mock.plugin.ts
|
|
73
|
+
import { Plugin } from '@frontmcp/sdk';
|
|
74
|
+
import { ToolHook } from '@frontmcp/sdk';
|
|
75
|
+
|
|
76
|
+
const { Stage } = ToolHook;
|
|
77
|
+
|
|
78
|
+
@Plugin({ name: 'mock-plugin' })
|
|
79
|
+
export class MockPlugin {
|
|
80
|
+
@Stage('execute', {
|
|
81
|
+
filter: (ctx) => ctx.toolName === 'fetch_weather',
|
|
82
|
+
})
|
|
83
|
+
mockWeather(ctx) {
|
|
84
|
+
return { content: [{ type: 'text', text: '72F and sunny' }] };
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## What This Demonstrates
|
|
90
|
+
|
|
91
|
+
- Placing `@Will('execute')` and `@Did('execute')` directly on a `@Tool` class so hooks fire only for that tool
|
|
92
|
+
- Using `this.fail()` in a `@Will` hook to abort execution when preconditions are not met
|
|
93
|
+
- Using `this.mark()` to record lifecycle checkpoints during hook execution
|
|
94
|
+
- Using `@Stage` with a `filter` predicate to replace the `execute` stage only for a specific tool name
|
|
95
|
+
- The difference between tool-level hooks (scoped to one tool) and plugin-level hooks (fire for all tools)
|
|
96
|
+
|
|
97
|
+
## Related
|
|
98
|
+
|
|
99
|
+
- See `create-plugin-hooks` for the full list of hookable stages in the `call-tool` flow
|
|
100
|
+
- See `decorators-guide` for the complete decorator hierarchy including `@Tool` and `@Plugin`
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: basic-prompt
|
|
3
|
+
reference: create-prompt
|
|
4
|
+
level: basic
|
|
5
|
+
description: 'A simple prompt that generates a structured code review message from user-provided arguments.'
|
|
6
|
+
tags: [development, prompt, create-prompt]
|
|
7
|
+
features:
|
|
8
|
+
- 'Extending `PromptContext` and implementing `execute(args)` returning `GetPromptResult`'
|
|
9
|
+
- 'Declaring prompt `arguments` with `required: true` for mandatory parameters'
|
|
10
|
+
- 'Framework validates required arguments before `execute()` runs'
|
|
11
|
+
- 'Registering the prompt in the `prompts` array of `@App`'
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
# Basic Prompt with Arguments
|
|
15
|
+
|
|
16
|
+
A simple prompt that generates a structured code review message from user-provided arguments.
|
|
17
|
+
|
|
18
|
+
## Code
|
|
19
|
+
|
|
20
|
+
```typescript
|
|
21
|
+
// src/apps/main/prompts/code-review.prompt.ts
|
|
22
|
+
import { Prompt, PromptContext } from '@frontmcp/sdk';
|
|
23
|
+
import { GetPromptResult } from '@frontmcp/protocol';
|
|
24
|
+
|
|
25
|
+
@Prompt({
|
|
26
|
+
name: 'code-review',
|
|
27
|
+
description: 'Generate a structured code review for the given code',
|
|
28
|
+
arguments: [
|
|
29
|
+
{ name: 'code', description: 'The code to review', required: true },
|
|
30
|
+
{ name: 'language', description: 'Programming language', required: false },
|
|
31
|
+
],
|
|
32
|
+
})
|
|
33
|
+
class CodeReviewPrompt extends PromptContext {
|
|
34
|
+
async execute(args: Record<string, string>): Promise<GetPromptResult> {
|
|
35
|
+
const language = args.language ?? 'unknown language';
|
|
36
|
+
|
|
37
|
+
return {
|
|
38
|
+
messages: [
|
|
39
|
+
{
|
|
40
|
+
role: 'user',
|
|
41
|
+
content: {
|
|
42
|
+
type: 'text',
|
|
43
|
+
text: `Please review the following ${language} code. Focus on correctness, performance, and maintainability.\n\n\`\`\`${language}\n${args.code}\n\`\`\``,
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
],
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
```typescript
|
|
53
|
+
// src/apps/main/index.ts
|
|
54
|
+
import { App } from '@frontmcp/sdk';
|
|
55
|
+
|
|
56
|
+
@App({
|
|
57
|
+
name: 'main',
|
|
58
|
+
prompts: [CodeReviewPrompt],
|
|
59
|
+
})
|
|
60
|
+
class MainApp {}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## What This Demonstrates
|
|
64
|
+
|
|
65
|
+
- Extending `PromptContext` and implementing `execute(args)` returning `GetPromptResult`
|
|
66
|
+
- Declaring prompt `arguments` with `required: true` for mandatory parameters
|
|
67
|
+
- Framework validates required arguments before `execute()` runs
|
|
68
|
+
- Registering the prompt in the `prompts` array of `@App`
|
|
69
|
+
|
|
70
|
+
## Related
|
|
71
|
+
|
|
72
|
+
- See `create-prompt` for multi-turn conversations, resource embedding, and function-style builders
|