Fix MCP server undefined error and file path resolution

- Add error field to MCP error responses to fix 'undefined' errors
- Add REPO_DIR environment variable to fix file path resolution
- Use GITHUB_WORKSPACE for correct repository directory
- Simplify path processing logic in commit_files tool

This fixes the issue where mcp__github_file_ops__commit_files would fail
with 'Error calling tool commit_files: undefined' by ensuring error messages
are properly formatted and files are read from the correct directory.
This commit is contained in:
Lina Tawfik
2025-05-23 11:17:05 -07:00
parent 57ae256d38
commit c60a8fb69b
2 changed files with 18 additions and 13 deletions

View File

@@ -34,6 +34,7 @@ export async function prepareMcpConfig(
REPO_OWNER: owner,
REPO_NAME: repo,
BRANCH_NAME: branch,
REPO_DIR: process.env.GITHUB_WORKSPACE || process.cwd(), // Use GitHub workspace directory
},
},
},