chore: switch to module ESNext + moduleResolution bundler (#2095)

This commit is contained in:
Matt 2026-06-25 12:49:17 +02:00 • committed by GitHub
commit ee732d64b6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 668 additions and 863 deletions

View file

@ -15,6 +15,7 @@
"@modelcontextprotocol/client": "workspace:^"
},
"devDependencies": {
"@modelcontextprotocol/tsconfig": "workspace:^",
"@types/node": "^24.10.1",
"typescript": "catalog:devTools"
}

View file

@ -116,7 +116,8 @@ class MCPClient {
messages,
});
finalText.push(followUp.content[0].type === 'text' ? followUp.content[0].text : '');
const firstBlock = followUp.content[0];
finalText.push(firstBlock?.type === 'text' ? firstBlock.text : '');
}
}
@ -156,13 +157,14 @@ class MCPClient {
//#region main
async function main() {
if (process.argv.length < 3) {
const serverScriptPath = process.argv[2];
if (!serverScriptPath) {
console.log('Usage: node build/index.js <path_to_server_script>');
return;
}
const mcpClient = new MCPClient();
try {
await mcpClient.connectToServer(process.argv[2]);
await mcpClient.connectToServer(serverScriptPath);
// Check if we have a valid API key to continue
const apiKey = process.env.ANTHROPIC_API_KEY;

View file

@ -1,15 +1,11 @@
{
"extends": "@modelcontextprotocol/tsconfig",
"compilerOptions": {
"target": "ES2023",
"lib": ["ES2023"],
"module": "Node16",
"moduleResolution": "Node16",
"outDir": "./build",
"rootDir": "./src",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"declaration": false,
"declarationMap": false,
"types": ["node"],
"paths": {
"@modelcontextprotocol/client": ["./node_modules/@modelcontextprotocol/client/src/index.ts"],
"@modelcontextprotocol/client/stdio": ["./node_modules/@modelcontextprotocol/client/src/stdio.ts"],