@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,92 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: dynamic-rag-prompt
|
|
3
|
+
reference: create-prompt
|
|
4
|
+
level: advanced
|
|
5
|
+
description: 'A prompt that queries a knowledge base via DI to build context-aware messages at runtime.'
|
|
6
|
+
tags: [development, prompt, dynamic, rag]
|
|
7
|
+
features:
|
|
8
|
+
- 'Performing async operations (knowledge base search) inside `execute()` to generate context-aware prompts'
|
|
9
|
+
- 'Resolving a DI provider via `this.get(KNOWLEDGE_BASE)` for service access'
|
|
10
|
+
- 'Using `this.mark(stage)` for execution stage tracking in complex prompt generation'
|
|
11
|
+
- 'Building dynamic message content from external data sources at runtime'
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
# Dynamic RAG Prompt with Dependency Injection
|
|
15
|
+
|
|
16
|
+
A prompt that queries a knowledge base via DI to build context-aware messages at runtime.
|
|
17
|
+
|
|
18
|
+
## Code
|
|
19
|
+
|
|
20
|
+
```typescript
|
|
21
|
+
// src/apps/main/tokens.ts
|
|
22
|
+
import type { Token } from '@frontmcp/di';
|
|
23
|
+
|
|
24
|
+
export interface KnowledgeBase {
|
|
25
|
+
search(query: string, limit: number): Promise<Array<{ title: string; content: string }>>;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export const KNOWLEDGE_BASE: Token<KnowledgeBase> = Symbol('knowledge-base');
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
```typescript
|
|
32
|
+
// src/apps/main/prompts/rag-query.prompt.ts
|
|
33
|
+
import { Prompt, PromptContext } from '@frontmcp/sdk';
|
|
34
|
+
import { GetPromptResult } from '@frontmcp/protocol';
|
|
35
|
+
import { KNOWLEDGE_BASE } from '../tokens';
|
|
36
|
+
|
|
37
|
+
@Prompt({
|
|
38
|
+
name: 'rag-query',
|
|
39
|
+
description: 'Answer a question using knowledge base context',
|
|
40
|
+
arguments: [
|
|
41
|
+
{ name: 'question', description: 'The question to answer', required: true },
|
|
42
|
+
{ name: 'maxSources', description: 'Maximum number of sources to include', required: false },
|
|
43
|
+
],
|
|
44
|
+
})
|
|
45
|
+
class RagQueryPrompt extends PromptContext {
|
|
46
|
+
async execute(args: Record<string, string>): Promise<GetPromptResult> {
|
|
47
|
+
this.mark('search');
|
|
48
|
+
const kb = this.get(KNOWLEDGE_BASE);
|
|
49
|
+
const maxSources = parseInt(args.maxSources ?? '3', 10);
|
|
50
|
+
const sources = await kb.search(args.question, maxSources);
|
|
51
|
+
|
|
52
|
+
this.mark('compose');
|
|
53
|
+
const contextBlock = sources.map((s, i) => `### Source ${i + 1}: ${s.title}\n${s.content}`).join('\n\n');
|
|
54
|
+
|
|
55
|
+
return {
|
|
56
|
+
messages: [
|
|
57
|
+
{
|
|
58
|
+
role: 'user',
|
|
59
|
+
content: {
|
|
60
|
+
type: 'text',
|
|
61
|
+
text: `Answer the following question using only the provided sources. If the sources do not contain enough information, say so clearly.\n\n**Question:** ${args.question}\n\n---\n\n${contextBlock}`,
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
],
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
```typescript
|
|
71
|
+
// src/apps/main/index.ts
|
|
72
|
+
import { App } from '@frontmcp/sdk';
|
|
73
|
+
|
|
74
|
+
@App({
|
|
75
|
+
name: 'main',
|
|
76
|
+
providers: [KnowledgeBaseProvider],
|
|
77
|
+
prompts: [RagQueryPrompt],
|
|
78
|
+
})
|
|
79
|
+
class MainApp {}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## What This Demonstrates
|
|
83
|
+
|
|
84
|
+
- Performing async operations (knowledge base search) inside `execute()` to generate context-aware prompts
|
|
85
|
+
- Resolving a DI provider via `this.get(KNOWLEDGE_BASE)` for service access
|
|
86
|
+
- Using `this.mark(stage)` for execution stage tracking in complex prompt generation
|
|
87
|
+
- Building dynamic message content from external data sources at runtime
|
|
88
|
+
|
|
89
|
+
## Related
|
|
90
|
+
|
|
91
|
+
- See `create-prompt` for resource embedding, function-style builders, and error handling with `this.fail()`
|
|
92
|
+
- See `create-provider` for implementing the `KnowledgeBaseProvider`
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: multi-turn-debug-session
|
|
3
|
+
reference: create-prompt
|
|
4
|
+
level: intermediate
|
|
5
|
+
description: 'A prompt that uses alternating user/assistant messages to guide a structured debugging conversation.'
|
|
6
|
+
tags: [development, session, prompt, multi, turn, debug]
|
|
7
|
+
features:
|
|
8
|
+
- 'Using `assistant` role messages to prime expected response patterns and guide LLM behavior'
|
|
9
|
+
- 'Alternating `user` and `assistant` roles to create a structured multi-turn conversation'
|
|
10
|
+
- 'Optional arguments that conditionally add content to the prompt'
|
|
11
|
+
- 'The assistant message establishes a systematic debugging approach the LLM will follow'
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
# Multi-Turn Debug Session Prompt
|
|
15
|
+
|
|
16
|
+
A prompt that uses alternating user/assistant messages to guide a structured debugging conversation.
|
|
17
|
+
|
|
18
|
+
## Code
|
|
19
|
+
|
|
20
|
+
```typescript
|
|
21
|
+
// src/apps/main/prompts/debug-session.prompt.ts
|
|
22
|
+
import { Prompt, PromptContext } from '@frontmcp/sdk';
|
|
23
|
+
import { GetPromptResult } from '@frontmcp/protocol';
|
|
24
|
+
|
|
25
|
+
@Prompt({
|
|
26
|
+
name: 'debug-session',
|
|
27
|
+
description: 'Start a structured debugging session',
|
|
28
|
+
arguments: [
|
|
29
|
+
{ name: 'error', description: 'The error message or stack trace', required: true },
|
|
30
|
+
{ name: 'context', description: 'Additional context about what was happening', required: false },
|
|
31
|
+
],
|
|
32
|
+
})
|
|
33
|
+
class DebugSessionPrompt extends PromptContext {
|
|
34
|
+
async execute(args: Record<string, string>): Promise<GetPromptResult> {
|
|
35
|
+
const contextNote = args.context ? `\n\nAdditional context: ${args.context}` : '';
|
|
36
|
+
|
|
37
|
+
return {
|
|
38
|
+
messages: [
|
|
39
|
+
{
|
|
40
|
+
role: 'user',
|
|
41
|
+
content: {
|
|
42
|
+
type: 'text',
|
|
43
|
+
text: `I encountered an error and need help debugging it.\n\nError:\n\`\`\`\n${args.error}\n\`\`\`${contextNote}`,
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
role: 'assistant',
|
|
48
|
+
content: {
|
|
49
|
+
type: 'text',
|
|
50
|
+
text: "I'll help you debug this. Let me analyze the error systematically.\n\n**Step 1: Error Classification**\nLet me first identify what type of error this is and its likely root cause.\n\n",
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
role: 'user',
|
|
55
|
+
content: {
|
|
56
|
+
type: 'text',
|
|
57
|
+
text: 'Please continue with your analysis and suggest specific fixes.',
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
],
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
```typescript
|
|
67
|
+
// src/apps/main/index.ts
|
|
68
|
+
import { App } from '@frontmcp/sdk';
|
|
69
|
+
|
|
70
|
+
@App({
|
|
71
|
+
name: 'main',
|
|
72
|
+
prompts: [DebugSessionPrompt],
|
|
73
|
+
})
|
|
74
|
+
class MainApp {}
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## What This Demonstrates
|
|
78
|
+
|
|
79
|
+
- Using `assistant` role messages to prime expected response patterns and guide LLM behavior
|
|
80
|
+
- Alternating `user` and `assistant` roles to create a structured multi-turn conversation
|
|
81
|
+
- Optional arguments that conditionally add content to the prompt
|
|
82
|
+
- The assistant message establishes a systematic debugging approach the LLM will follow
|
|
83
|
+
|
|
84
|
+
## Related
|
|
85
|
+
|
|
86
|
+
- See `create-prompt` for dynamic prompt generation with DI, resource embedding, and error handling
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: basic-database-provider
|
|
3
|
+
reference: create-provider
|
|
4
|
+
level: basic
|
|
5
|
+
description: 'A provider that manages a database connection pool with `onInit()` and `onDestroy()` lifecycle hooks.'
|
|
6
|
+
tags: [development, database, provider]
|
|
7
|
+
features:
|
|
8
|
+
- 'Defining a typed token with `Token<T>` using a `Symbol` for DI identification'
|
|
9
|
+
- 'Using `@Provider` decorator with `onInit()` for async startup and `onDestroy()` for cleanup'
|
|
10
|
+
- 'Consuming the provider in a tool via `this.get(DB_TOKEN)` with full type safety'
|
|
11
|
+
- 'Registering the provider in the `providers` array so tools can resolve it'
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
# Basic Database Provider with Lifecycle
|
|
15
|
+
|
|
16
|
+
A provider that manages a database connection pool with `onInit()` and `onDestroy()` lifecycle hooks.
|
|
17
|
+
|
|
18
|
+
## Code
|
|
19
|
+
|
|
20
|
+
```typescript
|
|
21
|
+
// src/apps/main/tokens.ts
|
|
22
|
+
import type { Token } from '@frontmcp/di';
|
|
23
|
+
|
|
24
|
+
export interface DatabaseService {
|
|
25
|
+
query(sql: string, params?: unknown[]): Promise<unknown[]>;
|
|
26
|
+
close(): Promise<void>;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export const DB_TOKEN: Token<DatabaseService> = Symbol('DatabaseService');
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
```typescript
|
|
33
|
+
// src/apps/main/providers/database.provider.ts
|
|
34
|
+
import { Provider } from '@frontmcp/sdk';
|
|
35
|
+
import { createPool, Pool } from 'your-db-driver';
|
|
36
|
+
|
|
37
|
+
@Provider({ name: 'DatabaseProvider' })
|
|
38
|
+
class DatabaseProvider implements DatabaseService {
|
|
39
|
+
private pool!: Pool;
|
|
40
|
+
|
|
41
|
+
async onInit() {
|
|
42
|
+
this.pool = await createPool({
|
|
43
|
+
connectionString: process.env.DATABASE_URL,
|
|
44
|
+
max: 20,
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
async query(sql: string, params?: unknown[]) {
|
|
49
|
+
return this.pool.query(sql, params);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
async close() {
|
|
53
|
+
await this.pool.end();
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
async onDestroy() {
|
|
57
|
+
await this.pool.end();
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
```typescript
|
|
63
|
+
// src/apps/main/tools/query-users.tool.ts
|
|
64
|
+
import { Tool, ToolContext } from '@frontmcp/sdk';
|
|
65
|
+
import { z } from 'zod';
|
|
66
|
+
import { DB_TOKEN } from '../tokens';
|
|
67
|
+
|
|
68
|
+
@Tool({
|
|
69
|
+
name: 'query_users',
|
|
70
|
+
description: 'Query users from the database',
|
|
71
|
+
inputSchema: {
|
|
72
|
+
filter: z.string().optional(),
|
|
73
|
+
limit: z.number().default(10),
|
|
74
|
+
},
|
|
75
|
+
outputSchema: {
|
|
76
|
+
users: z.array(z.object({ id: z.string(), name: z.string(), email: z.string() })),
|
|
77
|
+
},
|
|
78
|
+
})
|
|
79
|
+
class QueryUsersTool extends ToolContext {
|
|
80
|
+
async execute(input: { filter?: string; limit: number }) {
|
|
81
|
+
const db = this.get(DB_TOKEN);
|
|
82
|
+
const users = await db.query('SELECT id, name, email FROM users WHERE name LIKE $1 LIMIT $2', [
|
|
83
|
+
`%${input.filter ?? ''}%`,
|
|
84
|
+
input.limit,
|
|
85
|
+
]);
|
|
86
|
+
return { users };
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
```typescript
|
|
92
|
+
// src/apps/main/index.ts
|
|
93
|
+
import { App } from '@frontmcp/sdk';
|
|
94
|
+
|
|
95
|
+
@App({
|
|
96
|
+
name: 'main',
|
|
97
|
+
providers: [DatabaseProvider],
|
|
98
|
+
tools: [QueryUsersTool],
|
|
99
|
+
})
|
|
100
|
+
class MainApp {}
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## What This Demonstrates
|
|
104
|
+
|
|
105
|
+
- Defining a typed token with `Token<T>` using a `Symbol` for DI identification
|
|
106
|
+
- Using `@Provider` decorator with `onInit()` for async startup and `onDestroy()` for cleanup
|
|
107
|
+
- Consuming the provider in a tool via `this.get(DB_TOKEN)` with full type safety
|
|
108
|
+
- Registering the provider in the `providers` array so tools can resolve it
|
|
109
|
+
|
|
110
|
+
## Related
|
|
111
|
+
|
|
112
|
+
- See `create-provider` for configuration providers, HTTP API clients, and cache providers
|
|
113
|
+
- See `create-tool` for more patterns using DI in tool execution
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: config-and-api-providers
|
|
3
|
+
reference: create-provider
|
|
4
|
+
level: intermediate
|
|
5
|
+
description: 'A configuration provider with readonly environment settings and an HTTP API client provider.'
|
|
6
|
+
tags: [development, provider, config, api, providers]
|
|
7
|
+
features:
|
|
8
|
+
- 'A configuration provider using `readonly` properties from environment variables (no lifecycle needed)'
|
|
9
|
+
- 'An API client provider using `onInit()` for async setup of credentials'
|
|
10
|
+
- 'Registering providers at `@FrontMcp` level for server-wide sharing across all apps'
|
|
11
|
+
- 'Separating token definitions from provider implementations for clean dependency boundaries'
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
# Configuration and API Client Providers
|
|
15
|
+
|
|
16
|
+
A configuration provider with readonly environment settings and an HTTP API client provider.
|
|
17
|
+
|
|
18
|
+
## Code
|
|
19
|
+
|
|
20
|
+
```typescript
|
|
21
|
+
// src/apps/main/tokens.ts
|
|
22
|
+
import type { Token } from '@frontmcp/di';
|
|
23
|
+
|
|
24
|
+
export interface AppConfig {
|
|
25
|
+
apiBaseUrl: string;
|
|
26
|
+
maxRetries: number;
|
|
27
|
+
debug: boolean;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export const CONFIG_TOKEN: Token<AppConfig> = Symbol('AppConfig');
|
|
31
|
+
|
|
32
|
+
export interface ApiClient {
|
|
33
|
+
get(path: string): Promise<unknown>;
|
|
34
|
+
post(path: string, body: unknown): Promise<unknown>;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export const API_TOKEN: Token<ApiClient> = Symbol('ApiClient');
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
```typescript
|
|
41
|
+
// src/apps/main/providers/config.provider.ts
|
|
42
|
+
import { Provider } from '@frontmcp/sdk';
|
|
43
|
+
import type { AppConfig } from '../tokens';
|
|
44
|
+
|
|
45
|
+
@Provider({ name: 'ConfigProvider' })
|
|
46
|
+
class ConfigProvider implements AppConfig {
|
|
47
|
+
readonly apiBaseUrl = process.env.API_BASE_URL ?? 'https://api.example.com';
|
|
48
|
+
readonly maxRetries = Number(process.env.MAX_RETRIES ?? 3);
|
|
49
|
+
readonly debug = process.env.DEBUG === 'true';
|
|
50
|
+
}
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
```typescript
|
|
54
|
+
// src/apps/main/providers/api-client.provider.ts
|
|
55
|
+
import { Provider } from '@frontmcp/sdk';
|
|
56
|
+
import type { ApiClient } from '../tokens';
|
|
57
|
+
|
|
58
|
+
@Provider({ name: 'ApiClientProvider' })
|
|
59
|
+
class ApiClientProvider implements ApiClient {
|
|
60
|
+
private baseUrl!: string;
|
|
61
|
+
private apiKey!: string;
|
|
62
|
+
|
|
63
|
+
async onInit() {
|
|
64
|
+
this.baseUrl = process.env.API_URL!;
|
|
65
|
+
this.apiKey = process.env.API_KEY!;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
async get(path: string) {
|
|
69
|
+
const res = await fetch(`${this.baseUrl}${path}`, {
|
|
70
|
+
headers: { Authorization: `Bearer ${this.apiKey}` },
|
|
71
|
+
});
|
|
72
|
+
return res.json();
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
async post(path: string, body: unknown) {
|
|
76
|
+
const res = await fetch(`${this.baseUrl}${path}`, {
|
|
77
|
+
method: 'POST',
|
|
78
|
+
headers: { Authorization: `Bearer ${this.apiKey}`, 'Content-Type': 'application/json' },
|
|
79
|
+
body: JSON.stringify(body),
|
|
80
|
+
});
|
|
81
|
+
return res.json();
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
```typescript
|
|
87
|
+
// src/index.ts
|
|
88
|
+
import { FrontMcp } from '@frontmcp/sdk';
|
|
89
|
+
|
|
90
|
+
@FrontMcp({
|
|
91
|
+
info: { name: 'my-server', version: '1.0.0' },
|
|
92
|
+
apps: [MainApp],
|
|
93
|
+
providers: [ConfigProvider, ApiClientProvider], // Server-scoped: shared across all apps
|
|
94
|
+
})
|
|
95
|
+
class MyServer {}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## What This Demonstrates
|
|
99
|
+
|
|
100
|
+
- A configuration provider using `readonly` properties from environment variables (no lifecycle needed)
|
|
101
|
+
- An API client provider using `onInit()` for async setup of credentials
|
|
102
|
+
- Registering providers at `@FrontMcp` level for server-wide sharing across all apps
|
|
103
|
+
- Separating token definitions from provider implementations for clean dependency boundaries
|
|
104
|
+
|
|
105
|
+
## Related
|
|
106
|
+
|
|
107
|
+
- See `create-provider` for cache providers, lifecycle details, and the `tryGet()` safe access pattern
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: basic-static-resource
|
|
3
|
+
reference: create-resource
|
|
4
|
+
level: basic
|
|
5
|
+
description: 'A static resource that exposes application configuration at a fixed URI.'
|
|
6
|
+
tags: [development, resource, static]
|
|
7
|
+
features:
|
|
8
|
+
- 'Using `@Resource` with a fixed URI that follows RFC 3986 (has a valid scheme)'
|
|
9
|
+
- 'Returning a `ReadResourceResult` with `contents` array containing `uri`, `mimeType`, and `text`'
|
|
10
|
+
- 'Setting `mimeType` to indicate the content type of the resource'
|
|
11
|
+
- 'Registering the resource in the `resources` array of `@App`'
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
# Basic Static Resource
|
|
15
|
+
|
|
16
|
+
A static resource that exposes application configuration at a fixed URI.
|
|
17
|
+
|
|
18
|
+
## Code
|
|
19
|
+
|
|
20
|
+
```typescript
|
|
21
|
+
// src/apps/main/resources/app-config.resource.ts
|
|
22
|
+
import { Resource, ResourceContext } from '@frontmcp/sdk';
|
|
23
|
+
import { ReadResourceResult } from '@frontmcp/protocol';
|
|
24
|
+
|
|
25
|
+
@Resource({
|
|
26
|
+
name: 'app-config',
|
|
27
|
+
uri: 'config://app/settings',
|
|
28
|
+
description: 'Current application configuration',
|
|
29
|
+
mimeType: 'application/json',
|
|
30
|
+
})
|
|
31
|
+
class AppConfigResource extends ResourceContext {
|
|
32
|
+
async execute(uri: string, params: Record<string, string>): Promise<ReadResourceResult> {
|
|
33
|
+
const config = {
|
|
34
|
+
version: '2.1.0',
|
|
35
|
+
environment: 'production',
|
|
36
|
+
features: { darkMode: true, notifications: true },
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
return {
|
|
40
|
+
contents: [
|
|
41
|
+
{
|
|
42
|
+
uri,
|
|
43
|
+
mimeType: 'application/json',
|
|
44
|
+
text: JSON.stringify(config, null, 2),
|
|
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
|
+
resources: [AppConfigResource],
|
|
59
|
+
})
|
|
60
|
+
class MainApp {}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## What This Demonstrates
|
|
64
|
+
|
|
65
|
+
- Using `@Resource` with a fixed URI that follows RFC 3986 (has a valid scheme)
|
|
66
|
+
- Returning a `ReadResourceResult` with `contents` array containing `uri`, `mimeType`, and `text`
|
|
67
|
+
- Setting `mimeType` to indicate the content type of the resource
|
|
68
|
+
- Registering the resource in the `resources` array of `@App`
|
|
69
|
+
|
|
70
|
+
## Related
|
|
71
|
+
|
|
72
|
+
- See `create-resource` for resource templates, binary content, and function-style builders
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: binary-and-multi-content
|
|
3
|
+
reference: create-resource
|
|
4
|
+
level: advanced
|
|
5
|
+
description: 'A resource serving binary blob data and a resource returning multiple content items.'
|
|
6
|
+
tags: [development, cli, resource, binary, multi, content]
|
|
7
|
+
features:
|
|
8
|
+
- 'Returning binary data as base64-encoded `blob` (not `text`) for images and other binary assets'
|
|
9
|
+
- 'Using `@frontmcp/utils` for file system operations (`readFileBuffer`) instead of `fs` directly'
|
|
10
|
+
- 'Returning multiple content items from a single resource using fragment URIs (`#metrics`, `#charts`)'
|
|
11
|
+
- 'Each content item has its own `uri`, `mimeType`, and `text` or `blob` field'
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
# Binary Content and Multi-Content Resource
|
|
15
|
+
|
|
16
|
+
A resource serving binary blob data and a resource returning multiple content items.
|
|
17
|
+
|
|
18
|
+
## Code
|
|
19
|
+
|
|
20
|
+
```typescript
|
|
21
|
+
// src/apps/main/resources/app-logo.resource.ts
|
|
22
|
+
import { Resource, ResourceContext } from '@frontmcp/sdk';
|
|
23
|
+
import { ReadResourceResult } from '@frontmcp/protocol';
|
|
24
|
+
|
|
25
|
+
@Resource({
|
|
26
|
+
name: 'app-logo',
|
|
27
|
+
uri: 'assets://logo.png',
|
|
28
|
+
description: 'Application logo image',
|
|
29
|
+
mimeType: 'image/png',
|
|
30
|
+
})
|
|
31
|
+
class AppLogoResource extends ResourceContext {
|
|
32
|
+
async execute(uri: string, params: Record<string, string>): Promise<ReadResourceResult> {
|
|
33
|
+
const { readFileBuffer } = await import('@frontmcp/utils');
|
|
34
|
+
const buffer = await readFileBuffer('/assets/logo.png');
|
|
35
|
+
|
|
36
|
+
return {
|
|
37
|
+
contents: [
|
|
38
|
+
{
|
|
39
|
+
uri,
|
|
40
|
+
mimeType: 'image/png',
|
|
41
|
+
blob: buffer.toString('base64'),
|
|
42
|
+
},
|
|
43
|
+
],
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
```typescript
|
|
50
|
+
// src/apps/main/resources/dashboard.resource.ts
|
|
51
|
+
import { Resource, ResourceContext } from '@frontmcp/sdk';
|
|
52
|
+
import { ReadResourceResult } from '@frontmcp/protocol';
|
|
53
|
+
|
|
54
|
+
@Resource({
|
|
55
|
+
name: 'dashboard-data',
|
|
56
|
+
uri: 'dashboard://overview',
|
|
57
|
+
description: 'Dashboard overview with metrics and chart data',
|
|
58
|
+
mimeType: 'application/json',
|
|
59
|
+
})
|
|
60
|
+
class DashboardResource extends ResourceContext {
|
|
61
|
+
async execute(uri: string, params: Record<string, string>): Promise<ReadResourceResult> {
|
|
62
|
+
const metrics = await this.loadMetrics();
|
|
63
|
+
const chartData = await this.loadChartData();
|
|
64
|
+
|
|
65
|
+
return {
|
|
66
|
+
contents: [
|
|
67
|
+
{
|
|
68
|
+
uri: `${uri}#metrics`,
|
|
69
|
+
mimeType: 'application/json',
|
|
70
|
+
text: JSON.stringify(metrics),
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
uri: `${uri}#charts`,
|
|
74
|
+
mimeType: 'application/json',
|
|
75
|
+
text: JSON.stringify(chartData),
|
|
76
|
+
},
|
|
77
|
+
],
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
private async loadMetrics() {
|
|
82
|
+
return { users: 1500, revenue: 42000 };
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
private async loadChartData() {
|
|
86
|
+
return { labels: ['Jan', 'Feb'], values: [100, 200] };
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
```typescript
|
|
92
|
+
// src/apps/main/index.ts
|
|
93
|
+
import { App } from '@frontmcp/sdk';
|
|
94
|
+
|
|
95
|
+
@App({
|
|
96
|
+
name: 'main',
|
|
97
|
+
resources: [AppLogoResource, DashboardResource],
|
|
98
|
+
})
|
|
99
|
+
class MainApp {}
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## What This Demonstrates
|
|
103
|
+
|
|
104
|
+
- Returning binary data as base64-encoded `blob` (not `text`) for images and other binary assets
|
|
105
|
+
- Using `@frontmcp/utils` for file system operations (`readFileBuffer`) instead of `fs` directly
|
|
106
|
+
- Returning multiple content items from a single resource using fragment URIs (`#metrics`, `#charts`)
|
|
107
|
+
- Each content item has its own `uri`, `mimeType`, and `text` or `blob` field
|
|
108
|
+
|
|
109
|
+
## Related
|
|
110
|
+
|
|
111
|
+
- See `create-resource` for function-style builders, simplified return values, and ESM/remote loading
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: parameterized-template
|
|
3
|
+
reference: create-resource
|
|
4
|
+
level: intermediate
|
|
5
|
+
description: 'A resource template with typed URI parameters and argument autocompletion.'
|
|
6
|
+
tags: [development, resource, parameterized, template]
|
|
7
|
+
features:
|
|
8
|
+
- 'Using `@ResourceTemplate` with `uriTemplate` containing `{param}` placeholders'
|
|
9
|
+
- 'Typing the `ResourceContext` generic parameter for compile-time parameter checking'
|
|
10
|
+
- 'Implementing a convention-based completer (`userIdCompleter`) for argument autocompletion'
|
|
11
|
+
- 'Accessing DI providers via `this.get()` in both `execute()` and completer methods'
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
# Parameterized Resource Template
|
|
15
|
+
|
|
16
|
+
A resource template with typed URI parameters and argument autocompletion.
|
|
17
|
+
|
|
18
|
+
## Code
|
|
19
|
+
|
|
20
|
+
```typescript
|
|
21
|
+
// src/apps/main/resources/user-profile.resource.ts
|
|
22
|
+
import { ResourceTemplate, ResourceContext } from '@frontmcp/sdk';
|
|
23
|
+
import type { ResourceCompletionResult } from '@frontmcp/sdk';
|
|
24
|
+
import { ReadResourceResult } from '@frontmcp/protocol';
|
|
25
|
+
import type { Token } from '@frontmcp/di';
|
|
26
|
+
|
|
27
|
+
interface UserService {
|
|
28
|
+
findById(id: string): Promise<{ id: string; name: string; email: string }>;
|
|
29
|
+
search(partial: string): Promise<Array<{ id: string; name: string }>>;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const USER_SERVICE: Token<UserService> = Symbol('UserService');
|
|
33
|
+
|
|
34
|
+
@ResourceTemplate({
|
|
35
|
+
name: 'user-profile',
|
|
36
|
+
uriTemplate: 'users://{userId}/profile',
|
|
37
|
+
description: 'User profile by ID',
|
|
38
|
+
mimeType: 'application/json',
|
|
39
|
+
})
|
|
40
|
+
class UserProfileResource extends ResourceContext<{ userId: string }> {
|
|
41
|
+
async execute(uri: string, params: { userId: string }): Promise<ReadResourceResult> {
|
|
42
|
+
const user = await this.get(USER_SERVICE).findById(params.userId);
|
|
43
|
+
|
|
44
|
+
return {
|
|
45
|
+
contents: [
|
|
46
|
+
{
|
|
47
|
+
uri,
|
|
48
|
+
mimeType: 'application/json',
|
|
49
|
+
text: JSON.stringify(user),
|
|
50
|
+
},
|
|
51
|
+
],
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
async userIdCompleter(partial: string): Promise<ResourceCompletionResult> {
|
|
56
|
+
const users = await this.get(USER_SERVICE).search(partial);
|
|
57
|
+
return { values: users.map((u) => u.id), total: users.length };
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
```typescript
|
|
63
|
+
// src/apps/main/index.ts
|
|
64
|
+
import { App } from '@frontmcp/sdk';
|
|
65
|
+
|
|
66
|
+
@App({
|
|
67
|
+
name: 'main',
|
|
68
|
+
providers: [UserServiceProvider],
|
|
69
|
+
resources: [UserProfileResource],
|
|
70
|
+
})
|
|
71
|
+
class MainApp {}
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## What This Demonstrates
|
|
75
|
+
|
|
76
|
+
- Using `@ResourceTemplate` with `uriTemplate` containing `{param}` placeholders
|
|
77
|
+
- Typing the `ResourceContext` generic parameter for compile-time parameter checking
|
|
78
|
+
- Implementing a convention-based completer (`userIdCompleter`) for argument autocompletion
|
|
79
|
+
- Accessing DI providers via `this.get()` in both `execute()` and completer methods
|
|
80
|
+
|
|
81
|
+
## Related
|
|
82
|
+
|
|
83
|
+
- See `create-resource` for binary blob content, multiple content items, and function-style builders
|
|
84
|
+
- See `create-provider` for implementing the `UserServiceProvider`
|