@frontmcp/skills 0.0.1 → 1.0.0-beta.10
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 +58 -13
- package/catalog/frontmcp-config/SKILL.md +143 -0
- package/catalog/frontmcp-config/references/configure-auth.md +238 -0
- package/catalog/frontmcp-config/references/configure-elicitation.md +178 -0
- package/catalog/frontmcp-config/references/configure-http.md +205 -0
- package/catalog/frontmcp-config/references/configure-session.md +205 -0
- package/catalog/frontmcp-config/references/configure-throttle.md +229 -0
- package/catalog/frontmcp-config/references/configure-transport.md +195 -0
- package/catalog/frontmcp-config/references/setup-redis.md +4 -0
- package/catalog/frontmcp-config/references/setup-sqlite.md +4 -0
- package/catalog/frontmcp-deployment/SKILL.md +127 -0
- package/catalog/frontmcp-deployment/references/build-for-browser.md +138 -0
- package/catalog/frontmcp-deployment/references/build-for-cli.md +138 -0
- package/catalog/{deployment/build-for-sdk/SKILL.md → frontmcp-deployment/references/build-for-sdk.md} +65 -24
- package/catalog/frontmcp-deployment/references/deploy-to-cloudflare.md +213 -0
- package/catalog/{deployment/deploy-to-lambda/SKILL.md → frontmcp-deployment/references/deploy-to-lambda.md} +76 -63
- package/catalog/{deployment/deploy-to-node/references/Dockerfile.example → frontmcp-deployment/references/deploy-to-node-dockerfile.md} +13 -4
- package/catalog/{deployment/deploy-to-node/SKILL.md → frontmcp-deployment/references/deploy-to-node.md} +68 -40
- package/catalog/frontmcp-deployment/references/deploy-to-vercel-config.md +60 -0
- package/catalog/frontmcp-deployment/references/deploy-to-vercel.md +224 -0
- package/catalog/frontmcp-development/SKILL.md +121 -0
- package/catalog/frontmcp-development/references/create-adapter.md +165 -0
- package/catalog/{development/create-agent/references/llm-config.md → frontmcp-development/references/create-agent-llm-config.md} +5 -5
- package/catalog/{development/create-agent/SKILL.md → frontmcp-development/references/create-agent.md} +82 -44
- package/catalog/{development/create-job/SKILL.md → frontmcp-development/references/create-job.md} +61 -19
- package/catalog/{plugins/create-plugin-hooks/SKILL.md → frontmcp-development/references/create-plugin-hooks.md} +63 -11
- package/catalog/{plugins/create-plugin/SKILL.md → frontmcp-development/references/create-plugin.md} +65 -60
- package/catalog/{development/create-prompt/SKILL.md → frontmcp-development/references/create-prompt.md} +62 -26
- package/catalog/{development/create-provider/SKILL.md → frontmcp-development/references/create-provider.md} +62 -27
- package/catalog/{development/create-resource/SKILL.md → frontmcp-development/references/create-resource.md} +62 -30
- package/catalog/{development/create-skill-with-tools/SKILL.md → frontmcp-development/references/create-skill-with-tools.md} +69 -24
- package/catalog/{development/create-skill/SKILL.md → frontmcp-development/references/create-skill.md} +96 -22
- package/catalog/{development/create-tool/SKILL.md → frontmcp-development/references/create-tool.md} +62 -26
- package/catalog/{development/create-workflow/SKILL.md → frontmcp-development/references/create-workflow.md} +60 -18
- package/catalog/{development/decorators-guide/SKILL.md → frontmcp-development/references/decorators-guide.md} +123 -34
- package/catalog/frontmcp-development/references/official-adapters.md +194 -0
- package/catalog/{plugins/official-plugins/SKILL.md → frontmcp-development/references/official-plugins.md} +96 -31
- package/catalog/frontmcp-guides/SKILL.md +420 -0
- package/catalog/frontmcp-guides/references/example-knowledge-base.md +636 -0
- package/catalog/frontmcp-guides/references/example-task-manager.md +512 -0
- package/catalog/frontmcp-guides/references/example-weather-api.md +292 -0
- package/catalog/frontmcp-production-readiness/SKILL.md +253 -0
- package/catalog/frontmcp-setup/SKILL.md +130 -0
- package/catalog/frontmcp-setup/references/frontmcp-skills-usage.md +265 -0
- package/catalog/{setup/multi-app-composition/SKILL.md → frontmcp-setup/references/multi-app-composition.md} +65 -23
- package/catalog/{setup/nx-workflow/SKILL.md → frontmcp-setup/references/nx-workflow.md} +78 -21
- package/catalog/frontmcp-setup/references/project-structure-nx.md +246 -0
- package/catalog/frontmcp-setup/references/project-structure-standalone.md +212 -0
- package/catalog/{setup/setup-project/SKILL.md → frontmcp-setup/references/setup-project.md} +62 -62
- package/catalog/{setup/setup-redis/SKILL.md → frontmcp-setup/references/setup-redis.md} +59 -86
- package/catalog/{setup/setup-sqlite/SKILL.md → frontmcp-setup/references/setup-sqlite.md} +64 -76
- package/catalog/frontmcp-testing/SKILL.md +127 -0
- package/catalog/{testing/setup-testing/SKILL.md → frontmcp-testing/references/setup-testing.md} +78 -67
- package/catalog/{testing/setup-testing → frontmcp-testing}/references/test-tool-unit.md +1 -0
- package/catalog/skills-manifest.json +39 -378
- package/package.json +2 -2
- package/src/loader.js +0 -1
- package/src/loader.js.map +1 -1
- package/src/manifest.d.ts +3 -3
- package/src/manifest.js +2 -3
- package/src/manifest.js.map +1 -1
- package/catalog/adapters/create-adapter/SKILL.md +0 -127
- package/catalog/adapters/official-adapters/SKILL.md +0 -136
- package/catalog/auth/configure-auth/SKILL.md +0 -250
- package/catalog/auth/configure-session/SKILL.md +0 -201
- package/catalog/config/configure-elicitation/SKILL.md +0 -136
- package/catalog/config/configure-http/SKILL.md +0 -167
- package/catalog/config/configure-throttle/SKILL.md +0 -189
- package/catalog/config/configure-transport/SKILL.md +0 -151
- package/catalog/deployment/build-for-browser/SKILL.md +0 -95
- package/catalog/deployment/build-for-cli/SKILL.md +0 -100
- package/catalog/deployment/deploy-to-cloudflare/SKILL.md +0 -192
- package/catalog/deployment/deploy-to-vercel/SKILL.md +0 -196
- package/catalog/deployment/deploy-to-vercel/references/vercel.json.example +0 -60
- package/catalog/setup/frontmcp-skills-usage/SKILL.md +0 -200
- package/catalog/setup/project-structure-nx/SKILL.md +0 -186
- package/catalog/setup/project-structure-standalone/SKILL.md +0 -153
- /package/catalog/{auth/configure-auth/references/auth-modes.md → frontmcp-config/references/configure-auth-modes.md} +0 -0
- /package/catalog/{config/configure-throttle/references/guard-config.md → frontmcp-config/references/configure-throttle-guard-config.md} +0 -0
- /package/catalog/{config/configure-transport/references/protocol-presets.md → frontmcp-config/references/configure-transport-protocol-presets.md} +0 -0
- /package/catalog/{development/create-tool/references/tool-annotations.md → frontmcp-development/references/create-tool-annotations.md} +0 -0
- /package/catalog/{development/create-tool/references/output-schema-types.md → frontmcp-development/references/create-tool-output-schema-types.md} +0 -0
- /package/catalog/{testing/setup-testing → frontmcp-testing}/references/test-auth.md +0 -0
- /package/catalog/{testing/setup-testing → frontmcp-testing}/references/test-browser-build.md +0 -0
- /package/catalog/{testing/setup-testing → frontmcp-testing}/references/test-cli-binary.md +0 -0
- /package/catalog/{testing/setup-testing → frontmcp-testing}/references/test-direct-client.md +0 -0
- /package/catalog/{testing/setup-testing → frontmcp-testing}/references/test-e2e-handler.md +0 -0
package/catalog/{testing/setup-testing/SKILL.md → frontmcp-testing/references/setup-testing.md}
RENAMED
|
@@ -1,53 +1,29 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: setup-testing
|
|
3
|
-
description: Configure and run unit and E2E tests for FrontMCP applications. Use when writing tests, setting up Jest, configuring coverage, or testing tools and resources.
|
|
4
|
-
tags:
|
|
5
|
-
- testing
|
|
6
|
-
- jest
|
|
7
|
-
- e2e
|
|
8
|
-
- quality
|
|
9
|
-
bundle:
|
|
10
|
-
- recommended
|
|
11
|
-
- full
|
|
12
|
-
visibility: both
|
|
13
|
-
priority: 5
|
|
14
|
-
parameters:
|
|
15
|
-
- name: test-type
|
|
16
|
-
description: Type of test to set up (unit, e2e, or both)
|
|
17
|
-
type: string
|
|
18
|
-
required: false
|
|
19
|
-
default: both
|
|
20
|
-
- name: coverage-threshold
|
|
21
|
-
description: Minimum coverage percentage required
|
|
22
|
-
type: number
|
|
23
|
-
required: false
|
|
24
|
-
default: 95
|
|
25
|
-
examples:
|
|
26
|
-
- scenario: Set up unit tests for a tool with Jest
|
|
27
|
-
parameters:
|
|
28
|
-
test-type: unit
|
|
29
|
-
expected-outcome: Tool execute method is tested with mocked context, assertions verify output schema
|
|
30
|
-
- scenario: Set up E2E tests against a running MCP server
|
|
31
|
-
parameters:
|
|
32
|
-
test-type: e2e
|
|
33
|
-
expected-outcome: McpTestClient connects to server, calls tools, and verifies responses with MCP matchers
|
|
34
|
-
- scenario: Configure full test suite with 95% coverage enforcement
|
|
35
|
-
parameters:
|
|
36
|
-
test-type: both
|
|
37
|
-
coverage-threshold: 95
|
|
38
|
-
expected-outcome: Jest runs unit and E2E tests with coverage thresholds enforced in CI
|
|
39
|
-
license: MIT
|
|
40
|
-
compatibility: Requires Node.js 18+, Jest 29+, and @frontmcp/testing for E2E tests
|
|
41
|
-
metadata:
|
|
42
|
-
category: testing
|
|
43
|
-
difficulty: beginner
|
|
44
|
-
docs: https://docs.agentfront.dev/frontmcp/testing/overview
|
|
45
|
-
---
|
|
46
|
-
|
|
47
1
|
# Set Up Testing for FrontMCP Applications
|
|
48
2
|
|
|
49
3
|
This skill covers testing FrontMCP applications at three levels: unit tests for individual tools/resources/prompts, E2E tests exercising the full MCP protocol, and manual testing with `frontmcp dev`.
|
|
50
4
|
|
|
5
|
+
## When to Use This Skill
|
|
6
|
+
|
|
7
|
+
### Must Use
|
|
8
|
+
|
|
9
|
+
- Writing the first unit test for a new tool, resource, or prompt class
|
|
10
|
+
- Setting up Jest configuration and coverage thresholds for a FrontMCP library
|
|
11
|
+
- Creating E2E tests that exercise the full MCP protocol via `McpTestClient`
|
|
12
|
+
|
|
13
|
+
### Recommended
|
|
14
|
+
|
|
15
|
+
- Adding coverage enforcement to CI for an existing library that lacks thresholds
|
|
16
|
+
- Writing authenticated E2E tests with `TestTokenFactory` and `MockOAuthServer`
|
|
17
|
+
- Migrating existing `.test.ts` files to the required `.spec.ts` naming convention
|
|
18
|
+
|
|
19
|
+
### Skip When
|
|
20
|
+
|
|
21
|
+
- Building a new tool class from scratch (see `create-tool`)
|
|
22
|
+
- Creating resources or prompts before you have anything to test (see `create-resource`, `create-prompt`)
|
|
23
|
+
- Debugging deployment issues unrelated to test configuration (see `deploy-to-node`, `deploy-to-vercel`)
|
|
24
|
+
|
|
25
|
+
> **Decision:** Use this skill when you need to configure, write, or run Jest tests for FrontMCP tools, resources, or prompts.
|
|
26
|
+
|
|
51
27
|
## Testing Standards
|
|
52
28
|
|
|
53
29
|
FrontMCP requires:
|
|
@@ -65,7 +41,7 @@ FrontMCP requires:
|
|
|
65
41
|
|
|
66
42
|
Place test files next to the source file or in a `__tests__` directory:
|
|
67
43
|
|
|
68
|
-
```
|
|
44
|
+
```text
|
|
69
45
|
src/
|
|
70
46
|
tools/
|
|
71
47
|
my-tool.ts
|
|
@@ -350,7 +326,7 @@ describe('Advanced E2E', () => {
|
|
|
350
326
|
});
|
|
351
327
|
|
|
352
328
|
client = await McpTestClient.create({ baseUrl: server.info.baseUrl })
|
|
353
|
-
.withTransport('
|
|
329
|
+
.withTransport('modern') // 'modern' preset enables streamable HTTP + strict sessions
|
|
354
330
|
.buildAndConnect();
|
|
355
331
|
});
|
|
356
332
|
|
|
@@ -514,26 +490,61 @@ node scripts/fix-unused-imports.mjs feature/my-branch
|
|
|
514
490
|
| Playwright browser tests | UI tests with Playwright | `.pw.spec.ts` |
|
|
515
491
|
| Constructor validation | Unit test verifying throws on invalid input | `.spec.ts` |
|
|
516
492
|
|
|
517
|
-
## Common
|
|
493
|
+
## Common Patterns
|
|
494
|
+
|
|
495
|
+
| Pattern | Correct | Incorrect | Why |
|
|
496
|
+
| ---------------- | -------------------------------------------------------- | ------------------------------------------------ | ------------------------------------------------------------------------------ |
|
|
497
|
+
| Test file naming | `my-tool.spec.ts`, `my-tool.e2e.spec.ts` | `my-tool.test.ts`, `my-tool.test.tsx` | Nx and Jest configs only recognize `.spec.ts` convention |
|
|
498
|
+
| Test description | `'should return formatted output for valid input'` | `'PT-001: test formatted output'` | Descriptive names; no ID prefixes |
|
|
499
|
+
| Mock types | `const ctx = { scope: { get: jest.fn() } } as unknown` | `const ctx: any = { scope: { get: jest.fn() } }` | Strict TypeScript; avoid `any` in mocks |
|
|
500
|
+
| Error assertion | `expect(err).toBeInstanceOf(ResourceNotFoundError)` | `expect(() => ...).toThrow()` | Verify the exact error class and MCP error code, not just that something threw |
|
|
501
|
+
| Constructor test | Always test `new MyService({})` throws on invalid config | Skip constructor validation | Catches misconfiguration early; required for 95% branch coverage |
|
|
502
|
+
| E2E test imports | `import { test, expect } from '@frontmcp/testing'` | `import { expect } from '@jest/globals'` | `@frontmcp/testing` provides MCP-specific matchers like `toContainTool()` |
|
|
503
|
+
| Coverage check | `nx test my-lib --coverage` before push | Push without coverage check | CI enforces 95% thresholds; catch failures locally first |
|
|
504
|
+
|
|
505
|
+
## Verification Checklist
|
|
506
|
+
|
|
507
|
+
### Configuration
|
|
508
|
+
|
|
509
|
+
- [ ] Jest config exists with `coverageThreshold` set to 95% for all metrics
|
|
510
|
+
- [ ] `tsconfig.spec.json` exists and extends the base tsconfig
|
|
511
|
+
- [ ] `@frontmcp/testing` is installed as a dev dependency for E2E tests
|
|
512
|
+
- [ ] Test files use `.spec.ts` (unit), `.e2e.spec.ts` (E2E), or `.perf.spec.ts` (perf) extension
|
|
513
|
+
|
|
514
|
+
### Unit Tests
|
|
515
|
+
|
|
516
|
+
- [ ] Each tool's `execute()` method is tested with valid and invalid inputs
|
|
517
|
+
- [ ] Each resource's `read()` method is tested and output matches `ReadResourceResult` shape
|
|
518
|
+
- [ ] Each prompt's `execute()` method is tested and output matches `GetPromptResult` shape
|
|
519
|
+
- [ ] Constructor validation tests verify throws on invalid config
|
|
520
|
+
- [ ] Error classes are verified with `instanceof` checks and `mcpErrorCode` assertions
|
|
521
|
+
|
|
522
|
+
### E2E Tests
|
|
523
|
+
|
|
524
|
+
- [ ] Fixture-based tests use `test.use({ server, port })` for server lifecycle
|
|
525
|
+
- [ ] Tools appear in `tools/list` response via `toContainTool()` matcher
|
|
526
|
+
- [ ] Tool calls return expected results via `toBeSuccessful()` matcher
|
|
527
|
+
- [ ] Authenticated tests use `TestTokenFactory` and verify rejection without token
|
|
528
|
+
|
|
529
|
+
### CI Integration
|
|
530
|
+
|
|
531
|
+
- [ ] `nx test <lib> --coverage` passes locally with 95%+ on all metrics
|
|
532
|
+
- [ ] Unused imports are cleaned via `node scripts/fix-unused-imports.mjs`
|
|
533
|
+
- [ ] No TypeScript warnings in test files
|
|
534
|
+
|
|
535
|
+
## Troubleshooting
|
|
518
536
|
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
537
|
+
| Problem | Cause | Solution |
|
|
538
|
+
| -------------------------------------------- | ------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- |
|
|
539
|
+
| Jest cannot find test files | Files use `.test.ts` instead of `.spec.ts` | Rename to `.spec.ts`; Nx test runner only picks up `.spec.ts` by default |
|
|
540
|
+
| Coverage below 95% threshold | Untested branches or constructor paths | Run `nx test <lib> --coverage` and check the HTML report for uncovered lines |
|
|
541
|
+
| E2E test times out on `TestServer.start()` | Server entrypoint fails to start or wrong port | Verify `server` path and `port` in `test.use()`; check server logs for startup errors |
|
|
542
|
+
| `toContainTool` matcher not found | Using `expect` from Jest instead of `@frontmcp/testing` | Import `expect` from `@frontmcp/testing` to get MCP-specific matchers |
|
|
543
|
+
| `McpTestClient.create()` connection refused | Test server not running or wrong `baseUrl` | Ensure `TestServer.start()` completes before creating client; verify port matches |
|
|
544
|
+
| Istanbul shows 0% coverage for async methods | TypeScript compilation source-map mismatch | Known issue with `ts-jest` and certain async patterns; check `tsconfig.spec.json` source-map settings |
|
|
545
|
+
| Auth E2E test returns 401 unexpectedly | Token not set or expired | Call `mcp.setAuthToken(token)` before the tool call; use `auth.createToken()` with valid claims |
|
|
526
546
|
|
|
527
547
|
## Reference
|
|
528
548
|
|
|
529
|
-
- Testing
|
|
530
|
-
-
|
|
531
|
-
- Test client builder: `McpTestClient.builder()` — fluent API for test setup
|
|
532
|
-
- MCP matchers: `toContainTool()`, `toBeSuccessful()` — import from `@frontmcp/testing`
|
|
533
|
-
- Test fixtures: `createTestFixture()` — import from `@frontmcp/testing`
|
|
534
|
-
- Test server: `TestServer` — import from `@frontmcp/testing`
|
|
535
|
-
- Performance testing: `perfTest()`, `MetricsCollector` — import from `@frontmcp/testing`
|
|
536
|
-
- Auth testing: `TestTokenFactory`, `MockOAuthServer` — import from `@frontmcp/testing`
|
|
537
|
-
- Interceptors: `TestInterceptor` — import from `@frontmcp/testing`
|
|
538
|
-
- HTTP mocking: `HttpMock` — import from `@frontmcp/testing`
|
|
539
|
-
- [Source code on GitHub](https://github.com/agentfront/frontmcp/tree/main/libs/testing)
|
|
549
|
+
- [Testing Documentation](https://docs.agentfront.dev/frontmcp/testing/overview)
|
|
550
|
+
- Related skills: `create-tool`, `create-resource`, `create-prompt`, `setup-project`, `nx-workflow`
|