@blaxel/mcp-gateway
v0.1.3
Published
MCP Gateway for Blaxel
Keywords
Readme
Blaxel MCP Gateway
An MCP (Model Context Protocol) gateway that connects to Blaxel-hosted MCP servers and exposes them as stdio MCP servers for use in Cursor and other MCP-compatible clients.
Features
- Blaxel MCP Integration: Connect to any MCP server hosted on Blaxel
- Stdio Transport: Exposes Blaxel MCP servers as stdio MCP servers
- Automatic Tool Discovery: Automatically discovers and exposes all tools from the connected MCP server
- Cursor Integration: Ready to use with Cursor and other MCP-compatible clients
Usage
Configuration
Add this to your MCP configuration:
{
"mcpServers": {
"blaxel-mcp": {
"command": "npx",
"args": [
"-y",
"@blaxel/mcp-gateway@latest",
"--url",
"wss://run.blaxel.ai/{YOUR_WORKSPACE}/functions/{YOUR_MCP_SERVER_NAME}"
]
}
}
}Prerequisites
- Node.js (version 16 or higher)
- npm, yarn, or pnpm package manager
- Blaxel account with deployed MCP servers
Installation
Run directly with npx (recommended):
npx -y @blaxel/mcp-gateway@latest --url wss://run.blaxel.ai/{YOUR_WORKSPACE}/functions/{YOUR_MCP_SERVER_NAME}Or install globally:
npm install -g @blaxel/mcp-gateway
mcp-gateway --url wss://run.blaxel.ai/{YOUR_WORKSPACE}/functions/{YOUR_MCP_SERVER_NAME}Or install locally from source:
git clone https://github.com/blaxel-ai/mcp-gateway
cd mcp-gateway
npm install
npm run build
node dist/index.mjs --url wss://run.blaxel.ai/{YOUR_WORKSPACE}/functions/{YOUR_MCP_SERVER_NAME}Configuration
Pass the WebSocket URL with the --url flag. Example:
npx -y @blaxel/mcp-gateway@latest --url wss://run.blaxel.ai/{YOUR_WORKSPACE}/functions/{YOUR_MCP_SERVER_NAME}Authentication
The gateway uses Blaxel's automatic authentication. Make sure you're authenticated with Blaxel CLI:
bl loginOr set environment variables:
export BL_API_KEY="your-api-key"
export BL_WORKSPACE="your-workspace"Development
npm run build # Build the TypeScript code
npx @modelcontextprotocol/inspector npx -y @blaxel/mcp-gateway@latest --url wss://run.blaxel.ai/{YOUR_WORKSPACE}/functions/{YOUR_MCP_SERVER_NAME} # DebugProject Structure
index.ts- Main MCP gateway implementationpackage.json- Dependencies and scriptstsconfig.json- TypeScript configuration
How It Works
- Connection: The gateway connects to a Blaxel MCP server via WebSocket using the provided URL
- Tool Discovery: It automatically discovers all available tools from the connected MCP server
- Proxy: It acts as a proxy, forwarding tool calls from the stdio client to the Blaxel MCP server
- Response Handling: It forwards responses back to the stdio client
Troubleshooting
Common Issues
- Connection Failed: Verify your WebSocket URL and authentication
- No Tools Found: Ensure your Blaxel MCP server is running and has tools
- Authentication Error: Make sure you're logged in with Blaxel CLI or have valid API keys
License
This project is licensed under the MIT License - see the LICENSE file for details.
Contributing
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Support
For support, please:
- Check the Blaxel documentation
- Open an issue in the GitHub repository
- Contact the maintainers
Acknowledgments
- Model Context Protocol (MCP) community
- Blaxel team for the MCP hosting infrastructure
- Cursor team for MCP integration
