@mastra/mcp-docs-server 0.0.13 → 0.0.14-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.
- package/.docs/organized/changelogs/%40mastra%2Fastra.md +34 -34
- package/.docs/organized/changelogs/%40mastra%2Fchroma.md +35 -35
- package/.docs/organized/changelogs/%40mastra%2Fclickhouse.md +34 -34
- package/.docs/organized/changelogs/%40mastra%2Fclient-js.md +39 -39
- package/.docs/organized/changelogs/%40mastra%2Fcloud.md +33 -0
- package/.docs/organized/changelogs/%40mastra%2Fcloudflare-d1.md +33 -0
- package/.docs/organized/changelogs/%40mastra%2Fcloudflare.md +34 -34
- package/.docs/organized/changelogs/%40mastra%2Fcore.md +32 -32
- package/.docs/organized/changelogs/%40mastra%2Fcouchbase.md +34 -0
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloudflare.md +38 -38
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-netlify.md +38 -38
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-vercel.md +39 -39
- package/.docs/organized/changelogs/%40mastra%2Fdeployer.md +43 -43
- package/.docs/organized/changelogs/%40mastra%2Fevals.md +34 -34
- package/.docs/organized/changelogs/%40mastra%2Ffastembed.md +7 -0
- package/.docs/organized/changelogs/%40mastra%2Ffirecrawl.md +37 -37
- package/.docs/organized/changelogs/%40mastra%2Fgithub.md +34 -34
- package/.docs/organized/changelogs/%40mastra%2Flibsql.md +33 -0
- package/.docs/organized/changelogs/%40mastra%2Floggers.md +34 -34
- package/.docs/organized/changelogs/%40mastra%2Fmcp-docs-server.md +39 -39
- package/.docs/organized/changelogs/%40mastra%2Fmcp-registry-registry.md +34 -34
- package/.docs/organized/changelogs/%40mastra%2Fmcp.md +49 -49
- package/.docs/organized/changelogs/%40mastra%2Fmem0.md +34 -34
- package/.docs/organized/changelogs/%40mastra%2Fmemory.md +34 -34
- package/.docs/organized/changelogs/%40mastra%2Fmongodb.md +33 -0
- package/.docs/organized/changelogs/%40mastra%2Fopensearch.md +35 -1
- package/.docs/organized/changelogs/%40mastra%2Fpg.md +34 -34
- package/.docs/organized/changelogs/%40mastra%2Fpinecone.md +35 -35
- package/.docs/organized/changelogs/%40mastra%2Fplayground-ui.md +45 -45
- package/.docs/organized/changelogs/%40mastra%2Fqdrant.md +35 -35
- package/.docs/organized/changelogs/%40mastra%2Frag.md +34 -34
- package/.docs/organized/changelogs/%40mastra%2Fragie.md +34 -34
- package/.docs/organized/changelogs/%40mastra%2Fserver.md +39 -39
- package/.docs/organized/changelogs/%40mastra%2Fspeech-azure.md +34 -34
- package/.docs/organized/changelogs/%40mastra%2Fspeech-deepgram.md +34 -34
- package/.docs/organized/changelogs/%40mastra%2Fspeech-elevenlabs.md +34 -34
- package/.docs/organized/changelogs/%40mastra%2Fspeech-google.md +34 -34
- package/.docs/organized/changelogs/%40mastra%2Fspeech-ibm.md +34 -34
- package/.docs/organized/changelogs/%40mastra%2Fspeech-murf.md +34 -34
- package/.docs/organized/changelogs/%40mastra%2Fspeech-openai.md +34 -34
- package/.docs/organized/changelogs/%40mastra%2Fspeech-playai.md +34 -34
- package/.docs/organized/changelogs/%40mastra%2Fspeech-replicate.md +34 -34
- package/.docs/organized/changelogs/%40mastra%2Fspeech-speechify.md +34 -34
- package/.docs/organized/changelogs/%40mastra%2Fturbopuffer.md +34 -34
- package/.docs/organized/changelogs/%40mastra%2Fupstash.md +34 -34
- package/.docs/organized/changelogs/%40mastra%2Fvectorize.md +35 -35
- package/.docs/organized/changelogs/%40mastra%2Fvoice-azure.md +34 -34
- package/.docs/organized/changelogs/%40mastra%2Fvoice-cloudflare.md +34 -34
- package/.docs/organized/changelogs/%40mastra%2Fvoice-deepgram.md +34 -34
- package/.docs/organized/changelogs/%40mastra%2Fvoice-elevenlabs.md +34 -34
- package/.docs/organized/changelogs/%40mastra%2Fvoice-google.md +34 -34
- package/.docs/organized/changelogs/%40mastra%2Fvoice-murf.md +34 -34
- package/.docs/organized/changelogs/%40mastra%2Fvoice-openai-realtime.md +34 -34
- package/.docs/organized/changelogs/%40mastra%2Fvoice-openai.md +34 -34
- package/.docs/organized/changelogs/%40mastra%2Fvoice-playai.md +34 -34
- package/.docs/organized/changelogs/%40mastra%2Fvoice-sarvam.md +34 -34
- package/.docs/organized/changelogs/%40mastra%2Fvoice-speechify.md +34 -34
- package/.docs/organized/changelogs/create-mastra.md +12 -12
- package/.docs/organized/changelogs/mastra.md +46 -46
- package/.docs/organized/code-examples/a2a.md +202 -0
- package/.docs/organized/code-examples/agent-network.md +1 -1
- package/.docs/organized/code-examples/agent.md +113 -26
- package/.docs/organized/code-examples/ai-sdk-useChat.md +2 -2
- package/.docs/organized/code-examples/client-side-tools.md +1 -1
- package/.docs/organized/code-examples/crypto-chatbot.md +1 -1
- package/.docs/organized/code-examples/fireworks-r1.md +2 -2
- package/.docs/organized/code-examples/mcp-configuration.md +579 -0
- package/.docs/organized/code-examples/mcp-registry-registry.md +1 -1
- package/.docs/organized/code-examples/memory-with-context.md +1 -1
- package/.docs/organized/code-examples/memory-with-processors.md +609 -0
- package/.docs/organized/code-examples/openapi-spec-writer.md +588 -0
- package/.docs/organized/code-examples/quick-start.md +1 -1
- package/.docs/raw/agents/dynamic-agents.mdx +47 -0
- package/.docs/raw/agents/using-tools-and-mcp.mdx +19 -0
- package/.docs/raw/memory/working-memory.mdx +78 -1
- package/.docs/raw/reference/cli/mcp-docs-server.mdx +82 -0
- package/.docs/raw/reference/deployer/cloudflare.mdx +7 -0
- package/.docs/raw/reference/deployer/netlify.mdx +5 -0
- package/.docs/raw/reference/deployer/vercel.mdx +6 -0
- package/dist/{chunk-OKBMABZO.js → chunk-JWLYN5OI.js} +3 -2
- package/dist/prepare-docs/prepare.js +1 -1
- package/dist/stdio.js +1 -1
- package/package.json +3 -3
|
@@ -9,57 +9,53 @@
|
|
|
9
9
|
"version": "0.0.1",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@ai-sdk/openai": "latest",
|
|
12
|
+
"@mastra/client-js": "latest",
|
|
12
13
|
"@mastra/core": "latest",
|
|
13
|
-
"@mastra/
|
|
14
|
+
"@mastra/mcp": "latest",
|
|
14
15
|
"@mastra/memory": "latest",
|
|
15
|
-
"@mastra/
|
|
16
|
-
"
|
|
16
|
+
"@mastra/voice-openai": "latest",
|
|
17
|
+
"fetch-to-node": "^2.1.0",
|
|
18
|
+
"mastra": "latest",
|
|
19
|
+
"zod": "^3.24.2"
|
|
17
20
|
},
|
|
18
21
|
"pnpm": {
|
|
19
22
|
"overrides": {
|
|
20
23
|
"@mastra/core": "link:../../packages/core",
|
|
21
24
|
"@mastra/voice-openai": "link:../../voice/openai",
|
|
22
25
|
"@mastra/memory": "link:../../packages/memory",
|
|
23
|
-
"@mastra/client-js": "link:../../client-sdks/client-js"
|
|
26
|
+
"@mastra/client-js": "link:../../client-sdks/client-js",
|
|
27
|
+
"@mastra/mcp": "link:../../packages/mcp",
|
|
28
|
+
"mastra": "link:../../packages/cli"
|
|
24
29
|
}
|
|
25
30
|
},
|
|
26
31
|
"scripts": {
|
|
27
32
|
"start-deployed": "npx bun src/with-deployed.ts",
|
|
28
|
-
"start": "npx bun src/index.ts"
|
|
33
|
+
"start": "npx bun src/index.ts",
|
|
34
|
+
"mastra:dev": "mastra dev"
|
|
29
35
|
},
|
|
30
36
|
"keywords": [],
|
|
31
37
|
"author": "",
|
|
32
38
|
"license": "MIT",
|
|
33
|
-
"packageManager": "pnpm@10.
|
|
39
|
+
"packageManager": "pnpm@10.9.0+sha512.0486e394640d3c1fb3c9d43d49cf92879ff74f8516959c235308f5a8f62e2e19528a65cdc2a3058f587cde71eba3d5b56327c8c33a97e4c4051ca48a10ca2d5f"
|
|
34
40
|
}
|
|
35
41
|
|
|
36
42
|
```
|
|
37
43
|
|
|
38
44
|
### client.ts
|
|
39
45
|
```typescript
|
|
40
|
-
import {
|
|
46
|
+
import { MCPClient } from '@mastra/mcp';
|
|
41
47
|
|
|
42
48
|
async function main() {
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
const response = await agent.generate({
|
|
50
|
-
messages: 'What is the best pasta dish?',
|
|
51
|
-
threadId: '12334',
|
|
52
|
-
resourceId: '12334',
|
|
49
|
+
const mcpClient = new MCPClient({
|
|
50
|
+
servers: {
|
|
51
|
+
myMcpServer: {
|
|
52
|
+
url: new URL('http://localhost:4111/api/servers/myMcpServer/mcp'),
|
|
53
|
+
},
|
|
54
|
+
},
|
|
53
55
|
});
|
|
54
56
|
|
|
55
|
-
const
|
|
56
|
-
|
|
57
|
-
console.log(memoryThread);
|
|
58
|
-
console.log(response.text);
|
|
59
|
-
|
|
60
|
-
const audioResponse = await agent.voice.speak(response.text);
|
|
61
|
-
|
|
62
|
-
console.log(audioResponse);
|
|
57
|
+
const tools = await mcpClient.getTools();
|
|
58
|
+
console.log('Tools:', tools);
|
|
63
59
|
}
|
|
64
60
|
|
|
65
61
|
main();
|
|
@@ -425,10 +421,15 @@ import { Mastra } from '@mastra/core';
|
|
|
425
421
|
import { createLogger } from '@mastra/core/logger';
|
|
426
422
|
|
|
427
423
|
import { chefAgent, chefAgentResponses, dynamicAgent } from './agents/index';
|
|
424
|
+
import { myMcpServer, myMcpServerTwo } from './mcp/server';
|
|
428
425
|
|
|
429
426
|
export const mastra = new Mastra({
|
|
430
427
|
agents: { chefAgent, chefAgentResponses, dynamicAgent },
|
|
431
|
-
logger: createLogger({ name: 'Chef', level: '
|
|
428
|
+
logger: createLogger({ name: 'Chef', level: 'debug' }),
|
|
429
|
+
mcpServers: {
|
|
430
|
+
myMcpServer,
|
|
431
|
+
myMcpServerTwo,
|
|
432
|
+
},
|
|
432
433
|
serverMiddleware: [
|
|
433
434
|
{
|
|
434
435
|
handler: (c, next) => {
|
|
@@ -441,6 +442,92 @@ export const mastra = new Mastra({
|
|
|
441
442
|
|
|
442
443
|
```
|
|
443
444
|
|
|
445
|
+
### mastra/mcp/server.ts
|
|
446
|
+
```typescript
|
|
447
|
+
import { createTool } from '@mastra/core/tools';
|
|
448
|
+
import { MCPServer } from '@mastra/mcp';
|
|
449
|
+
import { z } from 'zod';
|
|
450
|
+
|
|
451
|
+
export const myMcpServer = new MCPServer({
|
|
452
|
+
name: 'My Calculation & Data MCP Server',
|
|
453
|
+
version: '1.0.0',
|
|
454
|
+
tools: {
|
|
455
|
+
calculator: createTool({
|
|
456
|
+
id: 'calculator',
|
|
457
|
+
description: 'Performs basic arithmetic operations (add, subtract).',
|
|
458
|
+
inputSchema: z.object({
|
|
459
|
+
num1: z.number().describe('The first number.'),
|
|
460
|
+
num2: z.number().describe('The second number.'),
|
|
461
|
+
operation: z.enum(['add', 'subtract']).describe('The operation to perform.'),
|
|
462
|
+
}),
|
|
463
|
+
execute: async ({ context }) => {
|
|
464
|
+
const { num1, num2, operation } = context;
|
|
465
|
+
if (operation === 'add') {
|
|
466
|
+
return num1 + num2;
|
|
467
|
+
}
|
|
468
|
+
if (operation === 'subtract') {
|
|
469
|
+
return num1 - num2;
|
|
470
|
+
}
|
|
471
|
+
throw new Error('Invalid operation');
|
|
472
|
+
},
|
|
473
|
+
}),
|
|
474
|
+
fetchWeather: createTool({
|
|
475
|
+
id: 'fetchWeather',
|
|
476
|
+
description: 'Fetches a (simulated) weather forecast for a given city.',
|
|
477
|
+
inputSchema: z.object({
|
|
478
|
+
city: z.string().describe('The city to get weather for, e.g., London, Paris.'),
|
|
479
|
+
}),
|
|
480
|
+
execute: async ({ context }) => {
|
|
481
|
+
const { city } = context;
|
|
482
|
+
const temperatures = {
|
|
483
|
+
london: '15°C',
|
|
484
|
+
paris: '18°C',
|
|
485
|
+
tokyo: '22°C',
|
|
486
|
+
};
|
|
487
|
+
const temp = temperatures[city.toLowerCase() as keyof typeof temperatures] || '20°C';
|
|
488
|
+
return `The weather in ${city} is ${temp} and sunny.`;
|
|
489
|
+
},
|
|
490
|
+
}),
|
|
491
|
+
},
|
|
492
|
+
});
|
|
493
|
+
|
|
494
|
+
export const myMcpServerTwo = new MCPServer({
|
|
495
|
+
name: 'My Utility MCP Server',
|
|
496
|
+
version: '1.0.0',
|
|
497
|
+
tools: {
|
|
498
|
+
stringUtils: createTool({
|
|
499
|
+
id: 'stringUtils',
|
|
500
|
+
description: 'Performs utility operations on strings (uppercase, reverse).',
|
|
501
|
+
inputSchema: z.object({
|
|
502
|
+
text: z.string().describe('The input string.'),
|
|
503
|
+
action: z.enum(['uppercase', 'reverse']).describe('The string action to perform.'),
|
|
504
|
+
}),
|
|
505
|
+
execute: async ({ context }) => {
|
|
506
|
+
const { text, action } = context;
|
|
507
|
+
if (action === 'uppercase') {
|
|
508
|
+
return text.toUpperCase();
|
|
509
|
+
}
|
|
510
|
+
if (action === 'reverse') {
|
|
511
|
+
return text.split('').reverse().join('');
|
|
512
|
+
}
|
|
513
|
+
throw new Error('Invalid string action');
|
|
514
|
+
},
|
|
515
|
+
}),
|
|
516
|
+
greetUser: createTool({
|
|
517
|
+
id: 'greetUser',
|
|
518
|
+
description: 'Generates a personalized greeting.',
|
|
519
|
+
inputSchema: z.object({
|
|
520
|
+
name: z.string().describe('The name of the person to greet.'),
|
|
521
|
+
}),
|
|
522
|
+
execute: async ({ context }) => {
|
|
523
|
+
return `Hello, ${context.name}! Welcome to the MCP server.`;
|
|
524
|
+
},
|
|
525
|
+
}),
|
|
526
|
+
},
|
|
527
|
+
});
|
|
528
|
+
|
|
529
|
+
```
|
|
530
|
+
|
|
444
531
|
### mastra/tools/index.ts
|
|
445
532
|
```typescript
|
|
446
533
|
import { createTool } from '@mastra/core/tools';
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
"author": "",
|
|
14
14
|
"license": "MIT",
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@ai-sdk/anthropic": "^1.
|
|
17
|
-
"@ai-sdk/fireworks": "^0.
|
|
16
|
+
"@ai-sdk/anthropic": "^1.2.11",
|
|
17
|
+
"@ai-sdk/fireworks": "^0.2.14",
|
|
18
18
|
"@mastra/core": "latest",
|
|
19
19
|
"@mastra/mcp": "latest",
|
|
20
20
|
"@mastra/memory": "latest",
|