@mastra/server-adapters-test-suite 0.3.0-alpha.4 → 0.3.0-alpha.5
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/CHANGELOG.md +22 -0
- package/dist/builtin-mcp-oauth-test-suite.d.ts +15 -0
- package/dist/builtin-mcp-oauth-test-suite.d.ts.map +1 -0
- package/dist/builtin-mcp-parity-test-suite.d.ts +15 -0
- package/dist/builtin-mcp-parity-test-suite.d.ts.map +1 -0
- package/dist/builtin-mcp-toolsets-test-suite.d.ts +27 -0
- package/dist/builtin-mcp-toolsets-test-suite.d.ts.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3544 -139
- package/dist/index.js.map +1 -1
- package/dist/mcp-transport-test-suite.d.ts +1 -1
- package/dist/mcp-transport-test-suite.d.ts.map +1 -1
- package/dist/observability-signal-write-test-suite.d.ts.map +1 -1
- package/dist/route-dispatch-parity-test-suite.d.ts +38 -0
- package/dist/route-dispatch-parity-test-suite.d.ts.map +1 -0
- package/dist/route-test-utils.d.ts.map +1 -1
- package/package.json +9 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# @mastra/server-adapters-test-suite
|
|
2
2
|
|
|
3
|
+
## 0.3.0-alpha.5
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Added `createBuiltinMCPOAuthTestSuite`, which checks that a server adapter serves the built-in MCP server's OAuth metadata, sends the `WWW-Authenticate` challenge, and enforces the token audience. ([#29930](https://github.com/mastra-ai/mastra/pull/29930))
|
|
8
|
+
|
|
9
|
+
The package now has `@mastra/auth` and `jose` as peer dependencies, because the suite signs real tokens and verifies them with `MastraJwtAuth`. Install both alongside the test suite.
|
|
10
|
+
|
|
11
|
+
- Added a shared test suite that checks the built-in MCP server behaves the same as the HTTP API on each server adapter. ([#29929](https://github.com/mastra-ai/mastra/pull/29929))
|
|
12
|
+
|
|
13
|
+
- Added `createBuiltinMCPToolsetsTestSuite`, which checks that an adapter's built-in MCP memory and observability tools allow and deny the same calls as the HTTP routes. ([#29931](https://github.com/mastra-ai/mastra/pull/29931))
|
|
14
|
+
|
|
15
|
+
- Added `createRouteDispatchParityTestSuite`, which checks that a server adapter and `dispatchRoute` return the same allow/deny results for RBAC, fine-grained authorization and thread ownership on agent, workflow and tool routes. ([#29928](https://github.com/mastra-ai/mastra/pull/29928))
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- Updated dependencies [[`4fcc168`](https://github.com/mastra-ai/mastra/commit/4fcc168fa1b65b77e622a3d6d7a88041cd3d0843), [`18168d5`](https://github.com/mastra-ai/mastra/commit/18168d518cc663b189cced787efb70c376efc0b3), [`2770567`](https://github.com/mastra-ai/mastra/commit/27705673f2d33b5094a25cfb538d87d81ad9f2c8), [`2770567`](https://github.com/mastra-ai/mastra/commit/27705673f2d33b5094a25cfb538d87d81ad9f2c8), [`392c7b6`](https://github.com/mastra-ai/mastra/commit/392c7b69d51e19c38eea64098b72567592479cc8), [`392c7b6`](https://github.com/mastra-ai/mastra/commit/392c7b69d51e19c38eea64098b72567592479cc8), [`4ba2bde`](https://github.com/mastra-ai/mastra/commit/4ba2bdef8973889c664c14ff1e221016c94eb3f4), [`4ba2bde`](https://github.com/mastra-ai/mastra/commit/4ba2bdef8973889c664c14ff1e221016c94eb3f4), [`834b0d2`](https://github.com/mastra-ai/mastra/commit/834b0d282822d0cc91b73f47c4e546d684c1ede3), [`e58a7d5`](https://github.com/mastra-ai/mastra/commit/e58a7d5cd68b8b7b4fc34051eb5593bbbee63f01), [`5ff479a`](https://github.com/mastra-ai/mastra/commit/5ff479a34b6b0151da2699a347f8e680b8d558ae), [`2770567`](https://github.com/mastra-ai/mastra/commit/27705673f2d33b5094a25cfb538d87d81ad9f2c8), [`2770567`](https://github.com/mastra-ai/mastra/commit/27705673f2d33b5094a25cfb538d87d81ad9f2c8), [`392c7b6`](https://github.com/mastra-ai/mastra/commit/392c7b69d51e19c38eea64098b72567592479cc8), [`834b0d2`](https://github.com/mastra-ai/mastra/commit/834b0d282822d0cc91b73f47c4e546d684c1ede3), [`392c7b6`](https://github.com/mastra-ai/mastra/commit/392c7b69d51e19c38eea64098b72567592479cc8), [`c0d3bfd`](https://github.com/mastra-ai/mastra/commit/c0d3bfdc43d5c9ded75b7373e0ac943c567e2781), [`e1a2036`](https://github.com/mastra-ai/mastra/commit/e1a20364af31f433d0f91cb3f5ce8e49eb45b615), [`d05afc4`](https://github.com/mastra-ai/mastra/commit/d05afc4a900d98eec4db23acc8c0c4a1bb336df1), [`834b0d2`](https://github.com/mastra-ai/mastra/commit/834b0d282822d0cc91b73f47c4e546d684c1ede3), [`834b0d2`](https://github.com/mastra-ai/mastra/commit/834b0d282822d0cc91b73f47c4e546d684c1ede3), [`5251e71`](https://github.com/mastra-ai/mastra/commit/5251e7199e71278ccfde7ca2d33320b3ea681731), [`c0d3bfd`](https://github.com/mastra-ai/mastra/commit/c0d3bfdc43d5c9ded75b7373e0ac943c567e2781), [`c0d3bfd`](https://github.com/mastra-ai/mastra/commit/c0d3bfdc43d5c9ded75b7373e0ac943c567e2781), [`0b24f9c`](https://github.com/mastra-ai/mastra/commit/0b24f9cdb0b0835289acbc860c4bb29934845534)]:
|
|
20
|
+
- @mastra/core@1.83.0-alpha.13
|
|
21
|
+
- @mastra/server@1.83.0-alpha.13
|
|
22
|
+
- @mastra/auth@1.2.0-alpha.0
|
|
23
|
+
- @mastra/mcp@2.9.0-alpha.5
|
|
24
|
+
|
|
3
25
|
## 0.3.0-alpha.4
|
|
4
26
|
|
|
5
27
|
### Patch Changes
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Mastra } from '@mastra/core/mastra';
|
|
2
|
+
export interface BuiltinMCPOAuthTestSuiteConfig {
|
|
3
|
+
suiteName?: string;
|
|
4
|
+
/** Serve the Mastra instance over real HTTP (MCPClient needs a socket) and return its base URL. */
|
|
5
|
+
startServer: (mastra: Mastra) => Promise<{
|
|
6
|
+
url: string;
|
|
7
|
+
close: () => Promise<void>;
|
|
8
|
+
}>;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* OAuth discovery (RFC 9728) and audience enforcement for the built-in `/api/mcp` endpoint, using a real
|
|
12
|
+
* `MastraJwtAuth` verifying RS256 tokens against a local JWKS server.
|
|
13
|
+
*/
|
|
14
|
+
export declare function createBuiltinMCPOAuthTestSuite(config: BuiltinMCPOAuthTestSuiteConfig): void;
|
|
15
|
+
//# sourceMappingURL=builtin-mcp-oauth-test-suite.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"builtin-mcp-oauth-test-suite.d.ts","sourceRoot":"","sources":["../src/builtin-mcp-oauth-test-suite.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAW7C,MAAM,WAAW,8BAA8B;IAC7C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,mGAAmG;IACnG,WAAW,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;KAAE,CAAC,CAAC;CACvF;AA2CD;;;GAGG;AACH,wBAAgB,8BAA8B,CAAC,MAAM,EAAE,8BAA8B,QA0TpF"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Mastra } from '@mastra/core/mastra';
|
|
2
|
+
export interface BuiltinMCPParityTestSuiteConfig {
|
|
3
|
+
suiteName?: string;
|
|
4
|
+
/** Serve the Mastra instance over real HTTP (MCPClient needs a socket) and return its base URL. */
|
|
5
|
+
startServer: (mastra: Mastra) => Promise<{
|
|
6
|
+
url: string;
|
|
7
|
+
close: () => Promise<void>;
|
|
8
|
+
}>;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* The built-in `/api/mcp` server must allow and deny exactly what the equivalent HTTP routes allow and deny
|
|
12
|
+
* for the same user (RBAC, FGA, thread ownership), plus its own `mcp:read` / `mcp:execute` gates.
|
|
13
|
+
*/
|
|
14
|
+
export declare function createBuiltinMCPParityTestSuite(config: BuiltinMCPParityTestSuiteConfig): void;
|
|
15
|
+
//# sourceMappingURL=builtin-mcp-parity-test-suite.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"builtin-mcp-parity-test-suite.d.ts","sourceRoot":"","sources":["../src/builtin-mcp-parity-test-suite.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAY7C,MAAM,WAAW,+BAA+B;IAC9C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,mGAAmG;IACnG,WAAW,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;KAAE,CAAC,CAAC;CACvF;AAoLD;;;GAGG;AACH,wBAAgB,+BAA+B,CAAC,MAAM,EAAE,+BAA+B,QAs1BtF"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Mastra } from '@mastra/core/mastra';
|
|
2
|
+
import type { MastraMemory } from '@mastra/core/memory';
|
|
3
|
+
import type { MastraStorage } from '@mastra/core/storage';
|
|
4
|
+
export interface BuiltinMCPToolsetsTestSuiteConfig {
|
|
5
|
+
suiteName?: string;
|
|
6
|
+
/** Serve the Mastra instance over real HTTP (MCPClient needs a socket) and return its base URL. */
|
|
7
|
+
startServer: (mastra: Mastra) => Promise<{
|
|
8
|
+
url: string;
|
|
9
|
+
close: () => Promise<void>;
|
|
10
|
+
}>;
|
|
11
|
+
/** Storage with a memory domain that supports Observational Memory (e.g. LibSQL). */
|
|
12
|
+
createStorage: () => Promise<{
|
|
13
|
+
storage: MastraStorage;
|
|
14
|
+
cleanup?: () => Promise<void>;
|
|
15
|
+
}>;
|
|
16
|
+
/**
|
|
17
|
+
* A real Memory with Observational Memory enabled at the given scope. `observationalMemory` is spread over the
|
|
18
|
+
* adapter's own Observational Memory options (e.g. a fake observer `model` and low token thresholds).
|
|
19
|
+
*/
|
|
20
|
+
createMemory: (storage: MastraStorage, scope: 'thread' | 'resource', observationalMemory?: Record<string, unknown>) => MastraMemory;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Memory and observability MCP tools must allow and deny exactly what their HTTP routes allow and deny for the
|
|
24
|
+
* same user, and the multi-route analytics tools must dispatch each `op` to that op's own route.
|
|
25
|
+
*/
|
|
26
|
+
export declare function createBuiltinMCPToolsetsTestSuite(config: BuiltinMCPToolsetsTestSuiteConfig): void;
|
|
27
|
+
//# sourceMappingURL=builtin-mcp-toolsets-test-suite.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"builtin-mcp-toolsets-test-suite.d.ts","sourceRoot":"","sources":["../src/builtin-mcp-toolsets-test-suite.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAK1D,MAAM,WAAW,iCAAiC;IAChD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,mGAAmG;IACnG,WAAW,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;KAAE,CAAC,CAAC;IACtF,qFAAqF;IACrF,aAAa,EAAE,MAAM,OAAO,CAAC;QAAE,OAAO,EAAE,aAAa,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;KAAE,CAAC,CAAC;IACxF;;;OAGG;IACH,YAAY,EAAE,CACZ,OAAO,EAAE,aAAa,EACtB,KAAK,EAAE,QAAQ,GAAG,UAAU,EAC5B,mBAAmB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAC1C,YAAY,CAAC;CACnB;AA6DD;;;GAGG;AACH,wBAAgB,iCAAiC,CAAC,MAAM,EAAE,iCAAiC,QA8f1F"}
|
package/dist/index.d.ts
CHANGED
|
@@ -9,6 +9,10 @@ export { createMultipartTestSuite, type MultipartTestSuiteConfig } from './multi
|
|
|
9
9
|
export { createHttpLoggingTestSuite, type HttpLoggingTestSuiteConfig } from './http-logging-test-suite.js';
|
|
10
10
|
export { createBodyLimitTestSuite, type BodyLimitTestSuiteConfig } from './body-limit-test-suite.js';
|
|
11
11
|
export { createCustomRouteFGATestSuite, type CustomRouteFGATestSuiteConfig } from './custom-route-fga-test-suite.js';
|
|
12
|
+
export { createRouteDispatchParityTestSuite, type RouteDispatchParityTestSuiteConfig, } from './route-dispatch-parity-test-suite.js';
|
|
13
|
+
export { createBuiltinMCPOAuthTestSuite, type BuiltinMCPOAuthTestSuiteConfig } from './builtin-mcp-oauth-test-suite.js';
|
|
14
|
+
export { createBuiltinMCPParityTestSuite, type BuiltinMCPParityTestSuiteConfig } from './builtin-mcp-parity-test-suite.js';
|
|
15
|
+
export { createBuiltinMCPToolsetsTestSuite, type BuiltinMCPToolsetsTestSuiteConfig, } from './builtin-mcp-toolsets-test-suite.js';
|
|
12
16
|
export { createDefaultTestContext, createStreamWithSensitiveData, createStreamWithUnserializableChunk, expectSerializedStreamChunks, consumeSSEStream, } from './test-helpers.js';
|
|
13
17
|
export { createKnowledgeRoutesTestSuite, type KnowledgeRoutesTestSuiteConfig } from './knowledge-routes-test-suite.js';
|
|
14
18
|
export { createObservabilitySignalWriteTestSuite, type ObservabilitySignalWriteTestConfig, } from './observability-signal-write-test-suite.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAC;AACzE,OAAO,EAAE,6BAA6B,EAAE,KAAK,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AAC5G,OAAO,EAAE,gCAAgC,EAAE,KAAK,2BAA2B,EAAE,MAAM,iCAAiC,CAAC;AACrH,OAAO,EAAE,+BAA+B,EAAE,KAAK,0BAA0B,EAAE,MAAM,gCAAgC,CAAC;AAClH,YAAY,EACV,sBAAsB,EACtB,kBAAkB,EAClB,mBAAmB,EACnB,WAAW,EACX,YAAY,GACb,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAE,2BAA2B,EAAE,KAAK,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACtG,OAAO,EAAE,wBAAwB,EAAE,KAAK,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AACjG,OAAO,EAAE,0BAA0B,EAAE,KAAK,0BAA0B,EAAE,MAAM,2BAA2B,CAAC;AACxG,OAAO,EAAE,wBAAwB,EAAE,KAAK,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AAClG,OAAO,EAAE,6BAA6B,EAAE,KAAK,6BAA6B,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAC;AACzE,OAAO,EAAE,6BAA6B,EAAE,KAAK,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AAC5G,OAAO,EAAE,gCAAgC,EAAE,KAAK,2BAA2B,EAAE,MAAM,iCAAiC,CAAC;AACrH,OAAO,EAAE,+BAA+B,EAAE,KAAK,0BAA0B,EAAE,MAAM,gCAAgC,CAAC;AAClH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