@mastra/mcp 0.10.0 → 0.10.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/.turbo/turbo-build.log +7 -7
- package/CHANGELOG.md +34 -0
- package/dist/_tsup-dts-rollup.d.cts +332 -40
- package/dist/_tsup-dts-rollup.d.ts +332 -40
- package/dist/index.cjs +599 -45
- package/dist/index.d.cts +14 -9
- package/dist/index.d.ts +14 -9
- package/dist/index.js +604 -50
- package/package.json +4 -3
- package/src/__fixtures__/fire-crawl-complex-schema.ts +1 -1
- package/src/__fixtures__/server-weather.ts +1 -1
- package/src/__fixtures__/weather.ts +122 -190
- package/src/{client.test.ts → client/client.test.ts} +27 -0
- package/src/{client.ts → client/client.ts} +58 -5
- package/src/{configuration.test.ts → client/configuration.test.ts} +133 -21
- package/src/{configuration.ts → client/configuration.ts} +64 -48
- package/src/client/resourceActions.ts +121 -0
- package/src/index.ts +4 -4
- package/src/server/resourceActions.ts +62 -0
- package/src/{server-logging.test.ts → server/server-logging.test.ts} +9 -7
- package/src/server/server.test.ts +1126 -0
- package/src/{server.ts → server/server.ts} +444 -16
- package/src/server.test.ts +0 -467
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { spawn } from 'child_process';
|
|
2
2
|
import path from 'path';
|
|
3
3
|
import { describe, it, expect, vi, beforeEach, afterEach, beforeAll, afterAll } from 'vitest';
|
|
4
|
-
import type { LogMessage } from '
|
|
5
|
-
import { MCPClient } from '
|
|
4
|
+
import type { LogMessage } from '../client/client';
|
|
5
|
+
import { MCPClient } from '../client/configuration';
|
|
6
6
|
|
|
7
7
|
// Increase test timeout for server operations
|
|
8
8
|
vi.setConfig({ testTimeout: 80000, hookTimeout: 80000 });
|
|
@@ -10,11 +10,13 @@ vi.setConfig({ testTimeout: 80000, hookTimeout: 80000 });
|
|
|
10
10
|
describe('MCP Server Logging', () => {
|
|
11
11
|
let consoleLogSpy: ReturnType<typeof vi.spyOn>;
|
|
12
12
|
let weatherProcess: ReturnType<typeof spawn>;
|
|
13
|
-
|
|
13
|
+
let weatherServerPort: number;
|
|
14
14
|
beforeAll(async () => {
|
|
15
|
+
weatherServerPort = 60000 + Math.floor(Math.random() * 1000); // Generate a random port
|
|
16
|
+
|
|
15
17
|
// Start the weather SSE server
|
|
16
|
-
weatherProcess = spawn('npx', ['-y', 'tsx', path.join(__dirname, '__fixtures__/weather.ts')], {
|
|
17
|
-
env: { ...process.env,
|
|
18
|
+
weatherProcess = spawn('npx', ['-y', 'tsx', path.join(__dirname, '..', '__fixtures__/weather.ts')], {
|
|
19
|
+
env: { ...process.env, WEATHER_SERVER_PORT: String(weatherServerPort) },
|
|
18
20
|
});
|
|
19
21
|
|
|
20
22
|
// Wait for SSE server to be ready
|
|
@@ -62,12 +64,12 @@ describe('MCP Server Logging', () => {
|
|
|
62
64
|
id: 'server-log-test',
|
|
63
65
|
servers: {
|
|
64
66
|
weather: {
|
|
65
|
-
url: new URL(
|
|
67
|
+
url: new URL(`http://localhost:${weatherServerPort}/sse`),
|
|
66
68
|
logger: weatherLogHandler,
|
|
67
69
|
},
|
|
68
70
|
stock: {
|
|
69
71
|
command: 'npx',
|
|
70
|
-
args: ['-y', 'tsx', path.join(__dirname, '__fixtures__/stock-price.ts')],
|
|
72
|
+
args: ['-y', 'tsx', path.join(__dirname, '..', '__fixtures__/stock-price.ts')],
|
|
71
73
|
env: {
|
|
72
74
|
FAKE_CREDS: 'test',
|
|
73
75
|
},
|