mirror of
https://github.com/modelcontextprotocol/servers.git
synced 2026-04-24 23:05:21 +02:00
Update the way the stream is concatenated
Update the ts sdk
This commit is contained in:
9
package-lock.json
generated
9
package-lock.json
generated
@@ -6159,7 +6159,7 @@
|
|||||||
"version": "0.6.2",
|
"version": "0.6.2",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@modelcontextprotocol/sdk": "^1.12.3",
|
"@modelcontextprotocol/sdk": "^1.16.0",
|
||||||
"diff": "^5.1.0",
|
"diff": "^5.1.0",
|
||||||
"glob": "^10.3.10",
|
"glob": "^10.3.10",
|
||||||
"minimatch": "^10.0.1",
|
"minimatch": "^10.0.1",
|
||||||
@@ -6182,9 +6182,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"src/filesystem/node_modules/@modelcontextprotocol/sdk": {
|
"src/filesystem/node_modules/@modelcontextprotocol/sdk": {
|
||||||
"version": "1.12.3",
|
"version": "1.16.0",
|
||||||
"resolved": "https://registry.npmjs.org/@modelcontextprotocol/sdk/-/sdk-1.12.3.tgz",
|
"resolved": "https://registry.npmjs.org/@modelcontextprotocol/sdk/-/sdk-1.16.0.tgz",
|
||||||
"integrity": "sha512-DyVYSOafBvk3/j1Oka4z5BWT8o4AFmoNyZY9pALOm7Lh3GZglR71Co4r4dEUoqDWdDazIZQHBe7J2Nwkg6gHgQ==",
|
"integrity": "sha512-8ofX7gkZcLj9H9rSd50mCgm3SSF8C7XoclxJuLoV0Cz3rEQ1tv9MZRYYvJtm9n1BiEQQMzSmE/w2AEkNacLYfg==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"ajv": "^6.12.6",
|
"ajv": "^6.12.6",
|
||||||
@@ -6192,6 +6192,7 @@
|
|||||||
"cors": "^2.8.5",
|
"cors": "^2.8.5",
|
||||||
"cross-spawn": "^7.0.5",
|
"cross-spawn": "^7.0.5",
|
||||||
"eventsource": "^3.0.2",
|
"eventsource": "^3.0.2",
|
||||||
|
"eventsource-parser": "^3.0.0",
|
||||||
"express": "^5.0.1",
|
"express": "^5.0.1",
|
||||||
"express-rate-limit": "^7.5.0",
|
"express-rate-limit": "^7.5.0",
|
||||||
"pkce-challenge": "^5.0.0",
|
"pkce-challenge": "^5.0.0",
|
||||||
|
|||||||
@@ -476,17 +476,20 @@ async function headFile(filePath: string, numLines: number): Promise<string> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Stream a file and return its Base64 representation without loading the
|
// Reads a file as a stream of buffers, concatenates them, and then encodes
|
||||||
// entire file into memory at once. Chunks are encoded individually and
|
// the result to a Base64 string. This is a memory-efficient way to handle
|
||||||
// concatenated into the final string.
|
// binary data from a stream before the final encoding.
|
||||||
async function readFileAsBase64Stream(filePath: string): Promise<string> {
|
async function readFileAsBase64Stream(filePath: string): Promise<string> {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
const stream = createReadStream(filePath, { encoding: 'base64' });
|
const stream = createReadStream(filePath);
|
||||||
let data = '';
|
const chunks: Buffer[] = [];
|
||||||
stream.on('data', (chunk) => {
|
stream.on('data', (chunk) => {
|
||||||
data += chunk;
|
chunks.push(chunk as Buffer);
|
||||||
|
});
|
||||||
|
stream.on('end', () => {
|
||||||
|
const finalBuffer = Buffer.concat(chunks);
|
||||||
|
resolve(finalBuffer.toString('base64'));
|
||||||
});
|
});
|
||||||
stream.on('end', () => resolve(data));
|
|
||||||
stream.on('error', (err) => reject(err));
|
stream.on('error', (err) => reject(err));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -686,7 +689,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|||||||
? "audio"
|
? "audio"
|
||||||
: "blob";
|
: "blob";
|
||||||
return {
|
return {
|
||||||
content: [{ type, data, mimeType } as any],
|
content: [{ type, data, mimeType }],
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
"test": "jest --config=jest.config.cjs --coverage"
|
"test": "jest --config=jest.config.cjs --coverage"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@modelcontextprotocol/sdk": "^1.12.3",
|
"@modelcontextprotocol/sdk": "^1.16.0",
|
||||||
"diff": "^5.1.0",
|
"diff": "^5.1.0",
|
||||||
"glob": "^10.3.10",
|
"glob": "^10.3.10",
|
||||||
"minimatch": "^10.0.1",
|
"minimatch": "^10.0.1",
|
||||||
|
|||||||
Reference in New Issue
Block a user