@frontmcp/skills 1.0.0-beta.13 → 1.0.0-beta.14
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/catalog/TEMPLATE.md +55 -0
- package/catalog/frontmcp-config/SKILL.md +2 -2
- 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 +10 -0
- package/catalog/frontmcp-config/references/configure-auth.md +10 -0
- package/catalog/frontmcp-config/references/configure-elicitation.md +9 -0
- package/catalog/frontmcp-config/references/configure-http.md +10 -0
- package/catalog/frontmcp-config/references/configure-session.md +10 -0
- package/catalog/frontmcp-config/references/configure-throttle-guard-config.md +9 -0
- package/catalog/frontmcp-config/references/configure-throttle.md +10 -0
- package/catalog/frontmcp-config/references/configure-transport-protocol-presets.md +9 -0
- package/catalog/frontmcp-config/references/configure-transport.md +10 -0
- package/catalog/frontmcp-config/references/setup-redis.md +5 -0
- package/catalog/frontmcp-config/references/setup-sqlite.md +5 -0
- package/catalog/frontmcp-deployment/SKILL.md +2 -2
- 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 +10 -0
- package/catalog/frontmcp-deployment/references/build-for-cli.md +9 -0
- package/catalog/frontmcp-deployment/references/build-for-sdk.md +10 -0
- package/catalog/frontmcp-deployment/references/deploy-to-cloudflare.md +10 -0
- package/catalog/frontmcp-deployment/references/deploy-to-lambda.md +10 -0
- package/catalog/frontmcp-deployment/references/deploy-to-node-dockerfile.md +9 -0
- package/catalog/frontmcp-deployment/references/deploy-to-node.md +10 -0
- package/catalog/frontmcp-deployment/references/deploy-to-vercel-config.md +9 -0
- package/catalog/frontmcp-deployment/references/deploy-to-vercel.md +10 -0
- package/catalog/frontmcp-development/SKILL.md +2 -2
- 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 +9 -0
- package/catalog/frontmcp-development/references/create-agent-llm-config.md +9 -0
- package/catalog/frontmcp-development/references/create-agent.md +10 -0
- package/catalog/frontmcp-development/references/create-job.md +10 -0
- package/catalog/frontmcp-development/references/create-plugin-hooks.md +10 -0
- package/catalog/frontmcp-development/references/create-plugin.md +10 -0
- package/catalog/frontmcp-development/references/create-prompt.md +10 -0
- package/catalog/frontmcp-development/references/create-provider.md +9 -0
- package/catalog/frontmcp-development/references/create-resource.md +52 -15
- package/catalog/frontmcp-development/references/create-skill-with-tools.md +10 -0
- package/catalog/frontmcp-development/references/create-skill.md +10 -0
- package/catalog/frontmcp-development/references/create-tool-annotations.md +9 -0
- package/catalog/frontmcp-development/references/create-tool-output-schema-types.md +10 -0
- package/catalog/frontmcp-development/references/create-tool.md +10 -0
- package/catalog/frontmcp-development/references/create-workflow.md +10 -0
- package/catalog/frontmcp-development/references/decorators-guide.md +10 -0
- package/catalog/frontmcp-development/references/official-adapters.md +10 -0
- package/catalog/frontmcp-development/references/official-plugins.md +10 -0
- package/catalog/frontmcp-extensibility/SKILL.md +1 -1
- 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 +10 -0
- package/catalog/frontmcp-guides/SKILL.md +2 -2
- 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 +10 -0
- package/catalog/frontmcp-guides/references/example-task-manager.md +10 -0
- package/catalog/frontmcp-guides/references/example-weather-api.md +10 -0
- package/catalog/frontmcp-production-readiness/SKILL.md +2 -2
- 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/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 +10 -0
- package/catalog/frontmcp-production-readiness/references/production-browser.md +10 -0
- package/catalog/frontmcp-production-readiness/references/production-cli-binary.md +9 -0
- package/catalog/frontmcp-production-readiness/references/production-cli-daemon.md +10 -0
- package/catalog/frontmcp-production-readiness/references/production-cloudflare.md +10 -0
- package/catalog/frontmcp-production-readiness/references/production-lambda.md +10 -0
- package/catalog/frontmcp-production-readiness/references/production-node-sdk.md +10 -0
- package/catalog/frontmcp-production-readiness/references/production-node-server.md +10 -0
- package/catalog/frontmcp-production-readiness/references/production-vercel.md +10 -0
- 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 +9 -0
- package/catalog/frontmcp-setup/references/multi-app-composition.md +10 -0
- package/catalog/frontmcp-setup/references/nx-workflow.md +10 -0
- package/catalog/frontmcp-setup/references/project-structure-nx.md +10 -0
- package/catalog/frontmcp-setup/references/project-structure-standalone.md +10 -0
- package/catalog/frontmcp-setup/references/readme-guide.md +9 -0
- package/catalog/frontmcp-setup/references/setup-project.md +10 -0
- package/catalog/frontmcp-setup/references/setup-redis.md +10 -0
- package/catalog/frontmcp-setup/references/setup-sqlite.md +10 -0
- 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 +10 -0
- package/catalog/frontmcp-testing/references/test-auth.md +10 -0
- package/catalog/frontmcp-testing/references/test-browser-build.md +9 -0
- package/catalog/frontmcp-testing/references/test-cli-binary.md +9 -0
- package/catalog/frontmcp-testing/references/test-direct-client.md +9 -0
- package/catalog/frontmcp-testing/references/test-e2e-handler.md +10 -0
- package/catalog/frontmcp-testing/references/test-tool-unit.md +10 -0
- package/catalog/skills-manifest.json +2383 -67
- package/package.json +1 -1
- package/src/manifest.d.ts +23 -0
- package/src/manifest.js +3 -1
- package/src/manifest.js.map +1 -1
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: weather-tool-with-schemas
|
|
3
|
+
reference: example-weather-api
|
|
4
|
+
level: basic
|
|
5
|
+
description: 'Shows how to create a tool with Zod input and output schemas, use `this.fetch()` for HTTP calls, and handle errors with `this.fail()`.'
|
|
6
|
+
tags: [guides, weather, api, tool, schemas]
|
|
7
|
+
features:
|
|
8
|
+
- 'Defining Zod `inputSchema` with validation (`.min(1)`, `.enum()`, `.default()`)'
|
|
9
|
+
- 'Defining `outputSchema` to prevent data leaks and ensure type safety'
|
|
10
|
+
- 'Using `this.fetch()` for HTTP calls within tools'
|
|
11
|
+
- 'Using `this.fail()` for business-logic error handling'
|
|
12
|
+
- 'Using `.describe()` on schema fields for LLM-friendly tool descriptions'
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
# Weather Tool with Zod Input/Output Schemas
|
|
16
|
+
|
|
17
|
+
Shows how to create a tool with Zod input and output schemas, use `this.fetch()` for HTTP calls, and handle errors with `this.fail()`.
|
|
18
|
+
|
|
19
|
+
## Code
|
|
20
|
+
|
|
21
|
+
```typescript
|
|
22
|
+
// src/tools/get-weather.tool.ts
|
|
23
|
+
import { Tool, ToolContext } from '@frontmcp/sdk';
|
|
24
|
+
import { z } from 'zod';
|
|
25
|
+
|
|
26
|
+
@Tool({
|
|
27
|
+
name: 'get_weather',
|
|
28
|
+
description: 'Get current weather for a city',
|
|
29
|
+
inputSchema: {
|
|
30
|
+
city: z.string().min(1).describe('City name'),
|
|
31
|
+
units: z.enum(['celsius', 'fahrenheit']).default('celsius').describe('Temperature units'),
|
|
32
|
+
},
|
|
33
|
+
outputSchema: {
|
|
34
|
+
temperature: z.number(),
|
|
35
|
+
condition: z.string(),
|
|
36
|
+
humidity: z.number(),
|
|
37
|
+
city: z.string(),
|
|
38
|
+
},
|
|
39
|
+
})
|
|
40
|
+
export class GetWeatherTool extends ToolContext {
|
|
41
|
+
async execute(input: { city: string; units: 'celsius' | 'fahrenheit' }) {
|
|
42
|
+
const url = `https://api.weather.example.com/v1/current?city=${encodeURIComponent(input.city)}&units=${input.units}`;
|
|
43
|
+
|
|
44
|
+
// Use this.fetch() for HTTP calls — the framework handles errors in the tool execution flow.
|
|
45
|
+
const response = await this.fetch(url);
|
|
46
|
+
|
|
47
|
+
if (!response.ok) {
|
|
48
|
+
// Use this.fail() for business-logic errors
|
|
49
|
+
this.fail(new Error(`Weather API error: ${response.status} ${response.statusText}`));
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const data = await response.json();
|
|
53
|
+
|
|
54
|
+
return {
|
|
55
|
+
temperature: data.temp,
|
|
56
|
+
condition: data.condition,
|
|
57
|
+
humidity: data.humidity,
|
|
58
|
+
city: input.city,
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## What This Demonstrates
|
|
65
|
+
|
|
66
|
+
- Defining Zod `inputSchema` with validation (`.min(1)`, `.enum()`, `.default()`)
|
|
67
|
+
- Defining `outputSchema` to prevent data leaks and ensure type safety
|
|
68
|
+
- Using `this.fetch()` for HTTP calls within tools
|
|
69
|
+
- Using `this.fail()` for business-logic error handling
|
|
70
|
+
- Using `.describe()` on schema fields for LLM-friendly tool descriptions
|
|
71
|
+
|
|
72
|
+
## Related
|
|
73
|
+
|
|
74
|
+
- See `example-weather-api` for the full end-to-end weather API example with tests
|
|
@@ -639,3 +639,13 @@ describe('AuditLogPlugin', () => {
|
|
|
639
639
|
});
|
|
640
640
|
});
|
|
641
641
|
```
|
|
642
|
+
|
|
643
|
+
## Examples
|
|
644
|
+
|
|
645
|
+
| Example | Level | Description |
|
|
646
|
+
| -------------------------------------------------------------------------------------------------- | ------------ | --------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
647
|
+
| [`agent-and-plugin`](../examples/example-knowledge-base/agent-and-plugin.md) | Advanced | Shows an autonomous research agent with inner tools and configurable depth, and a plugin that hooks into tool execution for audit logging. |
|
|
648
|
+
| [`multi-app-composition`](../examples/example-knowledge-base/multi-app-composition.md) | Basic | Shows how to compose multiple apps (Ingestion, Search, Research) into a single server with shared providers, plugins, and agent registration. |
|
|
649
|
+
| [`vector-search-and-resources`](../examples/example-knowledge-base/vector-search-and-resources.md) | Intermediate | Shows a semantic search tool with embedding generation and a resource template for retrieving documents by ID using URI parameters. |
|
|
650
|
+
|
|
651
|
+
> See all examples in [`examples/example-knowledge-base/`](../examples/example-knowledge-base/)
|
|
@@ -509,3 +509,13 @@ describe('Task Manager E2E', () => {
|
|
|
509
509
|
});
|
|
510
510
|
});
|
|
511
511
|
```
|
|
512
|
+
|
|
513
|
+
## Examples
|
|
514
|
+
|
|
515
|
+
| Example | Level | Description |
|
|
516
|
+
| ---------------------------------------------------------------------------------------- | ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
517
|
+
| [`auth-and-crud-tools`](../examples/example-task-manager/auth-and-crud-tools.md) | Basic | Shows how to create CRUD tools with authentication, using `this.context.session` for user isolation and `this.get()` for dependency injection. |
|
|
518
|
+
| [`authenticated-e2e-tests`](../examples/example-task-manager/authenticated-e2e-tests.md) | Advanced | Shows how to write E2E tests with authentication using `TestTokenFactory`, and unit tests for tools that require session context. |
|
|
519
|
+
| [`redis-provider-with-di`](../examples/example-task-manager/redis-provider-with-di.md) | Intermediate | Shows how to create a Redis-backed provider with a DI token, lifecycle hooks (`onInit`/`onDestroy`), and how tools inject it. |
|
|
520
|
+
|
|
521
|
+
> See all examples in [`examples/example-task-manager/`](../examples/example-task-manager/)
|
|
@@ -292,3 +292,13 @@ describe('Weather Server E2E', () => {
|
|
|
292
292
|
});
|
|
293
293
|
});
|
|
294
294
|
```
|
|
295
|
+
|
|
296
|
+
## Examples
|
|
297
|
+
|
|
298
|
+
| Example | Level | Description |
|
|
299
|
+
| ------------------------------------------------------------------------------------------- | ------------ | -------------------------------------------------------------------------------------------------------------------------------------- |
|
|
300
|
+
| [`server-and-app-setup`](../examples/example-weather-api/server-and-app-setup.md) | Basic | Shows the server entry point, app registration, and static resource for a beginner FrontMCP weather API server. |
|
|
301
|
+
| [`unit-and-e2e-tests`](../examples/example-weather-api/unit-and-e2e-tests.md) | Intermediate | Shows how to write unit tests for tools by mocking context methods, and E2E tests using `McpTestClient` and `TestServer`. |
|
|
302
|
+
| [`weather-tool-with-schemas`](../examples/example-weather-api/weather-tool-with-schemas.md) | Basic | Shows how to create a tool with Zod input and output schemas, use `this.fetch()` for HTTP calls, and handle errors with `this.fail()`. |
|
|
303
|
+
|
|
304
|
+
> See all examples in [`examples/example-weather-api/`](../examples/example-weather-api/)
|
|
@@ -9,7 +9,7 @@ priority: 10
|
|
|
9
9
|
visibility: both
|
|
10
10
|
license: Apache-2.0
|
|
11
11
|
metadata:
|
|
12
|
-
docs: https://docs.agentfront.dev/frontmcp/production
|
|
12
|
+
docs: https://docs.agentfront.dev/frontmcp/deployment/production-build
|
|
13
13
|
---
|
|
14
14
|
|
|
15
15
|
# FrontMCP Production Readiness Audit
|
|
@@ -94,5 +94,5 @@ After completing both common and target-specific checklists:
|
|
|
94
94
|
|
|
95
95
|
## Reference
|
|
96
96
|
|
|
97
|
-
- [
|
|
97
|
+
- [Production Build](https://docs.agentfront.dev/frontmcp/deployment/production-build)
|
|
98
98
|
- Related skills: `frontmcp-config`, `frontmcp-deployment`, `frontmcp-testing`, `frontmcp-setup`
|
package/catalog/frontmcp-production-readiness/examples/common-checklist/caching-and-performance.md
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: caching-and-performance
|
|
3
|
+
reference: common-checklist
|
|
4
|
+
level: advanced
|
|
5
|
+
description: 'Shows how to configure caching with TTL, optimize responses, and manage memory with proper provider lifecycle cleanup.'
|
|
6
|
+
tags: [production, redis, cache, session, performance, checklist]
|
|
7
|
+
features:
|
|
8
|
+
- 'Configuring per-tool cache TTL instead of a single global value'
|
|
9
|
+
- 'Using Redis-backed cache for multi-instance consistency'
|
|
10
|
+
- 'Setting session TTL to prevent unbounded storage growth'
|
|
11
|
+
- 'Implementing `onDestroy()` in providers for proper connection cleanup'
|
|
12
|
+
- 'Using connection pool limits and timeouts to prevent resource exhaustion'
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
# Caching and Performance Configuration
|
|
16
|
+
|
|
17
|
+
Shows how to configure caching with TTL, optimize responses, and manage memory with proper provider lifecycle cleanup.
|
|
18
|
+
|
|
19
|
+
## Code
|
|
20
|
+
|
|
21
|
+
```typescript
|
|
22
|
+
// src/main.ts
|
|
23
|
+
import { FrontMcp } from '@frontmcp/sdk';
|
|
24
|
+
import { CachePlugin } from '@frontmcp/plugins';
|
|
25
|
+
import { MyApp } from './my.app';
|
|
26
|
+
|
|
27
|
+
@FrontMcp({
|
|
28
|
+
info: { name: 'perf-server', version: '1.0.0' },
|
|
29
|
+
apps: [MyApp],
|
|
30
|
+
plugins: [
|
|
31
|
+
new CachePlugin({
|
|
32
|
+
// Per-tool TTL tuning (not one-size-fits-all)
|
|
33
|
+
ttl: {
|
|
34
|
+
get_weather: 300_000, // 5 minutes — data changes slowly
|
|
35
|
+
list_tasks: 10_000, // 10 seconds — data changes frequently
|
|
36
|
+
},
|
|
37
|
+
defaultTtl: 60_000, // 1 minute default
|
|
38
|
+
}),
|
|
39
|
+
],
|
|
40
|
+
|
|
41
|
+
// Redis for multi-instance cache consistency
|
|
42
|
+
redis: {
|
|
43
|
+
provider: 'redis',
|
|
44
|
+
host: process.env.REDIS_HOST ?? 'localhost',
|
|
45
|
+
port: 6379,
|
|
46
|
+
},
|
|
47
|
+
|
|
48
|
+
// Session TTL to prevent unbounded growth
|
|
49
|
+
session: {
|
|
50
|
+
ttl: 3600_000, // 1 hour
|
|
51
|
+
},
|
|
52
|
+
})
|
|
53
|
+
export default class PerfServer {}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
```typescript
|
|
57
|
+
// src/providers/db-connection.provider.ts
|
|
58
|
+
import { Provider, ProviderScope } from '@frontmcp/sdk';
|
|
59
|
+
|
|
60
|
+
export const DB_POOL = Symbol('DbPool');
|
|
61
|
+
|
|
62
|
+
@Provider({ token: DB_POOL, scope: ProviderScope.GLOBAL })
|
|
63
|
+
export class DbConnectionProvider {
|
|
64
|
+
private pool!: { query: Function; end: Function };
|
|
65
|
+
|
|
66
|
+
async onInit(): Promise<void> {
|
|
67
|
+
// Connection pool with limits — prevents resource exhaustion
|
|
68
|
+
this.pool = await this.createPool({
|
|
69
|
+
host: process.env.DB_HOST,
|
|
70
|
+
max: 20, // Maximum connections
|
|
71
|
+
idleTimeoutMs: 30_000, // Close idle connections after 30s
|
|
72
|
+
connectionTimeoutMs: 5_000, // Don't hang on connection attempts
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
async query(sql: string, params: unknown[]): Promise<unknown> {
|
|
77
|
+
return this.pool.query(sql, params); // Parameterized — no SQL injection
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
async onDestroy(): Promise<void> {
|
|
81
|
+
// Clean up on shutdown — prevents connection leaks
|
|
82
|
+
await this.pool.end();
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
private async createPool(config: Record<string, unknown>): Promise<{ query: Function; end: Function }> {
|
|
86
|
+
// Replace with your database driver (e.g., pg, mysql2)
|
|
87
|
+
throw new Error('Implement with your database driver');
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## What This Demonstrates
|
|
93
|
+
|
|
94
|
+
- Configuring per-tool cache TTL instead of a single global value
|
|
95
|
+
- Using Redis-backed cache for multi-instance consistency
|
|
96
|
+
- Setting session TTL to prevent unbounded storage growth
|
|
97
|
+
- Implementing `onDestroy()` in providers for proper connection cleanup
|
|
98
|
+
- Using connection pool limits and timeouts to prevent resource exhaustion
|
|
99
|
+
|
|
100
|
+
## Related
|
|
101
|
+
|
|
102
|
+
- See `common-checklist` for the full performance and memory management checklist
|
package/catalog/frontmcp-production-readiness/examples/common-checklist/observability-setup.md
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: observability-setup
|
|
3
|
+
reference: common-checklist
|
|
4
|
+
level: intermediate
|
|
5
|
+
description: 'Shows how to configure structured logging, error handling with MCP error codes, and monitoring integration for production.'
|
|
6
|
+
tags: [production, observability, checklist, setup]
|
|
7
|
+
features:
|
|
8
|
+
- 'Using `this.mark()` to annotate execution phases for tracing'
|
|
9
|
+
- 'Using `this.fail()` for business-logic errors without exposing internals'
|
|
10
|
+
- 'Setting timeouts on all external calls via `AbortSignal.timeout()`'
|
|
11
|
+
- 'Implementing health check providers that verify downstream dependencies'
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
# Observability and Error Handling Setup
|
|
15
|
+
|
|
16
|
+
Shows how to configure structured logging, error handling with MCP error codes, and monitoring integration for production.
|
|
17
|
+
|
|
18
|
+
## Code
|
|
19
|
+
|
|
20
|
+
```typescript
|
|
21
|
+
// src/tools/monitored-tool.tool.ts
|
|
22
|
+
import { Tool, ToolContext } from '@frontmcp/sdk';
|
|
23
|
+
import { z } from 'zod';
|
|
24
|
+
|
|
25
|
+
@Tool({
|
|
26
|
+
name: 'monitored_operation',
|
|
27
|
+
description: 'A tool with proper error handling and observability markers',
|
|
28
|
+
inputSchema: {
|
|
29
|
+
operationId: z.string().min(1).describe('Operation identifier'),
|
|
30
|
+
},
|
|
31
|
+
outputSchema: {
|
|
32
|
+
status: z.string(),
|
|
33
|
+
operationId: z.string(),
|
|
34
|
+
},
|
|
35
|
+
})
|
|
36
|
+
export class MonitoredOperationTool extends ToolContext {
|
|
37
|
+
async execute(input: { operationId: string }) {
|
|
38
|
+
// Mark execution phases for tracing and duration metrics
|
|
39
|
+
this.mark('validation');
|
|
40
|
+
// ... validate business rules ...
|
|
41
|
+
|
|
42
|
+
this.mark('processing');
|
|
43
|
+
const result = await this.processOperation(input.operationId);
|
|
44
|
+
|
|
45
|
+
if (!result) {
|
|
46
|
+
// Use this.fail() with specific errors — never expose stack traces
|
|
47
|
+
this.fail(new Error(`Operation not found: ${input.operationId}`));
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// Report progress for long-running operations
|
|
51
|
+
await this.respondProgress(1, 1);
|
|
52
|
+
|
|
53
|
+
return { status: 'completed', operationId: input.operationId };
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
private async processOperation(id: string): Promise<boolean> {
|
|
57
|
+
// External call with timeout — always set timeouts for external services
|
|
58
|
+
const response = await this.fetch(`https://api.example.com/operations/${id}`, {
|
|
59
|
+
signal: AbortSignal.timeout(5000), // 5 second timeout
|
|
60
|
+
});
|
|
61
|
+
return response.ok;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
```typescript
|
|
67
|
+
// src/providers/health-check.provider.ts
|
|
68
|
+
import { Provider, ProviderScope } from '@frontmcp/sdk';
|
|
69
|
+
|
|
70
|
+
export const HEALTH_CHECK = Symbol('HealthCheck');
|
|
71
|
+
|
|
72
|
+
@Provider({ token: HEALTH_CHECK, scope: ProviderScope.GLOBAL })
|
|
73
|
+
export class HealthCheckProvider {
|
|
74
|
+
async checkRedis(): Promise<boolean> {
|
|
75
|
+
// Verify downstream dependency is reachable
|
|
76
|
+
try {
|
|
77
|
+
// ... ping Redis ...
|
|
78
|
+
return true;
|
|
79
|
+
} catch {
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
async checkDatabase(): Promise<boolean> {
|
|
85
|
+
try {
|
|
86
|
+
// ... run a lightweight query ...
|
|
87
|
+
return true;
|
|
88
|
+
} catch {
|
|
89
|
+
return false;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## What This Demonstrates
|
|
96
|
+
|
|
97
|
+
- Using `this.mark()` to annotate execution phases for tracing
|
|
98
|
+
- Using `this.fail()` for business-logic errors without exposing internals
|
|
99
|
+
- Setting timeouts on all external calls via `AbortSignal.timeout()`
|
|
100
|
+
- Implementing health check providers that verify downstream dependencies
|
|
101
|
+
|
|
102
|
+
## Related
|
|
103
|
+
|
|
104
|
+
- See `common-checklist` for the full observability and monitoring checklist
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: security-hardening
|
|
3
|
+
reference: common-checklist
|
|
4
|
+
level: basic
|
|
5
|
+
description: 'Shows how to configure authentication, CORS, input validation, and rate limiting for a production FrontMCP server.'
|
|
6
|
+
tags: [production, redis, session, security, throttle, checklist]
|
|
7
|
+
features:
|
|
8
|
+
- "Restricting CORS origins to known domains instead of using `'*'`"
|
|
9
|
+
- 'Configuring rate limiting via the `throttle` option'
|
|
10
|
+
- 'Using Redis for session storage in multi-instance deployments'
|
|
11
|
+
- 'Defining both `inputSchema` and `outputSchema` on tools to prevent data leaks'
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
# Security Hardening Configuration
|
|
15
|
+
|
|
16
|
+
Shows how to configure authentication, CORS, input validation, and rate limiting for a production FrontMCP server.
|
|
17
|
+
|
|
18
|
+
## Code
|
|
19
|
+
|
|
20
|
+
```typescript
|
|
21
|
+
// src/main.ts
|
|
22
|
+
import { FrontMcp } from '@frontmcp/sdk';
|
|
23
|
+
import { z } from 'zod';
|
|
24
|
+
import { MyApp } from './my.app';
|
|
25
|
+
|
|
26
|
+
@FrontMcp({
|
|
27
|
+
info: { name: 'secure-server', version: '1.0.0' },
|
|
28
|
+
apps: [MyApp],
|
|
29
|
+
|
|
30
|
+
// Authentication: use remote OAuth provider
|
|
31
|
+
auth: {
|
|
32
|
+
mode: 'remote',
|
|
33
|
+
provider: 'https://auth.example.com',
|
|
34
|
+
clientId: process.env.AUTH_CLIENT_ID!,
|
|
35
|
+
},
|
|
36
|
+
|
|
37
|
+
// CORS: restrict to known origins (never use '*' in production)
|
|
38
|
+
cors: {
|
|
39
|
+
origin: ['https://app.example.com', 'https://admin.example.com'],
|
|
40
|
+
credentials: true,
|
|
41
|
+
maxAge: 86400, // Cache preflight for 24 hours
|
|
42
|
+
},
|
|
43
|
+
|
|
44
|
+
// Rate limiting: prevent abuse
|
|
45
|
+
throttle: {
|
|
46
|
+
windowMs: 60_000, // 1 minute window
|
|
47
|
+
max: 100, // 100 requests per window per client
|
|
48
|
+
},
|
|
49
|
+
|
|
50
|
+
// Session storage: use Redis (not in-memory) for multi-instance
|
|
51
|
+
redis: {
|
|
52
|
+
provider: 'redis',
|
|
53
|
+
host: process.env.REDIS_HOST ?? 'localhost',
|
|
54
|
+
port: 6379,
|
|
55
|
+
},
|
|
56
|
+
})
|
|
57
|
+
export default class SecureServer {}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
```typescript
|
|
61
|
+
// src/tools/safe-query.tool.ts
|
|
62
|
+
import { Tool, ToolContext } from '@frontmcp/sdk';
|
|
63
|
+
import { z } from 'zod';
|
|
64
|
+
|
|
65
|
+
@Tool({
|
|
66
|
+
name: 'safe_query',
|
|
67
|
+
description: 'Query data with validated and sanitized input',
|
|
68
|
+
inputSchema: {
|
|
69
|
+
query: z.string().min(1).max(500).describe('Search query'),
|
|
70
|
+
limit: z.number().int().min(1).max(100).default(10).describe('Max results'),
|
|
71
|
+
},
|
|
72
|
+
outputSchema: {
|
|
73
|
+
results: z.array(z.object({ id: z.string(), title: z.string() })),
|
|
74
|
+
total: z.number(),
|
|
75
|
+
},
|
|
76
|
+
})
|
|
77
|
+
export class SafeQueryTool extends ToolContext {
|
|
78
|
+
async execute(input: { query: string; limit: number }) {
|
|
79
|
+
// Zod already validated input — safe to use
|
|
80
|
+
// outputSchema prevents accidental data leaks
|
|
81
|
+
return { results: [], total: 0 };
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## What This Demonstrates
|
|
87
|
+
|
|
88
|
+
- Restricting CORS origins to known domains instead of using `'*'`
|
|
89
|
+
- Configuring rate limiting via the `throttle` option
|
|
90
|
+
- Using Redis for session storage in multi-instance deployments
|
|
91
|
+
- Defining both `inputSchema` and `outputSchema` on tools to prevent data leaks
|
|
92
|
+
|
|
93
|
+
## Related
|
|
94
|
+
|
|
95
|
+
- See `common-checklist` for the full security, performance, and reliability checklist
|
package/catalog/frontmcp-production-readiness/examples/production-browser/browser-bundle-config.md
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: browser-bundle-config
|
|
3
|
+
reference: production-browser
|
|
4
|
+
level: basic
|
|
5
|
+
description: 'Shows how to configure package.json for browser-compatible SDK distribution with ESM/CJS/UMD entry points, TypeScript declarations, and CDN support.'
|
|
6
|
+
tags: [production, browser, sdk, node, bundle, config]
|
|
7
|
+
features:
|
|
8
|
+
- 'Correct `main`, `module`, `browser`, `types`, and `exports` fields for browser distribution'
|
|
9
|
+
- 'Using the `browser` field to point bundlers to the browser-specific build'
|
|
10
|
+
- 'Browser-safe imports with no Node.js-only APIs'
|
|
11
|
+
- 'CDN-friendly distribution that works via `<script type="module">`'
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
# Browser SDK Bundle Configuration
|
|
15
|
+
|
|
16
|
+
Shows how to configure package.json for browser-compatible SDK distribution with ESM/CJS/UMD entry points, TypeScript declarations, and CDN support.
|
|
17
|
+
|
|
18
|
+
## Code
|
|
19
|
+
|
|
20
|
+
```jsonc
|
|
21
|
+
// package.json
|
|
22
|
+
{
|
|
23
|
+
"name": "my-mcp-browser-sdk",
|
|
24
|
+
"version": "1.0.0",
|
|
25
|
+
"description": "Browser-compatible MCP SDK",
|
|
26
|
+
"license": "MIT",
|
|
27
|
+
|
|
28
|
+
// CJS entry
|
|
29
|
+
"main": "./dist/cjs/index.js",
|
|
30
|
+
// ESM entry
|
|
31
|
+
"module": "./dist/esm/index.js",
|
|
32
|
+
// Browser-specific entry
|
|
33
|
+
"browser": "./dist/browser/index.js",
|
|
34
|
+
// TypeScript declarations
|
|
35
|
+
"types": "./dist/types/index.d.ts",
|
|
36
|
+
|
|
37
|
+
// Conditional exports for bundlers
|
|
38
|
+
"exports": {
|
|
39
|
+
".": {
|
|
40
|
+
"browser": "./dist/browser/index.js",
|
|
41
|
+
"import": "./dist/esm/index.js",
|
|
42
|
+
"require": "./dist/cjs/index.js",
|
|
43
|
+
"types": "./dist/types/index.d.ts",
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
|
|
47
|
+
"files": ["dist/", "README.md", "LICENSE"],
|
|
48
|
+
|
|
49
|
+
"scripts": {
|
|
50
|
+
"build": "frontmcp build --target browser",
|
|
51
|
+
"analyze": "npx bundlesize",
|
|
52
|
+
"test": "jest --coverage",
|
|
53
|
+
},
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
```typescript
|
|
58
|
+
// src/index.ts — Browser-safe public API
|
|
59
|
+
// No Node.js-only imports (fs, path, child_process, net, crypto)
|
|
60
|
+
// All crypto uses @frontmcp/utils (wraps Web Crypto API)
|
|
61
|
+
import { sha256Hex, randomUUID, base64urlEncode } from '@frontmcp/utils';
|
|
62
|
+
|
|
63
|
+
export { create } from './client';
|
|
64
|
+
export type { McpBrowserClient, McpToolResult } from './types';
|
|
65
|
+
|
|
66
|
+
// Re-export utilities that work in the browser
|
|
67
|
+
export { sha256Hex, randomUUID, base64urlEncode };
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
```html
|
|
71
|
+
<!-- CDN usage via script tag -->
|
|
72
|
+
<script type="module">
|
|
73
|
+
import { create } from 'https://cdn.example.com/my-mcp-browser-sdk@1.0.0/dist/browser/index.js';
|
|
74
|
+
|
|
75
|
+
const client = await create({
|
|
76
|
+
baseUrl: 'https://mcp-api.example.com',
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
const tools = await client.listTools();
|
|
80
|
+
console.log('Available tools:', tools);
|
|
81
|
+
</script>
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## What This Demonstrates
|
|
85
|
+
|
|
86
|
+
- Correct `main`, `module`, `browser`, `types`, and `exports` fields for browser distribution
|
|
87
|
+
- Using the `browser` field to point bundlers to the browser-specific build
|
|
88
|
+
- Browser-safe imports with no Node.js-only APIs
|
|
89
|
+
- CDN-friendly distribution that works via `<script type="module">`
|
|
90
|
+
|
|
91
|
+
## Related
|
|
92
|
+
|
|
93
|
+
- See `production-browser` for the full browser compatibility and distribution checklist
|
package/catalog/frontmcp-production-readiness/examples/production-browser/cross-platform-crypto.md
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: cross-platform-crypto
|
|
3
|
+
reference: production-browser
|
|
4
|
+
level: intermediate
|
|
5
|
+
description: 'Shows how to use `@frontmcp/utils` for cross-platform crypto operations that work in both browser and Node.js, and how to avoid Node.js-only APIs.'
|
|
6
|
+
tags: [production, browser, node, cross, platform, crypto]
|
|
7
|
+
features:
|
|
8
|
+
- 'Using `@frontmcp/utils` for crypto instead of `node:crypto` (wraps Web Crypto API)'
|
|
9
|
+
- 'Using Fetch API for HTTP calls instead of Node.js `http`/`https`'
|
|
10
|
+
- 'Using `crypto.randomUUID()` from the Web Crypto API in browser code'
|
|
11
|
+
- 'WebSocket connection with automatic reconnection for streaming'
|
|
12
|
+
- 'No Node.js-only APIs (`fs`, `path`, `child_process`, `net`)'
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
# Cross-Platform Crypto and Browser Compatibility
|
|
16
|
+
|
|
17
|
+
Shows how to use `@frontmcp/utils` for cross-platform crypto operations that work in both browser and Node.js, and how to avoid Node.js-only APIs.
|
|
18
|
+
|
|
19
|
+
## Code
|
|
20
|
+
|
|
21
|
+
```typescript
|
|
22
|
+
// src/tools/browser-safe-hash.tool.ts
|
|
23
|
+
import { Tool, ToolContext } from '@frontmcp/sdk';
|
|
24
|
+
import { z } from 'zod';
|
|
25
|
+
// @frontmcp/utils wraps Web Crypto API — works in browsers
|
|
26
|
+
import { sha256Hex, sha256Base64url, randomUUID } from '@frontmcp/utils';
|
|
27
|
+
|
|
28
|
+
@Tool({
|
|
29
|
+
name: 'hash_data',
|
|
30
|
+
description: 'Hash data using browser-compatible crypto',
|
|
31
|
+
inputSchema: {
|
|
32
|
+
data: z.string().min(1).describe('Data to hash'),
|
|
33
|
+
format: z.enum(['hex', 'base64url']).default('hex').describe('Output format'),
|
|
34
|
+
},
|
|
35
|
+
outputSchema: {
|
|
36
|
+
hash: z.string(),
|
|
37
|
+
format: z.string(),
|
|
38
|
+
id: z.string(),
|
|
39
|
+
},
|
|
40
|
+
})
|
|
41
|
+
export class HashDataTool extends ToolContext {
|
|
42
|
+
async execute(input: { data: string; format: 'hex' | 'base64url' }) {
|
|
43
|
+
// Cross-platform: works in browser (Web Crypto) and Node.js
|
|
44
|
+
const hash = input.format === 'hex' ? sha256Hex(input.data) : sha256Base64url(input.data);
|
|
45
|
+
const id = randomUUID();
|
|
46
|
+
|
|
47
|
+
return { hash, format: input.format, id };
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
```typescript
|
|
53
|
+
// src/client/browser-client.ts
|
|
54
|
+
// Browser-compatible MCP client — no Node.js APIs
|
|
55
|
+
|
|
56
|
+
export class BrowserMcpClient {
|
|
57
|
+
private baseUrl: string;
|
|
58
|
+
|
|
59
|
+
constructor(config: { baseUrl: string }) {
|
|
60
|
+
this.baseUrl = config.baseUrl;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// Use Fetch API — not Node.js http/https
|
|
64
|
+
async callTool(name: string, args: Record<string, unknown>): Promise<unknown> {
|
|
65
|
+
const response = await fetch(`${this.baseUrl}/mcp`, {
|
|
66
|
+
method: 'POST',
|
|
67
|
+
headers: { 'Content-Type': 'application/json' },
|
|
68
|
+
body: JSON.stringify({
|
|
69
|
+
jsonrpc: '2.0',
|
|
70
|
+
method: 'tools/call',
|
|
71
|
+
params: { name, arguments: args },
|
|
72
|
+
id: crypto.randomUUID(), // Web Crypto API
|
|
73
|
+
}),
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
const result = await response.json();
|
|
77
|
+
return result;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// WebSocket with reconnection for SSE/streaming
|
|
81
|
+
connectStream(onMessage: (data: unknown) => void): { close: () => void } {
|
|
82
|
+
let ws: WebSocket;
|
|
83
|
+
let reconnectTimer: ReturnType<typeof setTimeout>;
|
|
84
|
+
|
|
85
|
+
const connect = () => {
|
|
86
|
+
ws = new WebSocket(this.baseUrl.replace('http', 'ws') + '/mcp/stream');
|
|
87
|
+
ws.onmessage = (event) => onMessage(JSON.parse(event.data));
|
|
88
|
+
ws.onclose = () => {
|
|
89
|
+
// Reconnect gracefully
|
|
90
|
+
reconnectTimer = setTimeout(connect, 1000);
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
connect();
|
|
95
|
+
|
|
96
|
+
return {
|
|
97
|
+
close: () => {
|
|
98
|
+
clearTimeout(reconnectTimer);
|
|
99
|
+
ws?.close();
|
|
100
|
+
},
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## What This Demonstrates
|
|
107
|
+
|
|
108
|
+
- Using `@frontmcp/utils` for crypto instead of `node:crypto` (wraps Web Crypto API)
|
|
109
|
+
- Using Fetch API for HTTP calls instead of Node.js `http`/`https`
|
|
110
|
+
- Using `crypto.randomUUID()` from the Web Crypto API in browser code
|
|
111
|
+
- WebSocket connection with automatic reconnection for streaming
|
|
112
|
+
- No Node.js-only APIs (`fs`, `path`, `child_process`, `net`)
|
|
113
|
+
|
|
114
|
+
## Related
|
|
115
|
+
|
|
116
|
+
- See `production-browser` for the full browser compatibility and security checklist
|