Integrations
Supports configuration management through .env files, allowing secure storage of API credentials and other environment variables needed for the Luno exchange integration.
Provides real-time cryptocurrency price information and trading capabilities through the Luno exchange, including market overview, account balance queries, order management, and transaction history retrieval for Bitcoin and other cryptocurrencies.
Enables version control and codebase management for the MCP server, supporting cloning of the repository during installation.
Luno MCP Server
A Model Context Protocol (MCP) server for the Luno cryptocurrency exchange API. This server provides a standardized interface for AI models and applications to interact with the Luno API for cryptocurrency trading.
Features
- Real-time cryptocurrency price information via Luno API
- Market overview for all trading pairs
- Account balance queries
- Order management (place, cancel, status)
- Transaction history retrieval
- Fee information
- Standardized JSON-RPC 2.0 interface
- Simple integration with AI applications
Prerequisites
- Python 3.8+ (Python 3.9+ recommended)
uv
for package management- Luno account with API keys (for full functionality)
Installation
- Clone this repository
- Create a virtual environment using
uv
- Install dependencies
- Configure your Luno API credentials (choose one method):
Docker Support
You can run the MCP server using Docker for easier deployment and consistent environment across different platforms.
Using Docker Compose (Recommended)
- Copy the example environment file and configure your credentials:
- Start the server:
The server will be available at ws://localhost:8765
in WebSocket mode.
- View logs:
- Stop the server:
Using Docker Directly
Build the image:
Run the container:
Using with AI Assistants
After starting the Docker container, you can connect various AI assistants to use the Luno MCP server:
Cursor
Add the following to your Cursor configuration:
Claude Desktop
In Claude Desktop settings, you have two options for configuring the MCP server:
Option 1: Using Docker (Recommended)
This configuration starts the server in a Docker container and connects via WebSocket.
Option 2: Using Direct Python Execution
This configuration runs the Python server directly using STDIO transport.
Note: Replace
/path/to/mcp-luno
with the actual path where you cloned the repository.
Cline
Add the following to your Cline configuration file:
SSL Support with Docker
To use SSL with the Docker container:
- Generate certificates using the provided script:
- Mount the certificates directory when running the container:
Manual Installation
Option A: Using .env
file
Then edit the .env
file to add your Luno API credentials:
Option B: Using VS Code MCP configuration
Edit the .vscode/mcp.json
file and add your credentials to the env
section:
Note: Without valid API credentials, only public endpoints will be available. Recommendation: For security, prefer environment variables when sharing code.
Running the Server
You can run the MCP server in two different transport modes:
STDIO Transport (Default, Single Client)
This is the default mode, which supports a single client connection via standard input/output:
WebSockets Transport (Multiple Clients)
For supporting multiple client connections simultaneously, run the server in WebSocket mode:
The WebSocket server will start at ws://localhost:8765
by default.
Testing the WebSocket Server
You can test the WebSocket server using the included test client:
This helps verify that the server is correctly handling WebSocket connections and responding to requests.
Command Line Options
--transport {stdio,websocket}
: Transport mechanism to use (default: stdio)--host HOST
: Host to bind to when using WebSocket transport (default: localhost)--port PORT
: Port to bind to when using WebSocket transport (default: 8765)
Environment Variables
You can also configure the transport using environment variables:
MCP_TRANSPORT
: Transport mechanism ("stdio" or "websocket")MCP_HOST
: Host to bind to for WebSocket transportMCP_PORT
: Port to bind to for WebSocket transport
Testing with the Standard Client
For testing the STDIO transport, use the included test client:
MCP Protocol Integration
This server implements the Model Context Protocol, which allows AI models to interact with it via standardized JSON-RPC 2.0 messages. The server operates over STDIO by default, making it easy to integrate with VS Code extensions and other MCP-compatible clients.
VS Code Integration
The .vscode/mcp.json
file configures the server for use with VS Code. Two server configurations are provided:
luno-mcp-server-stdio
- Uses the STDIO transport (default MCP behavior)luno-mcp-server-websocket
- Uses the WebSocket transport for multiple client support
VS Code Configuration
To use the WebSocket transport with VS Code, the mcp.json
file includes a process-type configuration:
When using the WebSocket transport, VS Code will start the server as a background process rather than communicating via STDIO.
Configuring the MCP Server in VS Code
You can configure the server directly from the .vscode/mcp.json
file:
This configuration will be used by VS Code extensions that support the MCP protocol, making it easy to integrate with AI models and other tools.
Available Methods
Method | Description | Authentication Required |
---|---|---|
describe_capabilities | Return information about server capabilities | No |
get_crypto_price | Get current price for a specific trading pair | No |
get_market_overview | Get an overview of all available markets | No |
get_account_balance | Get the balance of all accounts | Yes |
place_order | Place a new order | Yes |
cancel_order | Cancel an existing order | Yes |
get_order_status | Get the status of an order | Yes |
get_transaction_history | Get transaction history for an account | Yes |
get_fees | Get fee information for a trading pair | Yes |
Example Requests
Get server capabilities:
Get Bitcoin-ZAR price:
Development
Project Structure
Running Tests
Adding New Features
To add new Luno API capabilities:
- Extend the
LunoClient
class insrc/luno_mcp_server/luno_client.py
with new API methods - Add corresponding methods in the
LunoMCPServer
class insrc/luno_mcp_server/server.py
- Update the
MCP_METHODS
list inserver.py
and register your methods in the_register_methods
function - Add tests in the
tests/
directory
Architecture
The MCP server uses a simple architecture:
- JSON-RPC 2.0 for communication
- Standard input/output (STDIO) for transport
- Luno API client for cryptocurrency operations
Troubleshooting
Common Issues
- API Authentication Errors: Ensure your Luno API keys are correctly set in either the
.env
file or in.vscode/mcp.json
- Import Errors: Make sure you've activated the virtual environment
- Rate Limiting: The Luno API has rate limits - implement retry logic for production use
Configuration Priority
When starting the server, configuration values are loaded in this order of priority:
- Environment variables passed through MCP configuration (highest priority)
- Values in the
.env
file - Default values in code (lowest priority)
This means you can set values in the MCP configuration to override any existing values in your .env
file.
Multi-Client Support
This MCP server supports multiple client connections simultaneously via WebSockets. For detailed information, see MULTI_CLIENT_SUPPORT.md.
Transport Options
The server supports two transport mechanisms:
- STDIO (Default): Standard input/output - single client, used by VS Code MCP
- WebSockets: Network transport - multiple clients with security features
Running with WebSockets Transport
Basic usage:
With security options:
With SSL/TLS encryption:
WebSocket Client Tools
The repository includes two client tools:
- test_websocket_client.py: Simple test clientCopy
- enhanced_websocket_client.py: Advanced client with multi-client simulationCopy
License
MIT License
Copyright (c) 2025
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files.
This server cannot be installed
A Model Context Protocol server that provides a standardized interface for AI models and applications to interact with the Luno cryptocurrency exchange API for trading operations.
Related MCP Servers
- AsecurityAlicenseAqualityA Model Context Protocol server that provides read-only access to Bybit's cryptocurrency exchange API, allowing users to query real-time cryptocurrency data using natural language.Last updated -95TypeScriptMIT License
- AsecurityAlicenseAqualityA Model Context Protocol server implementation that enables AI assistants to interact with the Paradex perpetual futures trading platform, allowing for retrieving market data, managing trading accounts, placing orders, and monitoring positions.Last updated -284PythonMIT License
- AsecurityFlicenseAqualityA Model Context Protocol server that enables AI assistants to interact with the Deriv trading API, providing access to active trading symbols and account balance information.Last updated -2Python
- AsecurityFlicenseAqualityA Model Context Protocol server that provides access to CoinMarketCap's cryptocurrency data, enabling AI applications to retrieve cryptocurrency listings, quotes, and detailed information.Last updated -310Python