mirror of
https://github.com/AgentDeskAI/browser-tools-mcp.git
synced 2025-12-11 07:00:52 +00:00
fixed screenshot bug for mcp server
This commit is contained in:
parent
c615cc635f
commit
1900d78d89
@ -117,13 +117,14 @@ server.tool(
|
||||
const result = await response.json();
|
||||
|
||||
if (response.ok) {
|
||||
// const message = `Screenshot saved to: ${
|
||||
// result.path
|
||||
// }\nFilename: ${path.basename(result.path)}`;
|
||||
return {
|
||||
content: [
|
||||
{
|
||||
type: "text",
|
||||
text: `Screenshot saved to: ${
|
||||
result.path
|
||||
}\nFilename: ${path.basename(result.path)}`,
|
||||
text: "Successfully saved screenshot",
|
||||
},
|
||||
],
|
||||
};
|
||||
@ -188,6 +189,22 @@ server.tool("wipeLogs", "Wipe all browser logs from memory", async () => {
|
||||
|
||||
// Start receiving messages on stdio
|
||||
(async () => {
|
||||
const transport = new StdioServerTransport();
|
||||
await server.connect(transport);
|
||||
try {
|
||||
const transport = new StdioServerTransport();
|
||||
|
||||
// Ensure stdout is only used for JSON messages
|
||||
const originalStdoutWrite = process.stdout.write.bind(process.stdout);
|
||||
process.stdout.write = (chunk: any, encoding?: any, callback?: any) => {
|
||||
// Only allow JSON messages to pass through
|
||||
if (typeof chunk === "string" && !chunk.startsWith("{")) {
|
||||
return true; // Silently skip non-JSON messages
|
||||
}
|
||||
return originalStdoutWrite(chunk, encoding, callback);
|
||||
};
|
||||
|
||||
await server.connect(transport);
|
||||
} catch (error) {
|
||||
console.error("Failed to initialize MCP server:", error);
|
||||
process.exit(1);
|
||||
}
|
||||
})();
|
||||
|
||||
4
browser-tools-mcp/package-lock.json
generated
4
browser-tools-mcp/package-lock.json
generated
@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@agentdeskai/browser-tools-mcp",
|
||||
"version": "1.0.9",
|
||||
"version": "1.0.11",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@agentdeskai/browser-tools-mcp",
|
||||
"version": "1.0.9",
|
||||
"version": "1.0.11",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@modelcontextprotocol/sdk": "^1.4.1",
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@agentdeskai/browser-tools-mcp",
|
||||
"version": "1.0.9",
|
||||
"version": "1.0.11",
|
||||
"description": "MCP (Model Context Protocol) server for browser tools integration",
|
||||
"main": "dist/mcp-server.js",
|
||||
"bin": {
|
||||
@ -11,7 +11,8 @@
|
||||
"inspect-live": "npx @modelcontextprotocol/inspector npx -- @agentdeskai/browser-tools-mcp",
|
||||
"build": "tsc",
|
||||
"start": "tsc && node dist/mcp-server.js",
|
||||
"prepublishOnly": "npm run build"
|
||||
"prepublishOnly": "npm run build",
|
||||
"update": "npm run build && npm version patch && npm publish"
|
||||
},
|
||||
"keywords": [
|
||||
"mcp",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user