Skip to main content
Glama
INITIALIZE_LOGGING.md2.66 kB
# Initialize Request Logging ## Overview Added logging to capture the raw initialization payload received from Windsurf (or any MCP client) to help debug workspace detection issues. ## What Was Added ### Code Changes In `src/index.ts`, added: 1. **Import**: Added `InitializeRequestSchema` to the imports from `@modelcontextprotocol/sdk/types.js` 2. **Initialize Handler**: Added a request handler that logs the complete initialization payload and specifically checks for workspace-related parameters: - `params.roots` - `params.workspaceFolders` - `params.rootUri` - `params.rootPath` - `params.processId` - `params.clientInfo` ### Log Output When the MCP server initializes, it will output to stderr: ``` === MCP Initialize Request === Full request: <complete JSON payload> Request keys: <top-level keys> Request.params keys: <parameter keys> === Workspace Parameter Check === params.roots: <value or undefined> params.workspaceFolders: <value or undefined> params.rootUri: <value or undefined> params.rootPath: <value or undefined> params.processId: <value or undefined> params.clientInfo: <value or undefined> ================================ ``` ## How to Test ### Option 1: Using MCP Inspector ```bash # Build the project make build # Run with MCP Inspector make test-inspector ``` ### Option 2: Using Windsurf 1. Rebuild the MCP server: ```bash make build ``` 2. Restart Windsurf or reload the MCP server configuration 3. Check the MCP server logs in Windsurf: - Look for the initialization logs in the MCP output panel - The logs will show what parameters Windsurf sends during initialization ### Option 3: Direct Testing with Node ```bash # Build first make build # Run the server directly (it will wait for MCP protocol messages on stdin) node dist/index.js ``` ## Expected Results The logs will confirm whether any of these workspace-related parameters exist: - ✅ If present: The parameter name will show its value - ❌ If absent: The parameter will show `undefined` ## Next Steps Based on the logged values: 1. **If `params.rootUri` or `params.workspaceFolders` exist**: We can use these to automatically detect the workspace directory 2. **If none exist**: We'll need to rely on the `DEVPIPE_CWD` environment variable or tool parameters 3. **If `params.clientInfo` exists**: We can identify the client (Windsurf) and potentially handle it differently ## Related Files - `src/index.ts` - Main server file with initialization handler - `src/utils.ts` - Utility functions including `findConfigFile()` - `docs/TEST_WHAT_DIRECTORY.md` - Documentation about directory detection issues

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/drewkhoury/devpipe-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server