@mastra/mcp-docs-server 1.2.2 → 1.2.3-alpha.1

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,6 +1,6 @@
1
1
  # Tool approvals and permissions
2
2
 
3
- The Harness provides a permission system that controls which tools require user approval before execution. You can configure policies at the category level or per-tool, and grant session-wide exceptions for trusted tools. This gives agents with access to destructive or sensitive tools — file writes, command execution, API calls — a human-in-the-loop checkpoint before those tools run.
3
+ The AgentController provides a permission system that controls which tools require user approval before execution. You can configure policies at the category level or per-tool, and grant session-wide exceptions for trusted tools. This gives agents with access to destructive or sensitive tools — file writes, command execution, API calls — a human-in-the-loop checkpoint before those tools run.
4
4
 
5
5
  ## Permission policies
6
6
 
@@ -16,18 +16,18 @@ Set policies per-category or per-tool. Per-tool policies take precedence over ca
16
16
 
17
17
  ```typescript
18
18
  // Category-level: all execute tools require approval
19
- await harness.session.permissions.setForCategory({ category: 'execute', policy: 'ask' })
19
+ await agentController.session.permissions.setForCategory({ category: 'execute', policy: 'ask' })
20
20
 
21
21
  // Tool-level: this specific tool is always blocked
22
- await harness.session.permissions.setForTool({ toolName: 'dangerous_tool', policy: 'deny' })
22
+ await agentController.session.permissions.setForTool({ toolName: 'dangerous_tool', policy: 'deny' })
23
23
  ```
24
24
 
25
25
  ### Tool categories
26
26
 
27
- The `toolCategoryResolver` maps tool names to categories. Pass it to the Harness constructor:
27
+ The `toolCategoryResolver` maps tool names to categories. Pass it to the AgentController constructor:
28
28
 
29
29
  ```typescript
30
- const harness = new Harness({
30
+ const agentController = new AgentController({
31
31
  id: 'my-agent',
32
32
  toolCategoryResolver: toolName => {
33
33
  if (toolName.includes('write') || toolName.includes('delete')) return 'edit'
@@ -41,13 +41,13 @@ Built-in categories are `read`, `edit`, `execute`, `mcp`, and `other`.
41
41
 
42
42
  ## Responding to approval requests
43
43
 
44
- When a tool's policy is `ask`, the Harness emits a `tool_approval_required` event. Your UI should display a prompt and call `session.respondToToolApproval()`:
44
+ When a tool's policy is `ask`, the AgentController emits a `tool_approval_required` event. Your UI should display a prompt and call `session.respondToToolApproval()`:
45
45
 
46
46
  ```typescript
47
- harness.subscribe(event => {
47
+ agentController.subscribe(event => {
48
48
  if (event.type === 'tool_approval_required') {
49
49
  // Show approval UI...
50
- harness.session.respondToToolApproval({ decision: 'approve' })
50
+ agentController.session.respondToToolApproval({ decision: 'approve' })
51
51
  }
52
52
  })
53
53
  ```
@@ -55,22 +55,22 @@ harness.subscribe(event => {
55
55
  The `decision` field accepts `'approve'`, `'decline'`, or `'always_allow_category'`. When `always_allow_category` is used, the tool's category is granted for the rest of the session. Future tools in the same category are auto-approved.
56
56
 
57
57
  ```typescript
58
- harness.session.respondToToolApproval({ decision: 'always_allow_category' })
58
+ agentController.session.respondToToolApproval({ decision: 'always_allow_category' })
59
59
  ```
60
60
 
61
61
  ## Session grants
62
62
 
63
- The Harness owns permission _policy_ (which categories require approval); the [`Session`](https://mastra.ai/docs/harness/session) owns the _grants_ a user makes during a conversation. Grant a category or tool for the rest of the session so it runs without further prompting:
63
+ The AgentController owns permission _policy_ (which categories require approval); the [`Session`](https://mastra.ai/docs/agent-controller/session) owns the _grants_ a user makes during a conversation. Grant a category or tool for the rest of the session so it runs without further prompting:
64
64
 
65
65
  ```typescript
66
66
  // Grant all edit tools for this session
67
- harness.session.grantCategory('edit')
67
+ agentController.session.grantCategory('edit')
68
68
 
69
69
  // Grant a specific tool
70
- harness.session.grantTool('mastra_workspace_execute_command')
70
+ agentController.session.grantTool('mastra_workspace_execute_command')
71
71
 
72
72
  // Check current grants
73
- const grants = harness.session.getGrants()
73
+ const grants = agentController.session.getGrants()
74
74
  // { categories: ['edit'], tools: ['mastra_workspace_execute_command'] }
75
75
  ```
76
76
 
@@ -79,11 +79,11 @@ const grants = harness.session.getGrants()
79
79
  Interactive built-in tools (`ask_user`, `submit_plan`) use the native tool-suspension primitive instead of the approval flow. They emit a `tool_suspended` event with `toolCallId`, `toolName`, and `suspendPayload`. Resume with `respondToToolSuspension()`:
80
80
 
81
81
  ```typescript
82
- harness.subscribe(event => {
82
+ agentController.subscribe(event => {
83
83
  if (event.type === 'tool_suspended' && event.toolName === 'ask_user') {
84
84
  const { question } = event.suspendPayload as { question: string }
85
85
  // Show question to user, then resume:
86
- harness.respondToToolSuspension({
86
+ agentController.respondToToolSuspension({
87
87
  toolCallId: event.toolCallId,
88
88
  resumeData: 'User response here',
89
89
  })
@@ -97,13 +97,13 @@ The `submit_plan` tool suspends via the same mechanism. Resume with an `action`
97
97
 
98
98
  ```typescript
99
99
  // Approve the plan
100
- harness.respondToToolSuspension({
100
+ agentController.respondToToolSuspension({
101
101
  toolCallId: event.toolCallId,
102
102
  resumeData: { action: 'approved' },
103
103
  })
104
104
 
105
105
  // Reject with feedback
106
- harness.respondToToolSuspension({
106
+ agentController.respondToToolSuspension({
107
107
  toolCallId: event.toolCallId,
108
108
  resumeData: { action: 'rejected', feedback: 'Needs more detail' },
109
109
  })
@@ -111,7 +111,7 @@ harness.respondToToolSuspension({
111
111
 
112
112
  ## Built-in tools
113
113
 
114
- The Harness provides these built-in tools to agents in every mode:
114
+ The AgentController provides these built-in tools to agents in every mode:
115
115
 
116
116
  | Tool | Description |
117
117
  | --------------- | ------------------------------------------------------------------- |
@@ -126,7 +126,7 @@ The Harness provides these built-in tools to agents in every mode:
126
126
  Disable specific built-in tools with `disableBuiltinTools`:
127
127
 
128
128
  ```typescript
129
- const harness = new Harness({
129
+ const agentController = new AgentController({
130
130
  id: 'no-plans',
131
131
  disableBuiltinTools: ['submit_plan'],
132
132
  })
@@ -134,8 +134,8 @@ const harness = new Harness({
134
134
 
135
135
  ## Related
136
136
 
137
- - [Harness overview](https://mastra.ai/docs/harness/overview)
138
- - [Session](https://mastra.ai/docs/harness/session)
139
- - [Subagents](https://mastra.ai/docs/harness/subagents)
137
+ - [AgentController overview](https://mastra.ai/docs/agent-controller/overview)
138
+ - [Session](https://mastra.ai/docs/agent-controller/session)
139
+ - [Subagents](https://mastra.ai/docs/agent-controller/subagents)
140
140
  - [Agent approval](https://mastra.ai/docs/agents/agent-approval)
141
- - [API reference](https://mastra.ai/reference/harness/harness-class)
141
+ - [API reference](https://mastra.ai/reference/agent-controller/agent-controller-class)
@@ -164,6 +164,53 @@ By default, only images are sent inline (`inlineMedia: ['image/*']`). Unsupporte
164
164
 
165
165
  > **Note:** See [Channels reference](https://mastra.ai/reference/agents/channels) for all `inlineMedia` patterns and [inlineLinks reference](https://mastra.ai/reference/agents/channels) for domain matching, HEAD detection, and forced mime types.
166
166
 
167
+ ## Serverless deployment
168
+
169
+ On serverless platforms like Vercel, each request runs in a separate, short-lived instance. Channels need two things to work reliably in that environment: a way to keep the function alive while the agent responds, and a shared pub/sub so instances can coordinate.
170
+
171
+ ### Keep the function alive with `waitUntil`
172
+
173
+ A channel webhook returns a `200` response right away, then the agent runs in the background to post its reply. On most serverless platforms the function is frozen as soon as it responds, which kills the run before the agent answers. Pass a `waitUntil` function so the platform keeps the instance alive until the run finishes.
174
+
175
+ On Vercel, pass `waitUntil` from `@vercel/functions`:
176
+
177
+ ```typescript
178
+ import { waitUntil } from '@vercel/functions'
179
+
180
+ export const agent = new Agent({
181
+ // ...
182
+ channels: {
183
+ adapters: {
184
+ slack: createSlackAdapter(),
185
+ },
186
+ waitUntil,
187
+ },
188
+ })
189
+ ```
190
+
191
+ Vercel and AWS Lambda require `waitUntil`, since they freeze the function as soon as the response is sent. Cloudflare Workers and Netlify Functions are detected automatically from the request context, so they don't need it. For runtimes where `waitUntil` lives on the request context but isn't detected automatically, use `resolveWaitUntil`. See the [Channels reference](https://mastra.ai/reference/agents/channels) for details.
192
+
193
+ ### Coordinate instances with a shared pub/sub
194
+
195
+ Channels route messages through the agent's signal pipeline, and each run acquires a lease on its thread so a single run owns the conversation at a time. The default in-memory pub/sub can't cross instance boundaries, so on serverless a follow-up message can land on a different instance than the one running the agent. Without a shared pub/sub, that instance can't reach the active run and starts its own, leaving the original run untouched and the thread processed twice.
196
+
197
+ Configure a shared pub/sub backed by Redis Streams on the `Mastra` instance so leases and signals coordinate across instances:
198
+
199
+ ```typescript
200
+ import { Mastra } from '@mastra/core'
201
+ import { RedisStreamsPubSub } from '@mastra/redis-streams'
202
+
203
+ export const mastra = new Mastra({
204
+ agents: { agent },
205
+ pubsub: new RedisStreamsPubSub({
206
+ url: process.env.REDIS_URL,
207
+ keyPrefix: 'mastra:my-app',
208
+ }),
209
+ })
210
+ ```
211
+
212
+ Vercel's one-click Redis integration and Upstash Redis both work well. For more on when a distributed pub/sub is needed, see the [PubSub guide](https://mastra.ai/docs/server/pubsub) and the [`RedisStreamsPubSub` reference](https://mastra.ai/reference/pubsub/redis-streams).
213
+
167
214
  ## Related
168
215
 
169
216
  - [Guide: Building a Slack assistant](https://mastra.ai/guides/guide/slack-assistant)
@@ -1,6 +1,6 @@
1
1
  # ![Vercel logo](https://models.dev/logos/vercel.svg)Vercel
2
2
 
3
- Vercel aggregates models from multiple providers with enhanced features like rate limiting and failover. Access 292 models through Mastra's model router.
3
+ Vercel aggregates models from multiple providers with enhanced features like rate limiting and failover. Access 293 models through Mastra's model router.
4
4
 
5
5
  Learn more in the [Vercel documentation](https://ai-sdk.dev/providers/ai-sdk-providers).
6
6
 
@@ -267,6 +267,7 @@ ANTHROPIC_API_KEY=ant-...
267
267
  | `perplexity/sonar-pro` |
268
268
  | `perplexity/sonar-reasoning-pro` |
269
269
  | `prodia/flux-fast-schnell` |
270
+ | `quiverai/arrow-1.1` |
270
271
  | `recraft/recraft-v2` |
271
272
  | `recraft/recraft-v3` |
272
273
  | `recraft/recraft-v4` |
@@ -1,6 +1,6 @@
1
1
  # Model Providers
2
2
 
3
- Mastra provides a unified interface for working with LLMs across multiple providers, giving you access to 4540 models from 133 providers through a single API.
3
+ Mastra provides a unified interface for working with LLMs across multiple providers, giving you access to 4548 models from 134 providers through a single API.
4
4
 
5
5
  ## Features
6
6
 
@@ -0,0 +1,77 @@
1
+ # ![Tinfoil logo](https://models.dev/logos/tinfoil.svg)Tinfoil
2
+
3
+ Access 7 Tinfoil models through Mastra's model router. Authentication is handled automatically using the `TINFOIL_API_KEY` environment variable.
4
+
5
+ Learn more in the [Tinfoil documentation](https://docs.tinfoil.sh).
6
+
7
+ ```bash
8
+ TINFOIL_API_KEY=your-api-key
9
+ ```
10
+
11
+ ```typescript
12
+ import { Agent } from "@mastra/core/agent";
13
+
14
+ const agent = new Agent({
15
+ id: "my-agent",
16
+ name: "My Agent",
17
+ instructions: "You are a helpful assistant",
18
+ model: "tinfoil/gemma4-31b"
19
+ });
20
+
21
+ // Generate a response
22
+ const response = await agent.generate("Hello!");
23
+
24
+ // Stream a response
25
+ const stream = await agent.stream("Tell me a story");
26
+ for await (const chunk of stream) {
27
+ console.log(chunk);
28
+ }
29
+ ```
30
+
31
+ > **Info:** Mastra uses the OpenAI-compatible `/chat/completions` endpoint. Some provider-specific features may not be available. Check the [Tinfoil documentation](https://docs.tinfoil.sh) for details.
32
+
33
+ ## Models
34
+
35
+ | Model | Context | Tools | Reasoning | Image | Audio | Video | Input $/1M | Output $/1M |
36
+ | -------------------------------- | ------- | ----- | --------- | ----- | ----- | ----- | ---------- | ----------- |
37
+ | `tinfoil/gemma4-31b` | 256K | | | | | | $0.40 | $1 |
38
+ | `tinfoil/glm-5-2` | 384K | | | | | | $2 | $5 |
39
+ | `tinfoil/gpt-oss-120b` | 131K | | | | | | $0.15 | $0.60 |
40
+ | `tinfoil/gpt-oss-safeguard-120b` | 131K | | | | | | $0.15 | $0.60 |
41
+ | `tinfoil/kimi-k2-6` | 256K | | | | | | $2 | $5 |
42
+ | `tinfoil/llama3-3-70b` | 128K | | | | | | $2 | $3 |
43
+ | `tinfoil/nomic-embed-text` | 8K | | | | | | $0.05 | — |
44
+
45
+ ## Advanced configuration
46
+
47
+ ### Custom headers
48
+
49
+ ```typescript
50
+ const agent = new Agent({
51
+ id: "custom-agent",
52
+ name: "custom-agent",
53
+ model: {
54
+ url: "https://inference.tinfoil.sh/v1",
55
+ id: "tinfoil/gemma4-31b",
56
+ apiKey: process.env.TINFOIL_API_KEY,
57
+ headers: {
58
+ "X-Custom-Header": "value"
59
+ }
60
+ }
61
+ });
62
+ ```
63
+
64
+ ### Dynamic model selection
65
+
66
+ ```typescript
67
+ const agent = new Agent({
68
+ id: "dynamic-agent",
69
+ name: "Dynamic Agent",
70
+ model: ({ requestContext }) => {
71
+ const useAdvanced = requestContext.task === "complex";
72
+ return useAdvanced
73
+ ? "tinfoil/nomic-embed-text"
74
+ : "tinfoil/gemma4-31b";
75
+ }
76
+ });
77
+ ```
@@ -111,6 +111,7 @@ Direct access to individual AI model providers. Each provider offers unique mode
111
111
  - [Tencent Coding Plan (China)](https://mastra.ai/models/providers/tencent-coding-plan)
112
112
  - [Tencent TokenHub](https://mastra.ai/models/providers/tencent-tokenhub)
113
113
  - [The Grid AI](https://mastra.ai/models/providers/the-grid-ai)
114
+ - [Tinfoil](https://mastra.ai/models/providers/tinfoil)
114
115
  - [Together AI](https://mastra.ai/models/providers/togetherai)
115
116
  - [Umans AI](https://mastra.ai/models/providers/umans-ai)
116
117
  - [Umans AI Coding Plan](https://mastra.ai/models/providers/umans-ai-coding-plan)