# VS Code MCP Connection Issue - Fixed
## Problem
The VS Code extension was timing out when trying to connect to the MCP server due to `fmt.Printf` statements in the code that were outputting to stdout, interfering with the MCP JSON-RPC protocol communication.
## Solution Applied
### 1. **Commented Out Printf Statements**
Fixed the following files by commenting out `fmt.Printf` statements:
- `/mnt/f/Development/Projects/Gorev/gorev-mcpserver/internal/mcp/handlers.go`
- Line 519: Commented out `fmt.Printf("Görev görüntüleme kaydı hatası: %v\n", err)`
- Line 1684: Commented out `fmt.Printf("Görev görüntüleme kaydı hatası: %v\n", err)`
- `/mnt/f/Development/Projects/Gorev/gorev-mcpserver/internal/gorev/ai_context_yonetici.go`
- Line 336: Commented out `fmt.Printf("interaction kaydetme hatası: %v\n", err)`
- `/mnt/f/Development/Projects/Gorev/gorev-mcpserver/internal/gorev/veri_yonetici.go`
- Lines 53, 55, 65, 67, 70, 74: Already commented out log statements (no action needed)
- Lines 140, 219, 535, 601: Already commented out log statements (no action needed)
### 2. **Rebuilt the MCP Server**
```bash
cd /mnt/f/Development/Projects/Gorev/gorev-mcpserver
go build -v -ldflags "-X main.version=0.9.0 -X main.buildTime=$(date -u +"%Y-%m-%dT%H:%M:%SZ") -X main.gitCommit=$(git rev-parse --short HEAD)" -o build/gorev cmd/gorev/main.go
```
The binary was successfully built at: `/mnt/f/Development/Projects/Gorev/gorev-mcpserver/build/gorev`
### 3. **Updated VS Code Extension Configuration**
The package.json was already updated to use the correct server path:
- Default server path: `/mnt/f/Development/Projects/Gorev/gorev-mcpserver/build/gorev`
### 4. **Verified Clean Output**
Tested the server to ensure it produces clean JSON-RPC output:
```bash
echo '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{"tools":{"listChanged":true},"logging":{}},"clientInfo":{"name":"test","version":"1.0.0"}}}' | ./build/gorev serve 2>/tmp/gorev-stderr.log
```
Result: Server responded with clean JSON-RPC message and no stderr output.
## Configuration Settings
- Server timeout: 30000ms (30 seconds) - already configured in package.json
- Server path: `/mnt/f/Development/Projects/Gorev/gorev-mcpserver/build/gorev`
## Next Steps for Users
1. **Restart VS Code** to ensure the extension uses the updated server binary
2. **Check the Gorev output panel** for connection status
3. The extension should now connect successfully without timeout errors
## Additional Notes
- All remaining `fmt.Println` statements in the code are in CLI commands (template list, show, etc.) and don't affect the MCP server mode
- The server now produces clean JSON-RPC output required by the MCP protocol
- No log statements are written to stdout/stderr during MCP server operation
## Testing
To verify the fix is working:
1. Open VS Code
2. Check the Gorev extension output panel
3. You should see successful connection messages without timeout errors
4. The task tree view should populate with data