@mastra/mcp 1.15.1 → 1.16.0-alpha.0
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 +59 -0
- package/dist/client/actions/elicitation.d.ts +1 -1
- package/dist/client/actions/elicitation.d.ts.map +1 -1
- package/dist/client/actions/progress.d.ts +1 -1
- package/dist/client/actions/progress.d.ts.map +1 -1
- package/dist/client/actions/prompt.d.ts +1 -1
- package/dist/client/actions/prompt.d.ts.map +1 -1
- package/dist/client/actions/resource.d.ts +38 -11
- package/dist/client/actions/resource.d.ts.map +1 -1
- package/dist/client/client.d.ts +3 -2
- package/dist/client/client.d.ts.map +1 -1
- package/dist/client/configuration.d.ts +50 -14
- package/dist/client/configuration.d.ts.map +1 -1
- package/dist/client/types.d.ts +65 -10
- package/dist/client/types.d.ts.map +1 -1
- package/dist/client/url-policy.d.ts +67 -0
- package/dist/client/url-policy.d.ts.map +1 -0
- package/dist/docs/SKILL.md +3 -3
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/docs/references/docs-connections-overview.md +94 -0
- package/dist/docs/references/docs-mcp-overview.md +229 -278
- package/dist/docs/references/reference-tools-mcp-client.md +54 -0
- package/dist/docs/references/reference-tools-mcp-server.md +1 -1
- package/dist/index.cjs +2435 -275
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +2403 -243
- package/dist/index.js.map +1 -1
- package/dist/server/__tests__/mock-extra.d.ts +15 -0
- package/dist/server/__tests__/mock-extra.d.ts.map +1 -0
- package/dist/server/notificationBroadcast.d.ts +1 -1
- package/dist/server/notificationBroadcast.d.ts.map +1 -1
- package/dist/server/promptActions.d.ts +1 -1
- package/dist/server/promptActions.d.ts.map +1 -1
- package/dist/server/resourceActions.d.ts +1 -1
- package/dist/server/resourceActions.d.ts.map +1 -1
- package/dist/server/server.d.ts +10 -12
- package/dist/server/server.d.ts.map +1 -1
- package/dist/server/toolActions.d.ts +1 -1
- package/dist/server/toolActions.d.ts.map +1 -1
- package/dist/server/types.d.ts +7 -7
- package/dist/server/types.d.ts.map +1 -1
- package/dist/shared/oauth-types.d.ts +8 -6
- package/dist/shared/oauth-types.d.ts.map +1 -1
- package/package.json +18 -14
- package/dist/docs/references/docs-mcp-mcp-apps.md +0 -306
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
> Discover all available pages from the documentation index: https://mastra.ai/llms.txt
|
|
2
|
+
|
|
3
|
+
# Connections overview
|
|
4
|
+
|
|
5
|
+
Connections let Mastra work with remote agents, coding agents, provider software development kit (SDK) runtimes, and external tools and resources. Choose a connection type based on which system owns the agent runtime and what you need to exchange.
|
|
6
|
+
|
|
7
|
+
- [**Agent-to-Agent (A2A)**](https://mastra.ai/docs/agents/a2a): Expose or consume remote agents across service, framework, vendor, and language boundaries.
|
|
8
|
+
- [**Agent Client Protocol (ACP)**](https://mastra.ai/docs/agents/acp): Run compatible coding-agent processes as Mastra tools or subagents.
|
|
9
|
+
- [**SDK agents**](https://mastra.ai/docs/agents/sdk-agents): Register Claude, Cursor, or OpenAI SDK-backed agents while the provider SDK retains control of the runtime, tools, permissions, and agent loop.
|
|
10
|
+
- [**Model Context Protocol (MCP)**](https://mastra.ai/docs/mcp/overview): Connect agents to external tools and resources, or expose Mastra agents, tools, workflows, prompts, and resources to MCP-compatible systems.
|
|
11
|
+
|
|
12
|
+
## When to use connections
|
|
13
|
+
|
|
14
|
+
Use connections when you need to:
|
|
15
|
+
|
|
16
|
+
- Delegate work to an agent running in another service or runtime.
|
|
17
|
+
- Run a coding agent against a project workspace.
|
|
18
|
+
- Add a provider-native agent without replacing its SDK runtime or agent loop.
|
|
19
|
+
- Connect agents to external tools and resources or publish Mastra capabilities to other systems.
|
|
20
|
+
|
|
21
|
+
## Get started
|
|
22
|
+
|
|
23
|
+
Start with the boundary you need to cross. Use [A2A](https://mastra.ai/docs/agents/a2a) for remote agent endpoints, [ACP](https://mastra.ai/docs/agents/acp) for coding-agent processes, [SDK agents](https://mastra.ai/docs/agents/sdk-agents) for provider-owned runtimes, or [MCP](https://mastra.ai/docs/mcp/overview) for tools and resources.
|
|
24
|
+
|
|
25
|
+
**A2A**:
|
|
26
|
+
|
|
27
|
+
```typescript
|
|
28
|
+
import { A2AAgent } from '@mastra/core/a2a'
|
|
29
|
+
|
|
30
|
+
const agent = new A2AAgent({
|
|
31
|
+
url: 'https://agent.example.com/.well-known/agent-card.json',
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
const result = await agent.generate('Summarize the latest report')
|
|
35
|
+
console.log(result.text)
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
**ACP**:
|
|
39
|
+
|
|
40
|
+
```typescript
|
|
41
|
+
import { AcpAgent } from '@mastra/acp'
|
|
42
|
+
|
|
43
|
+
const agent = new AcpAgent({
|
|
44
|
+
id: 'coding-agent',
|
|
45
|
+
description: 'Inspects and edits code',
|
|
46
|
+
command: 'claude',
|
|
47
|
+
args: ['--acp'],
|
|
48
|
+
persistSession: false,
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
const result = await agent.generate('Review this project')
|
|
52
|
+
console.log(result.text)
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
**SDK agents**:
|
|
56
|
+
|
|
57
|
+
```typescript
|
|
58
|
+
import { OpenAISDKAgent } from '@mastra/openai'
|
|
59
|
+
|
|
60
|
+
const agent = new OpenAISDKAgent({
|
|
61
|
+
id: 'openai-agent',
|
|
62
|
+
description: 'Answers project questions',
|
|
63
|
+
sdkOptions: {
|
|
64
|
+
name: 'Project assistant',
|
|
65
|
+
model: 'gpt-5',
|
|
66
|
+
},
|
|
67
|
+
})
|
|
68
|
+
|
|
69
|
+
const result = await agent.generate('Explain agent loops in one sentence')
|
|
70
|
+
console.log(result.text)
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
**MCP**:
|
|
74
|
+
|
|
75
|
+
```typescript
|
|
76
|
+
import { MCPClient } from '@mastra/mcp'
|
|
77
|
+
|
|
78
|
+
const client = new MCPClient({
|
|
79
|
+
id: 'wikipedia-client',
|
|
80
|
+
servers: {
|
|
81
|
+
wikipedia: {
|
|
82
|
+
command: 'npx',
|
|
83
|
+
args: ['-y', 'wikipedia-mcp'],
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
})
|
|
87
|
+
|
|
88
|
+
try {
|
|
89
|
+
const tools = await client.listTools()
|
|
90
|
+
console.log(Object.keys(tools))
|
|
91
|
+
} finally {
|
|
92
|
+
await client.disconnect()
|
|
93
|
+
}
|
|
94
|
+
```
|