@mastra/mcp-docs-server 0.13.7-alpha.3 → 0.13.7-alpha.4

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.
@@ -1,5 +1,12 @@
1
1
  # @mastra/client-js
2
2
 
3
+ ## 0.10.17-alpha.4
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [ad0a58b]
8
+ - @mastra/core@0.12.0-alpha.4
9
+
3
10
  ## 0.10.17-alpha.3
4
11
 
5
12
  ### Patch Changes
@@ -292,11 +299,4 @@
292
299
 
293
300
  ## 0.10.10-alpha.1
294
301
 
295
- ### Patch Changes
296
-
297
- - Updated dependencies [7f6e403]
298
- - @mastra/core@0.10.11-alpha.1
299
-
300
- ## 0.10.10-alpha.0
301
-
302
- ... 1760 more lines hidden. See full changelog in package directory.
302
+ ... 1767 more lines hidden. See full changelog in package directory.
@@ -1,5 +1,11 @@
1
1
  # @mastra/core
2
2
 
3
+ ## 0.12.0-alpha.4
4
+
5
+ ### Patch Changes
6
+
7
+ - ad0a58b: Enhancements for premade input processors
8
+
3
9
  ## 0.12.0-alpha.3
4
10
 
5
11
  ## 0.12.0-alpha.2
@@ -292,11 +298,5 @@
292
298
 
293
299
  ### Patch Changes
294
300
 
295
- - 9dda1ac: dependencies updates:
296
- - Updated dependency [`hono@^4.8.3` ↗︎](https://www.npmjs.com/package/hono/v/4.8.3) (from `^4.7.11`, in `dependencies`)
297
- - c984582: Improve error messages for invalid message content in MessageList
298
- - 7e801dd: [MASTRA-4118] fixes issue with agent network loopStream where subsequent messages aren't present in playground on refresh
299
- - a606c75: show right suspend schema for nested workflow on playground
300
- - 7aa70a4: Use the right step id for nested workflow steps in watch-v2
301
301
 
302
- ... 2318 more lines hidden. See full changelog in package directory.
302
+ ... 2324 more lines hidden. See full changelog in package directory.
@@ -1,5 +1,13 @@
1
1
  # @mastra/deployer
2
2
 
3
+ ## 0.12.0-alpha.4
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [ad0a58b]
8
+ - @mastra/core@0.12.0-alpha.4
9
+ - @mastra/server@0.12.0-alpha.4
10
+
3
11
  ## 0.12.0-alpha.3
4
12
 
5
13
  ### Patch Changes
@@ -289,14 +297,6 @@
289
297
 
290
298
  - 53e3f58: Add support for custom instrumentation files
291
299
  - Updated dependencies [b4a9811]
292
- - Updated dependencies [4d5583d]
293
- - @mastra/core@0.10.12
294
- - @mastra/server@0.10.12
295
-
296
- ## 0.10.12-alpha.1
297
-
298
- ### Patch Changes
299
-
300
300
  - Updated dependencies [4d5583d]
301
301
 
302
- ... 3086 more lines hidden. See full changelog in package directory.
302
+ ... 3094 more lines hidden. See full changelog in package directory.
@@ -1,5 +1,12 @@
1
1
  # @mastra/mcp-docs-server
2
2
 
3
+ ## 0.13.7-alpha.4
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [ad0a58b]
8
+ - @mastra/core@0.12.0-alpha.4
9
+
3
10
  ## 0.13.7-alpha.3
4
11
 
5
12
  ### Patch Changes
@@ -291,12 +298,5 @@
291
298
 
292
299
  - 63f6b7d: dependencies updates:
293
300
  - Updated dependency [`@modelcontextprotocol/sdk@^1.12.1` ↗︎](https://www.npmjs.com/package/@modelcontextprotocol/sdk/v/1.12.1) (from `^1.9.0`, in `dependencies`)
294
- - Updated dependency [`jsdom@^26.1.0` ↗︎](https://www.npmjs.com/package/jsdom/v/26.1.0) (from `^26.0.0`, in `dependencies`)
295
- - Updated dependency [`turndown@^7.2.0` ↗︎](https://www.npmjs.com/package/turndown/v/7.2.0) (from `^7.1.2`, in `dependencies`)
296
- - Updated dependency [`zod@^3.25.57` ↗︎](https://www.npmjs.com/package/zod/v/3.25.57) (from `^3.25.56`, in `dependencies`)
297
- - Updated dependencies [63f6b7d]
298
- - Updated dependencies [63f6b7d]
299
- - Updated dependencies [36f1c36]
300
- - Updated dependencies [10d352e]
301
301
 
302
- ... 1049 more lines hidden. See full changelog in package directory.
302
+ ... 1056 more lines hidden. See full changelog in package directory.
@@ -1,5 +1,12 @@
1
1
  # @mastra/deployer
2
2
 
3
+ ## 0.12.0-alpha.4
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [ad0a58b]
8
+ - @mastra/core@0.12.0-alpha.4
9
+
3
10
  ## 0.12.0-alpha.3
4
11
 
5
12
  ### Patch Changes
@@ -292,11 +299,4 @@
292
299
 
293
300
  ### Patch Changes
294
301
 
295
- - Updated dependencies [7f6e403]
296
- - @mastra/core@0.10.11-alpha.1
297
-
298
- ## 0.10.11-alpha.0
299
-
300
- ### Patch Changes
301
-
302
- ... 2556 more lines hidden. See full changelog in package directory.
302
+ ... 2563 more lines hidden. See full changelog in package directory.
@@ -462,7 +462,12 @@ import { Memory } from '@mastra/memory';
462
462
  import { Agent, InputProcessor } from '@mastra/core/agent';
463
463
  import { cookingTool } from '../tools/index.js';
464
464
  import { myWorkflow } from '../workflows/index.js';
465
- import { PIIDetector, LanguageDetector, PromptInjectionDetector } from '@mastra/core/agent/input-processor/processors';
465
+ import {
466
+ PIIDetector,
467
+ LanguageDetector,
468
+ PromptInjectionDetector,
469
+ ModerationInputProcessor,
470
+ } from '@mastra/core/agent/input-processor/processors';
466
471
  import { MCPClient } from '@mastra/mcp';
467
472
 
468
473
  const memory = new Memory();
@@ -577,13 +582,9 @@ const promptInjectionDetector = new PromptInjectionDetector({
577
582
  strategy: 'block',
578
583
  });
579
584
 
580
- const mcpInstance = new MCPClient({
581
- id: 'myMcpServerTwo',
582
- servers: {
583
- myMcpServerTwo: {
584
- url: new URL(`http://localhost:4111/api/mcp/myMcpServerTwo/mcp`),
585
- },
586
- },
585
+ const moderationDetector = new ModerationInputProcessor({
586
+ model: google('gemini-2.0-flash-001'),
587
+ strategy: 'block',
587
588
  });
588
589
 
589
590
  export const chefAgentResponses = new Agent({
@@ -596,7 +597,6 @@ export const chefAgentResponses = new Agent({
596
597
  model: openai.responses('gpt-4o'),
597
598
  tools: async () => {
598
599
  return {
599
- ...(await mcpInstance.getTools()),
600
600
  web_search_preview: openai.tools.webSearchPreview(),
601
601
  };
602
602
  },
@@ -604,10 +604,11 @@ export const chefAgentResponses = new Agent({
604
604
  myWorkflow,
605
605
  },
606
606
  inputProcessors: [
607
- piiDetector,
608
- vegetarianProcessor,
607
+ // piiDetector,
608
+ // vegetarianProcessor,
609
609
  languageDetector,
610
- promptInjectionDetector,
610
+ // promptInjectionDetector,
611
+ // moderationDetector,
611
612
  {
612
613
  name: 'no-soup-for-you',
613
614
  process: async ({ messages, abort }) => {
@@ -153,7 +153,7 @@ import { LanguageDetector } from "@mastra/core/agent/input-processor/processors"
153
153
  const agent = new Agent({
154
154
  inputProcessors: [
155
155
  new LanguageDetector({
156
- model: openai("gpt-4o"),
156
+ model: openai("gpt-4o-mini"),
157
157
  targetLanguages: ['English', 'en'], // Accept English content
158
158
  strategy: 'translate', // Auto-translate non-English content
159
159
  threshold: 0.8, // High confidence threshold
@@ -210,7 +210,7 @@ const secureAgent = new Agent({
210
210
  You can create custom processors by implementing the `InputProcessor` interface.
211
211
 
212
212
  ```typescript copy showLineNumbers {4-19,23-26}
213
- import type { InputProcessor, MastraMessageV2 } from "@mastra/core/agent";
213
+ import type { InputProcessor, MastraMessageV2, TripWire } from "@mastra/core/agent";
214
214
 
215
215
  class MessageLengthLimiter implements InputProcessor {
216
216
  readonly name = 'message-length-limiter';
@@ -222,14 +222,21 @@ class MessageLengthLimiter implements InputProcessor {
222
222
  abort: (reason?: string) => never
223
223
  }): MastraMessageV2[] {
224
224
  // Check total message length
225
- const totalLength = messages.reduce((sum, msg) => {
226
- return sum + msg.content.parts
227
- .filter(part => part.type === 'text')
228
- .reduce((partSum, part) => partSum + (part as any).text.length, 0);
229
- }, 0);
230
-
231
- if (totalLength > this.maxLength) {
232
- abort(`Message too long: ${totalLength} characters (max: ${this.maxLength})`);
225
+ try {
226
+ const totalLength = messages.reduce((sum, msg) => {
227
+ return sum + msg.content.parts
228
+ .filter(part => part.type === 'text')
229
+ .reduce((partSum, part) => partSum + (part as any).text.length, 0);
230
+ }, 0);
231
+
232
+ if (totalLength > this.maxLength) {
233
+ abort(`Message too long: ${totalLength} characters (max: ${this.maxLength})`); // throws a TripWire error
234
+ }
235
+ } catch (error) {
236
+ if (error instanceof TripWire) {
237
+ throw error; // Re-throw tripwire errors
238
+ }
239
+ throw new Error(`Length validation failed: ${error instanceof Error ? error.message : 'Unknown error'}`); // application level throw a standard error
233
240
  }
234
241
 
235
242
  return messages;
@@ -246,9 +253,10 @@ const agent = new Agent({
246
253
 
247
254
  When creating custom processors:
248
255
  - Always return the `messages` array (potentially modified)
249
- - Use `abort(reason)` to terminate processing early
250
- - Mutate the input messages directly
256
+ - Use `abort(reason)` to terminate processing early. Abort is used to simulate blocking a message. errors thrown with `abort` will be an instance of TripWire. For code/application level errors, throw standard errors.
257
+ - Mutate the input messages directly, make sure to mutate both the parts and content of a message.
251
258
  - Keep processors focused on a single responsibility
259
+ - If using an agent inside your processor, use a fast model, limit the size of the response from it as much as possible (every token slows down the response exponentially), and make the system prompt as concise as possible, these are both latency bottlenecks.
252
260
 
253
261
  ## Integration with Agent Methods
254
262
 
@@ -265,4 +273,4 @@ for await (const chunk of stream.textStream) {
265
273
  }
266
274
  ```
267
275
 
268
- If any processor calls `abort()`, the request terminates immediately and subsequent processors are not executed. The agent returns an error response with details about why the request was blocked.
276
+ If any processor calls `abort()`, the request terminates immediately and subsequent processors are not executed. The agent returns a 200 response with details (`result.tripwireReason`) about why the request was blocked.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/mcp-docs-server",
3
- "version": "0.13.7-alpha.3",
3
+ "version": "0.13.7-alpha.4",
4
4
  "description": "MCP server for accessing Mastra.ai documentation, changelogs, and news.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -32,7 +32,7 @@
32
32
  "uuid": "^11.1.0",
33
33
  "zod": "^3.25.67",
34
34
  "zod-to-json-schema": "^3.24.5",
35
- "@mastra/core": "0.12.0-alpha.3",
35
+ "@mastra/core": "0.12.0-alpha.4",
36
36
  "@mastra/mcp": "^0.10.7"
37
37
  },
38
38
  "devDependencies": {
@@ -49,7 +49,7 @@
49
49
  "typescript": "^5.8.3",
50
50
  "vitest": "^3.2.4",
51
51
  "@internal/lint": "0.0.23",
52
- "@mastra/core": "0.12.0-alpha.3"
52
+ "@mastra/core": "0.12.0-alpha.4"
53
53
  },
54
54
  "scripts": {
55
55
  "prepare-docs": "cross-env PREPARE=true node dist/prepare-docs/prepare.js",