(server: McpServer)
| 455 | }; |
| 456 | |
| 457 | export async function getMCPWorkingDirectory(server: McpServer): Promise<string> { |
| 458 | const {roots} = await server.server.listRoots(); |
| 459 | |
| 460 | for (const root of roots) { |
| 461 | if (root.uri.startsWith('file://')) { |
| 462 | return path.resolve(root.uri.replace('file://', '')); |
| 463 | } |
| 464 | } |
| 465 | |
| 466 | throw new Error('No valid working directory found in MCP roots.'); |
| 467 | } |
no outgoing calls
no test coverage detected