chore: Enhance MCP server execution and compatibility with Cursor mode

- Introduce environment variables for Cursor compatibility in silent-mcp.sh and npx-entry.cjs
- Implement process cleanup for existing MCP instances to prevent conflicts
- Adjust logging behavior based on execution context to ensure proper message handling
- Add test-cursor.sh script to simulate Cursor environment for testing purposes
- Refactor stdio-server.ts to manage logging and message flushing based on compatibility mode
This commit is contained in:
jango-blockchained
2025-03-17 18:30:33 +01:00
parent 1bc11de465
commit 2d5ae034c9
4 changed files with 187 additions and 55 deletions

13
test-cursor.sh Executable file
View File

@@ -0,0 +1,13 @@
#!/bin/bash
# Clean up any existing processes first
pkill -f "node.*stdio-server" >/dev/null 2>&1 || true
# Simulate Cursor environment by setting env variables
export CURSOR_SESSION=test-session
export CURSOR_COMPATIBLE=true
export USE_STDIO_TRANSPORT=true
export LOG_LEVEL=info
# Run npx with the simulated environment
npx homeassistant-mcp