Revert "try adding more debug logging"

This reverts commit 06542e382a.
This commit is contained in:
David Blass
2025-10-13 13:28:35 -04:00
parent 06542e382a
commit 4cfb9b5008
2 changed files with 76 additions and 142 deletions
+5 -71
View File
@@ -6,38 +6,11 @@ import { Octokit } from "@octokit/rest";
import { type } from "arktype";
import { z } from "zod";
import { resolveRepoContext } from "../utils/repo-context.ts";
import { writeFileSync } from "node:fs";
// Simple error logging to file
function logError(message: string, error?: any) {
const timestamp = new Date().toISOString();
const errorText = error
? `\nError: ${error.message}\nStack: ${error.stack}`
: "";
const logEntry = `[${timestamp}] ${message}${errorText}\n`;
try {
writeFileSync("/tmp/mcp-error.log", logEntry, { flag: "a" });
console.error(logEntry);
} catch (writeError) {
console.error(`Failed to write error log: ${writeError}`);
console.error(logEntry);
}
}
let server: McpServer;
try {
logError("Creating MCP server...");
server = new McpServer({
const server = new McpServer({
name: "Minimal GitHub Issue Comment Server",
version: "0.0.1",
});
logError("MCP server created successfully");
} catch (error) {
logError("Failed to create MCP server", error);
process.exit(1);
}
});
// Define the schema for creating issue comments
const Comment = type({
@@ -45,10 +18,7 @@ const Comment = type({
body: type.string.describe("the comment body content"),
});
try {
logError("Registering create_issue_comment tool...");
server.tool(
server.tool(
"create_issue_comment",
"Create a comment on a GitHub issue",
{
@@ -100,7 +70,6 @@ try {
} catch (error) {
const errorMessage =
error instanceof Error ? error.message : String(error);
logError("Tool execution failed", error);
return {
content: [
{
@@ -113,49 +82,14 @@ try {
};
}
}
);
logError("Tool registered successfully");
} catch (error) {
logError("Failed to register tool", error);
process.exit(1);
}
);
async function runServer() {
try {
logError("Starting MCP server...");
const transport = new StdioServerTransport();
logError("Transport created, attempting connection...");
await server.connect(transport);
logError("MCP server connected successfully");
process.on("exit", () => {
logError("Process exiting, closing server...");
server.close();
});
process.on("SIGTERM", () => {
logError("SIGTERM received, closing server...");
server.close();
process.exit(0);
});
process.on("SIGINT", () => {
logError("SIGINT received, closing server...");
server.close();
process.exit(0);
});
} catch (error) {
logError("Server startup failed", error);
process.exit(1);
}
}
logError("Initializing MCP server process...");
runServer().catch((error) => {
logError("Unhandled server error", error);
process.exit(1);
});
runServer().catch(console.error);
+4 -4
View File
@@ -1,6 +1,6 @@
{
"name": "@pullfrog/action",
"version": "0.0.23",
"version": "0.0.22",
"type": "module",
"files": [
"index.js",
@@ -34,8 +34,7 @@
"arktype": "^2.1.22",
"dotenv": "^17.2.2",
"execa": "^9.6.0",
"table": "^6.9.0",
"zod": "^3.24.4"
"table": "^6.9.0"
},
"devDependencies": {
"@types/node": "^20.10.0",
@@ -43,7 +42,8 @@
"esbuild": "^0.25.9",
"husky": "^9.0.0",
"typescript": "^5.3.0",
"zshy": "^0.4.1"
"zshy": "^0.4.1",
"zod": "^3.24.4"
},
"repository": {
"type": "git",