@mastra/mcp 0.10.2-alpha.0 → 0.10.2
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 +33 -0
- package/dist/_tsup-dts-rollup.d.cts +4 -13
- package/dist/_tsup-dts-rollup.d.ts +4 -13
- package/dist/index.cjs +7 -1
- package/dist/index.js +7 -1
- package/integration-tests/node_modules/.bin/mastra +21 -0
- package/integration-tests/package.json +1 -1
- package/package.json +4 -4
- package/src/server/server.ts +8 -1
- package/src/logger.ts +0 -104
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
|
|
2
|
-
> @mastra/mcp@0.10.2-alpha.
|
|
2
|
+
> @mastra/mcp@0.10.2-alpha.1 build /home/runner/work/mastra/mastra/packages/mcp
|
|
3
3
|
> tsup src/index.ts --format esm,cjs --experimental-dts --clean --treeshake=smallest --splitting
|
|
4
4
|
|
|
5
5
|
[34mCLI[39m Building entry: src/index.ts
|
|
6
6
|
[34mCLI[39m Using tsconfig: tsconfig.json
|
|
7
7
|
[34mCLI[39m tsup v8.4.0
|
|
8
8
|
[34mTSC[39m Build start
|
|
9
|
-
[32mTSC[39m ⚡️ Build success in
|
|
9
|
+
[32mTSC[39m ⚡️ Build success in 18165ms
|
|
10
10
|
[34mDTS[39m Build start
|
|
11
11
|
[34mCLI[39m Target: es2022
|
|
12
12
|
Analysis will use the bundled TypeScript version 5.8.3
|
|
13
13
|
[36mWriting package typings: /home/runner/work/mastra/mastra/packages/mcp/dist/_tsup-dts-rollup.d.ts[39m
|
|
14
14
|
Analysis will use the bundled TypeScript version 5.8.3
|
|
15
15
|
[36mWriting package typings: /home/runner/work/mastra/mastra/packages/mcp/dist/_tsup-dts-rollup.d.cts[39m
|
|
16
|
-
[32mDTS[39m ⚡️ Build success in
|
|
16
|
+
[32mDTS[39m ⚡️ Build success in 17929ms
|
|
17
17
|
[34mCLI[39m Cleaning output folder
|
|
18
18
|
[34mESM[39m Build start
|
|
19
19
|
[34mCJS[39m Build start
|
|
20
|
-
[
|
|
21
|
-
[
|
|
22
|
-
[
|
|
23
|
-
[
|
|
20
|
+
[32mESM[39m [1mdist/index.js [22m[32m58.42 KB[39m
|
|
21
|
+
[32mESM[39m ⚡️ Build success in 582ms
|
|
22
|
+
[32mCJS[39m [1mdist/index.cjs [22m[32m58.63 KB[39m
|
|
23
|
+
[32mCJS[39m ⚡️ Build success in 807ms
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,38 @@
|
|
|
1
1
|
# @mastra/mcp
|
|
2
2
|
|
|
3
|
+
## 0.10.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 592a2db: Added different icons for agents and workflows in mcp tools list
|
|
8
|
+
- f0d559f: Fix peerdeps for alpha channel
|
|
9
|
+
- Updated dependencies [ee77e78]
|
|
10
|
+
- Updated dependencies [592a2db]
|
|
11
|
+
- Updated dependencies [e5dc18d]
|
|
12
|
+
- Updated dependencies [ab5adbe]
|
|
13
|
+
- Updated dependencies [1e8bb40]
|
|
14
|
+
- Updated dependencies [1b5fc55]
|
|
15
|
+
- Updated dependencies [195c428]
|
|
16
|
+
- Updated dependencies [f73e11b]
|
|
17
|
+
- Updated dependencies [37643b8]
|
|
18
|
+
- Updated dependencies [99fd6cf]
|
|
19
|
+
- Updated dependencies [c5bf1ce]
|
|
20
|
+
- Updated dependencies [add596e]
|
|
21
|
+
- Updated dependencies [8dc94d8]
|
|
22
|
+
- Updated dependencies [ecebbeb]
|
|
23
|
+
- Updated dependencies [79d5145]
|
|
24
|
+
- Updated dependencies [12b7002]
|
|
25
|
+
- Updated dependencies [2901125]
|
|
26
|
+
- @mastra/core@0.10.2
|
|
27
|
+
|
|
28
|
+
## 0.10.2-alpha.1
|
|
29
|
+
|
|
30
|
+
### Patch Changes
|
|
31
|
+
|
|
32
|
+
- f0d559f: Fix peerdeps for alpha channel
|
|
33
|
+
- Updated dependencies [1e8bb40]
|
|
34
|
+
- @mastra/core@0.10.2-alpha.2
|
|
35
|
+
|
|
3
36
|
## 0.10.2-alpha.0
|
|
4
37
|
|
|
5
38
|
### Patch Changes
|
|
@@ -49,8 +49,6 @@ declare type BaseServerOptions = {
|
|
|
49
49
|
enableServerLogs?: boolean;
|
|
50
50
|
};
|
|
51
51
|
|
|
52
|
-
export declare function createLogger(server?: Server): Logger;
|
|
53
|
-
|
|
54
52
|
declare type HttpServerDefinition = BaseServerOptions & {
|
|
55
53
|
url: URL;
|
|
56
54
|
command?: never;
|
|
@@ -186,15 +184,6 @@ export declare type InternalMastraMCPClientOptions = {
|
|
|
186
184
|
timeout?: number;
|
|
187
185
|
};
|
|
188
186
|
|
|
189
|
-
export declare interface Logger {
|
|
190
|
-
info: (message: string, data?: any) => Promise<void>;
|
|
191
|
-
warning: (message: string, data?: any) => Promise<void>;
|
|
192
|
-
error: (message: string, error?: any) => Promise<void>;
|
|
193
|
-
debug: (message: string, data?: any) => Promise<void>;
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
export declare const logger: Logger;
|
|
197
|
-
|
|
198
187
|
export { LoggingLevel }
|
|
199
188
|
export { LoggingLevel as LoggingLevel_alias_1 }
|
|
200
189
|
|
|
@@ -367,6 +356,10 @@ declare class MCPServer extends MCPServerBase {
|
|
|
367
356
|
* Get the current streamable HTTP transport.
|
|
368
357
|
*/
|
|
369
358
|
getStreamableHTTPTransport(): StreamableHTTPServerTransport | undefined;
|
|
359
|
+
/**
|
|
360
|
+
* Get the current server instance.
|
|
361
|
+
*/
|
|
362
|
+
getServer(): Server;
|
|
370
363
|
/**
|
|
371
364
|
* Construct a new MCPServer instance.
|
|
372
365
|
* @param opts - Configuration options for the server, including registry metadata.
|
|
@@ -774,6 +767,4 @@ location: string;
|
|
|
774
767
|
}>>) => Promise<any>;
|
|
775
768
|
};
|
|
776
769
|
|
|
777
|
-
export declare const writeErrorLog: (message: string, data?: any) => void;
|
|
778
|
-
|
|
779
770
|
export { }
|
|
@@ -49,8 +49,6 @@ declare type BaseServerOptions = {
|
|
|
49
49
|
enableServerLogs?: boolean;
|
|
50
50
|
};
|
|
51
51
|
|
|
52
|
-
export declare function createLogger(server?: Server): Logger;
|
|
53
|
-
|
|
54
52
|
declare type HttpServerDefinition = BaseServerOptions & {
|
|
55
53
|
url: URL;
|
|
56
54
|
command?: never;
|
|
@@ -186,15 +184,6 @@ export declare type InternalMastraMCPClientOptions = {
|
|
|
186
184
|
timeout?: number;
|
|
187
185
|
};
|
|
188
186
|
|
|
189
|
-
export declare interface Logger {
|
|
190
|
-
info: (message: string, data?: any) => Promise<void>;
|
|
191
|
-
warning: (message: string, data?: any) => Promise<void>;
|
|
192
|
-
error: (message: string, error?: any) => Promise<void>;
|
|
193
|
-
debug: (message: string, data?: any) => Promise<void>;
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
export declare const logger: Logger;
|
|
197
|
-
|
|
198
187
|
export { LoggingLevel }
|
|
199
188
|
export { LoggingLevel as LoggingLevel_alias_1 }
|
|
200
189
|
|
|
@@ -367,6 +356,10 @@ declare class MCPServer extends MCPServerBase {
|
|
|
367
356
|
* Get the current streamable HTTP transport.
|
|
368
357
|
*/
|
|
369
358
|
getStreamableHTTPTransport(): StreamableHTTPServerTransport | undefined;
|
|
359
|
+
/**
|
|
360
|
+
* Get the current server instance.
|
|
361
|
+
*/
|
|
362
|
+
getServer(): Server;
|
|
370
363
|
/**
|
|
371
364
|
* Construct a new MCPServer instance.
|
|
372
365
|
* @param opts - Configuration options for the server, including registry metadata.
|
|
@@ -774,6 +767,4 @@ location: string;
|
|
|
774
767
|
}>>) => Promise<any>;
|
|
775
768
|
};
|
|
776
769
|
|
|
777
|
-
export declare const writeErrorLog: (message: string, data?: any) => void;
|
|
778
|
-
|
|
779
770
|
export { }
|
package/dist/index.cjs
CHANGED
|
@@ -858,6 +858,12 @@ var MCPServer = class extends mcp.MCPServerBase {
|
|
|
858
858
|
getStreamableHTTPTransport() {
|
|
859
859
|
return this.streamableHTTPTransport;
|
|
860
860
|
}
|
|
861
|
+
/**
|
|
862
|
+
* Get the current server instance.
|
|
863
|
+
*/
|
|
864
|
+
getServer() {
|
|
865
|
+
return this.server;
|
|
866
|
+
}
|
|
861
867
|
/**
|
|
862
868
|
* Construct a new MCPServer instance.
|
|
863
869
|
* @param opts - Configuration options for the server, including registry metadata.
|
|
@@ -1141,7 +1147,7 @@ var MCPServer = class extends mcp.MCPServerBase {
|
|
|
1141
1147
|
content: [
|
|
1142
1148
|
{
|
|
1143
1149
|
type: "text",
|
|
1144
|
-
text: JSON.stringify(result)
|
|
1150
|
+
text: typeof result === "string" ? result : JSON.stringify(result)
|
|
1145
1151
|
}
|
|
1146
1152
|
],
|
|
1147
1153
|
isError: false
|
package/dist/index.js
CHANGED
|
@@ -852,6 +852,12 @@ var MCPServer = class extends MCPServerBase {
|
|
|
852
852
|
getStreamableHTTPTransport() {
|
|
853
853
|
return this.streamableHTTPTransport;
|
|
854
854
|
}
|
|
855
|
+
/**
|
|
856
|
+
* Get the current server instance.
|
|
857
|
+
*/
|
|
858
|
+
getServer() {
|
|
859
|
+
return this.server;
|
|
860
|
+
}
|
|
855
861
|
/**
|
|
856
862
|
* Construct a new MCPServer instance.
|
|
857
863
|
* @param opts - Configuration options for the server, including registry metadata.
|
|
@@ -1135,7 +1141,7 @@ var MCPServer = class extends MCPServerBase {
|
|
|
1135
1141
|
content: [
|
|
1136
1142
|
{
|
|
1137
1143
|
type: "text",
|
|
1138
|
-
text: JSON.stringify(result)
|
|
1144
|
+
text: typeof result === "string" ? result : JSON.stringify(result)
|
|
1139
1145
|
}
|
|
1140
1146
|
],
|
|
1141
1147
|
isError: false
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
|
3
|
+
|
|
4
|
+
case `uname` in
|
|
5
|
+
*CYGWIN*|*MINGW*|*MSYS*)
|
|
6
|
+
if command -v cygpath > /dev/null 2>&1; then
|
|
7
|
+
basedir=`cygpath -w "$basedir"`
|
|
8
|
+
fi
|
|
9
|
+
;;
|
|
10
|
+
esac
|
|
11
|
+
|
|
12
|
+
if [ -z "$NODE_PATH" ]; then
|
|
13
|
+
export NODE_PATH="/home/runner/work/mastra/mastra/packages/cli/dist/node_modules:/home/runner/work/mastra/mastra/packages/cli/node_modules:/home/runner/work/mastra/mastra/packages/node_modules:/home/runner/work/mastra/mastra/node_modules:/home/runner/work/mastra/node_modules:/home/runner/work/node_modules:/home/runner/node_modules:/home/node_modules:/node_modules:/home/runner/work/mastra/mastra/node_modules/.pnpm/node_modules"
|
|
14
|
+
else
|
|
15
|
+
export NODE_PATH="/home/runner/work/mastra/mastra/packages/cli/dist/node_modules:/home/runner/work/mastra/mastra/packages/cli/node_modules:/home/runner/work/mastra/mastra/packages/node_modules:/home/runner/work/mastra/mastra/node_modules:/home/runner/work/mastra/node_modules:/home/runner/work/node_modules:/home/runner/node_modules:/home/node_modules:/node_modules:/home/runner/work/mastra/mastra/node_modules/.pnpm/node_modules:$NODE_PATH"
|
|
16
|
+
fi
|
|
17
|
+
if [ -x "$basedir/node" ]; then
|
|
18
|
+
exec "$basedir/node" "$basedir/../mastra/dist/index.js" "$@"
|
|
19
|
+
else
|
|
20
|
+
exec node "$basedir/../mastra/dist/index.js" "$@"
|
|
21
|
+
fi
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/mcp",
|
|
3
|
-
"version": "0.10.2
|
|
3
|
+
"version": "0.10.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
34
|
"zod": "^3.0.0",
|
|
35
|
-
"@mastra/core": "^0.10.0"
|
|
35
|
+
"@mastra/core": "^0.10.2-alpha.0"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@ai-sdk/anthropic": "^1.1.15",
|
|
@@ -50,8 +50,8 @@
|
|
|
50
50
|
"vitest": "^3.1.2",
|
|
51
51
|
"zod": "^3.24.3",
|
|
52
52
|
"zod-to-json-schema": "^3.24.5",
|
|
53
|
-
"@internal/lint": "0.0.
|
|
54
|
-
"@mastra/core": "0.10.2
|
|
53
|
+
"@internal/lint": "0.0.8",
|
|
54
|
+
"@mastra/core": "0.10.2"
|
|
55
55
|
},
|
|
56
56
|
"scripts": {
|
|
57
57
|
"build": "tsup src/index.ts --format esm,cjs --experimental-dts --clean --treeshake=smallest --splitting",
|
package/src/server/server.ts
CHANGED
|
@@ -103,6 +103,13 @@ export class MCPServer extends MCPServerBase {
|
|
|
103
103
|
return this.streamableHTTPTransport;
|
|
104
104
|
}
|
|
105
105
|
|
|
106
|
+
/**
|
|
107
|
+
* Get the current server instance.
|
|
108
|
+
*/
|
|
109
|
+
public getServer(): Server {
|
|
110
|
+
return this.server;
|
|
111
|
+
}
|
|
112
|
+
|
|
106
113
|
/**
|
|
107
114
|
* Construct a new MCPServer instance.
|
|
108
115
|
* @param opts - Configuration options for the server, including registry metadata.
|
|
@@ -434,7 +441,7 @@ export class MCPServer extends MCPServerBase {
|
|
|
434
441
|
content: [
|
|
435
442
|
{
|
|
436
443
|
type: 'text',
|
|
437
|
-
text: JSON.stringify(result),
|
|
444
|
+
text: typeof result === 'string' ? result : JSON.stringify(result),
|
|
438
445
|
},
|
|
439
446
|
],
|
|
440
447
|
isError: false,
|
package/src/logger.ts
DELETED
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import * as fs from 'fs';
|
|
2
|
-
import * as os from 'os';
|
|
3
|
-
import * as path from 'path';
|
|
4
|
-
import type { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
5
|
-
|
|
6
|
-
// Logger interface for type safety
|
|
7
|
-
export interface Logger {
|
|
8
|
-
info: (message: string, data?: any) => Promise<void>;
|
|
9
|
-
warning: (message: string, data?: any) => Promise<void>;
|
|
10
|
-
error: (message: string, error?: any) => Promise<void>;
|
|
11
|
-
debug: (message: string, data?: any) => Promise<void>;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export const writeErrorLog = (message: string, data?: any) => {
|
|
15
|
-
const now = new Date();
|
|
16
|
-
const timestamp = now.toISOString();
|
|
17
|
-
const hourTimestamp = timestamp.slice(0, 13); // YYYY-MM-DDTHH
|
|
18
|
-
|
|
19
|
-
// Create log message
|
|
20
|
-
const logMessage = {
|
|
21
|
-
timestamp,
|
|
22
|
-
message,
|
|
23
|
-
...(data ? (typeof data === 'object' ? data : { data }) : {}),
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
// Write to file
|
|
27
|
-
try {
|
|
28
|
-
// Ensure cache directory exists
|
|
29
|
-
const cacheDir = path.join(os.homedir(), '.cache', 'mastra', 'mcp-docs-server-logs');
|
|
30
|
-
fs.mkdirSync(cacheDir, { recursive: true });
|
|
31
|
-
|
|
32
|
-
// Create log file path with timestamp
|
|
33
|
-
const logFile = path.join(cacheDir, `${hourTimestamp}.log`);
|
|
34
|
-
|
|
35
|
-
// Append log entry to file
|
|
36
|
-
fs.appendFileSync(logFile, JSON.stringify(logMessage) + '\n', 'utf8');
|
|
37
|
-
} catch (err) {
|
|
38
|
-
// If file writing fails, at least we still have stderr
|
|
39
|
-
console.error('Failed to write to log file:', err);
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
// Create logger factory to inject server instance
|
|
44
|
-
export function createLogger(server?: Server): Logger {
|
|
45
|
-
const sendLog = async (level: 'error' | 'debug' | 'info' | 'warning', message: string, data?: any) => {
|
|
46
|
-
if (!server) return;
|
|
47
|
-
|
|
48
|
-
try {
|
|
49
|
-
await server.sendLoggingMessage({
|
|
50
|
-
level,
|
|
51
|
-
data: {
|
|
52
|
-
message,
|
|
53
|
-
...(data ? (typeof data === 'object' ? data : { data }) : {}),
|
|
54
|
-
},
|
|
55
|
-
});
|
|
56
|
-
} catch (error) {
|
|
57
|
-
if (
|
|
58
|
-
error instanceof Error &&
|
|
59
|
-
(error.message === 'Not connected' ||
|
|
60
|
-
error.message.includes('does not support logging') ||
|
|
61
|
-
error.message.includes('Connection closed'))
|
|
62
|
-
) {
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
console.error(`Failed to send ${level} log:`, error instanceof Error ? error.message : error);
|
|
66
|
-
}
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
return {
|
|
70
|
-
info: async (message: string, data?: any) => {
|
|
71
|
-
// Log to stderr to avoid MCP protocol conflicts on stdout
|
|
72
|
-
console.error(message, data ? data : '');
|
|
73
|
-
await sendLog('info', message, data);
|
|
74
|
-
},
|
|
75
|
-
warning: async (message: string, data?: any) => {
|
|
76
|
-
// Log to stderr to avoid MCP protocol conflicts on stdout
|
|
77
|
-
console.error(message, data ? data : '');
|
|
78
|
-
await sendLog('warning', message, data);
|
|
79
|
-
},
|
|
80
|
-
error: async (message: string, error?: any) => {
|
|
81
|
-
const errorData =
|
|
82
|
-
error instanceof Error
|
|
83
|
-
? {
|
|
84
|
-
message: error.message,
|
|
85
|
-
stack: error.stack,
|
|
86
|
-
name: error.name,
|
|
87
|
-
}
|
|
88
|
-
: error;
|
|
89
|
-
writeErrorLog(message, errorData);
|
|
90
|
-
console.error(message, errorData ? errorData : '');
|
|
91
|
-
await sendLog('error', message, errorData);
|
|
92
|
-
},
|
|
93
|
-
debug: async (message: string, data?: any) => {
|
|
94
|
-
if (process.env.DEBUG || process.env.NODE_ENV === 'development') {
|
|
95
|
-
// Log to stderr to avoid MCP protocol conflicts on stdout
|
|
96
|
-
console.error(message, data ? data : '');
|
|
97
|
-
await sendLog('debug', message, data);
|
|
98
|
-
}
|
|
99
|
-
},
|
|
100
|
-
};
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
// Create a default logger instance
|
|
104
|
-
export const logger = createLogger();
|