An MCP (Model Context Protocol) client bridge that converts HTTP MCP server requests to stdin/stdout JSON-RPC protocol for integration with Warp terminal and other MCP-compatible AI assistants.
This client acts as a bridge between:
- AI clients (like Warp terminal) that expect stdin/stdout JSON-RPC protocol
- Polyneural AI HTTP server that uses JSON-RPC over HTTP POST
- Node.js v18.0.0 or higher
- A Polyneural AI API key
# Install dependencies (none required - uses built-in Node.js modules)
cd mcp-client
npm installThe client is configured via environment variables:
POLYNEURAL_API_KEY- Your Polyneural.ai API key (format:kg_xxxxxxxx)
POLYNEURAL_API_URL- API base URL (default:https://api.polyneural.ai/mcp)DEBUG- Enable debug logging (1to enable,0or unset to disable)REQUEST_TIMEOUT_MS- HTTP request timeout in milliseconds (default:30000)SHORT_TERM- Enable embedded short-term memory in tool descriptions (true/false, default:false)
export POLYNEURAL_API_KEY=kg_your_api_key_here
node index.jsexport POLYNEURAL_API_KEY=kg_your_api_key_here
export DEBUG=1
node index.js# Basic usage
export POLYNEURAL_API_KEY=kg_your_api_key_here
npm start
# With debug logging
export POLYNEURAL_API_KEY=kg_your_api_key_here
npm run devexport POLYNEURAL_API_KEY=kg_your_api_key_here
export POLYNEURAL_API_URL=https://api.polyneural.ai/mcp # or staging/local as needed
node index.jsTo use this client with Warp terminal, add it to your MCP configuration:
{
"mcpServers": {
"polyneural": {
"command": "node",
"args": ["/path/to/polyneural.ai/mcp-client/index.js"],
"env": {
"POLYNEURAL_API_KEY": "kg_your_api_key_here",
"SHORT_TERM": "true"
}
}
}
}For Claude Desktop, add to your configuration file:
{
"mcpServers": {
"polyneural": {
"command": "node",
"args": ["/path/to/polyneural.ai/mcp-client/index.js"],
"env": {
"POLYNEURAL_API_KEY": "kg_your_api_key_here",
"POLYNEURAL_API_URL": "https://polyneural.ai/mcp",
"SHORT_TERM": "true"
}
}
}
}The client supports the following MCP protocol methods:
initialize- Initialize the MCP connectiontools/list- List available toolstools/call- Call a specific toolresources/list- List resources (returns empty list)resources/read- Read resources (returns error - not supported)prompts/list- List prompts (returns empty list)initialized- Initialization notificationping- Health check
The client includes comprehensive error handling:
- Connection errors - Returned as JSON-RPC error responses
- Timeout errors - Configurable timeout with graceful error responses
- Parse errors - Malformed JSON requests are handled gracefully
- Memory monitoring - Optional memory usage logging in debug mode
When DEBUG=1 is set, the client provides detailed logging including:
- Request/response sizes and previews
- Memory usage monitoring
- HTTP status codes and error details
- Message processing statistics
All debug logs are sent to stderr to avoid interfering with the JSON-RPC communication on stdout.
- Expects newline-delimited JSON-RPC 2.0 requests
- Each line should be a complete JSON object
- Supports large message buffering
- Returns newline-delimited JSON-RPC 2.0 responses
- Each response corresponds to a request (except notifications)
- Includes proper error handling and ID matching
- Forwards requests to the configured API URL via HTTP POST
- Includes authentication via Bearer token
- Handles response mapping and error translation
-
"POLYNEURAL_API_KEY environment variable is required"
- Make sure to set your API key:
export POLYNEURAL_API_KEY=kg_your_key_here
- Make sure to set your API key:
-
Connection timeouts
- Check your network connection
- Verify the API URL is correct
- Try increasing
REQUEST_TIMEOUT_MS
-
Authentication errors
- Verify your API key is correct
- Check that your key has proper permissions
-
Large response handling
- The client automatically handles large responses
- Monitor memory usage with
DEBUG=1
Enable debug mode for detailed troubleshooting:
export DEBUG=1
export POLYNEURAL_API_KEY=kg_your_key_here
node index.jsThis will show:
- All request/response details
- Memory usage statistics
- Error details and stack traces
- Message processing information
mcp-client/
├── index.js # Main MCP client bridge
├── package.json # Project configuration
└── README.md # This file
- Edit
index.jsfor client logic changes - Update
package.jsonfor dependency or metadata changes - Test with your MCP client (Warp, Claude Desktop, etc.)
Test the client manually:
export POLYNEURAL_API_KEY=kg_your_key_here
export DEBUG=1
echo '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}' | node index.jsMIT License - see the main project repository for details.