Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion ai-sdk/src/mcp-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ server.registerTool(
async function main() {
const transport = new StdioServerTransport();
await server.connect(transport);
console.log('Pokemon MCP Server running on stdio');
// Log to stderr: stdout is the JSON-RPC channel for a stdio MCP server.
console.error('Pokemon MCP Server running on stdio');
}

main().catch((error) => {
Expand Down
11 changes: 9 additions & 2 deletions ai-sdk/src/worker.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import path from 'node:path';
import { NativeConnection, Worker } from '@temporalio/worker';
import * as activities from './activities';
import { AiSdkPlugin } from '@temporalio/ai-sdk';
Expand All @@ -12,12 +13,18 @@ async function run() {
try {
// This is only used by the MCP Sample
// @@@SNIPSTART typescript-vercel-ai-sdk-mcp-client-factories
const mcpServerPath = require.resolve('./mcp-server');
const mcpServerArgs = mcpServerPath.endsWith('.ts')
? ['-r', require.resolve('ts-node/register'), mcpServerPath]
: [mcpServerPath];

const mcpClientFactories = {
testServer: () =>
createMCPClient({
transport: new StdioClientTransport({
command: 'node',
args: ['lib/mcp-server.js'],
command: process.execPath,
args: mcpServerArgs,
cwd: path.resolve(__dirname, '..'),
}),
}),
};
Expand Down
Loading