@pranavchavda/shopify-mcp-stdio-client
Version:
STDIO MCP Client for Shopify e-commerce tools - bridges legacy STDIO clients to modern HTTP/SSE MCP servers
173 lines (131 loc) • 4.95 kB
Markdown
# Shopify MCP STDIO Client
A bridge that enables legacy STDIO-based MCP clients to connect to modern HTTP/SSE MCP servers. This tool provides seamless compatibility for tools and SDKs that only support the STDIO transport protocol.
## Features
- **Universal Compatibility**: Bridges STDIO clients to HTTP/SSE servers
- **Zero Dependencies**: Self-contained bundle with no external dependencies
- **Bearer Token Security**: Optional authentication for production deployments
- **Dual Transport**: Supports both HTTP POST and Server-Sent Events modes
- **Production Ready**: Connect to hosted Shopify MCP server instance
- **Zero Configuration**: Works out of the box with sensible defaults
- **Full MCP Protocol**: Complete JSON-RPC 2.0 MCP protocol support
## Quick Start
### Using npx (Recommended)
```bash
# Connect to production Shopify MCP server
npx @pranavchavda/shopify-mcp-stdio-client
# With authentication token
npx @pranavchavda/shopify-mcp-stdio-client --token=your-bearer-token
# Use Server-Sent Events mode for better performance
npx @pranavchavda/shopify-mcp-stdio-client --sse --token=your-token
# Connect to custom server
npx @pranavchavda/shopify-mcp-stdio-client --url=http://localhost:5000 --token=your-token
```
### Local Installation
```bash
npm install -g @pranavchavda/shopify-mcp-stdio-client
shopify-mcp-stdio
```
## Usage Examples
### Basic STDIO Communication
```bash
# Send MCP requests via stdin
echo '{"jsonrpc":"2.0","method":"initialize","params":{"protocolVersion":"2024-11-05","clientInfo":{"name":"test","version":"1.0"}},"id":1}' | shopify-mcp-stdio
# List available tools
echo '{"jsonrpc":"2.0","method":"tools/list","id":2}' | shopify-mcp-stdio
```
### Integration with MCP Clients
```python
import subprocess
import json
# Start the STDIO bridge
process = subprocess.Popen(
['npx', '@pranavchavda/shopify-mcp-stdio-client'],
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
text=True
)
# Send MCP request
request = {
"jsonrpc": "2.0",
"method": "tools/list",
"id": 1
}
process.stdin.write(json.dumps(request) + '\n')
process.stdin.flush()
# Read response
response = process.stdout.readline()
result = json.loads(response)
print(f"Available tools: {len(result['result']['tools'])}")
```
## Command Line Options
| Option | Description | Default |
|--------|-------------|---------|
| `--sse` | Use Server-Sent Events transport | HTTP POST |
| `--url=URL` | Custom MCP server base URL | `https://webhook-listener-pranavchavda.replit.app` |
| `--token=TOKEN` | Bearer token for authentication | None (uses env var) |
| `--help` | Show help message | - |
### Environment Variables
| Variable | Description | Example |
|----------|-------------|---------|
| `MCP_SERVER_URL` | Default server URL | `https://your-server.com` |
| `MCP_BEARER_TOKEN` | Authentication token | `your-secure-token` |
## Available Shopify Tools
The STDIO client provides access to 15+ Shopify e-commerce tools:
- **Product Management**: Create, search, and update products
- **Open Box Listings**: Duplicate products with custom pricing
- **Pricing Updates**: Modify variant prices and costs
- **Collection Management**: Add products to collections
- **GraphQL Operations**: Execute custom Shopify queries/mutations
- **Tag Management**: Add/remove product tags
- **Metafield Operations**: Set custom product metadata
- **SKU Vault Integration**: Upload products to inventory systems
## Transport Modes
### HTTP POST Mode (Default)
- Single request-response pattern
- Lower latency for individual requests
- Compatible with all network configurations
### Server-Sent Events Mode (`--sse`)
- Persistent connection with real-time capabilities
- Better performance for multiple requests
- Supports streaming responses
## Error Handling
The STDIO client provides comprehensive error handling:
```json
{
"jsonrpc": "2.0",
"id": 1,
"error": {
"code": -32603,
"message": "Transport error",
"data": "HTTP 500: Internal Server Error"
}
}
```
Common error codes:
- `-32700`: Parse error (invalid JSON)
- `-32600`: Invalid request
- `-32603`: Internal/transport error
## Production Endpoints
- **HTTP**: `https://webhook-listener-pranavchavda.replit.app/mcp`
- **SSE**: `https://webhook-listener-pranavchavda.replit.app/mcp/sse`
- **Health**: `https://webhook-listener-pranavchavda.replit.app/mcp/health`
## Development
```bash
git clone https://github.com/pranavchavda/shopify-mcp-server
cd shopify-mcp-server/shopify-mcp-stdio-client
npm install
node index.js --url=http://localhost:5000
```
## Testing
```bash
# Run test suite
npm test
# Run interactive demo
npm run demo
```
## License
MIT License - see LICENSE file for details.
## Support
- GitHub Issues: [Repository Issues](https://github.com/pranavchavda/shopify-mcp-server/issues)
- Documentation: [MCP Server Docs](https://webhook-listener-pranavchavda.replit.app)
- Email: pranav@ideasoutright.com