QUICKSTART.mdβ’5.91 kB
# EdgeLake MCP Server - Quick Start Guide
Get up and running with EdgeLake MCP Server in 5 minutes!
## Prerequisites Checklist
- [ ] Python 3.10+ installed
- [ ] EdgeLake node running and accessible
- [ ] Know your EdgeLake node IP and REST port
## Installation (3 steps)
### Step 1: Install Dependencies
```bash
cd edge_lake/mcp-server
pip install -r requirements.txt
```
### Step 2: Configure Connection
```bash
# Set environment variables (Linux/macOS)
export EDGELAKE_HOST=192.168.1.106
export EDGELAKE_PORT=32049
# Or on Windows PowerShell
$env:EDGELAKE_HOST="192.168.1.106"
$env:EDGELAKE_PORT="32049"
```
### Step 3: Test the Server
```bash
# Start server
python server.py
# In another terminal, test it
echo '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}' | python server.py
```
β
If you see tool definitions in the output, you're ready!
## Connect to Claude Desktop
### 1. Find Config File Location
**macOS:**
```bash
open ~/Library/Application\ Support/Claude/
```
**Windows:**
```cmd
explorer %APPDATA%\Claude
```
### 2. Edit `claude_desktop_config.json`
Add this (replace `/path/to/` with your actual path):
```json
{
"mcpServers": {
"edgelake": {
"command": "python",
"args": ["/Users/yourname/EdgeLake/edge_lake/mcp-server/server.py"],
"env": {
"EDGELAKE_HOST": "192.168.1.106",
"EDGELAKE_PORT": "32049"
}
}
}
}
```
**π‘ Tip**: Use absolute paths, not `~` or relative paths!
### 3. Restart Claude Desktop
Quit and reopen Claude Desktop.
### 4. Test in Claude
Try these prompts:
```
"What databases are available in EdgeLake?"
"Show me the tables in the iot_data database"
"Query the sensor_readings table for the last 10 readings"
"Get the average temperature by device from sensor_readings"
```
## Common Commands
### List All Resources (Databases & Tables)
Ask Claude:
```
"List all EdgeLake databases and tables"
```
Or manually:
```json
{"jsonrpc":"2.0","id":1,"method":"resources/list","params":{}}
```
### Get Table Schema
Ask Claude:
```
"What's the schema for the users table in mydb?"
```
Or manually:
```json
{
"jsonrpc":"2.0",
"id":2,
"method":"resources/read",
"params":{"uri":"database://mydb/users"}
}
```
### Execute Query
Ask Claude:
```
"Query mydb.users where is_active = true, limit 10"
```
Or manually:
```json
{
"jsonrpc":"2.0",
"id":3,
"method":"tools/call",
"params":{
"name":"query",
"arguments":{
"database":"mydb",
"table":"users",
"where":"is_active = true",
"limit":10
}
}
}
```
### Check Node Status
Ask Claude:
```
"What's the EdgeLake node status?"
```
Or manually:
```json
{
"jsonrpc":"2.0",
"id":4,
"method":"tools/call",
"params":{"name":"node_status","arguments":{}}
}
```
## Query Examples
### Simple Query
```
"Get 10 rows from sensor_readings"
```
Translates to:
```sql
SELECT * FROM sensor_readings LIMIT 10
```
### With Filter
```
"Get readings where temperature > 25"
```
Translates to:
```sql
SELECT * FROM sensor_readings WHERE temperature > 25 LIMIT 100
```
### Aggregation
```
"Show average temperature by device"
```
Translates to:
```sql
SELECT device_id, AVG(temperature) as avg_temp
FROM sensor_readings
GROUP BY device_id
```
### Sorted
```
"Get top 10 highest temperatures"
```
Translates to:
```sql
SELECT * FROM sensor_readings
ORDER BY temperature DESC
LIMIT 10
```
### Complex
```
"Show me the average, min, and max temperature per device for readings after Jan 1st 2025, sorted by average temperature"
```
Translates to:
```sql
SELECT device_id,
AVG(temperature) as avg_temp,
MIN(temperature) as min_temp,
MAX(temperature) as max_temp
FROM sensor_readings
WHERE timestamp >= '2025-01-01'
GROUP BY device_id
ORDER BY avg_temp DESC
```
## Troubleshooting Quick Fixes
### "Cannot connect to EdgeLake"
```bash
# Test EdgeLake directly
curl -H "User-Agent: anylog" \
-H "command: get status" \
http://192.168.1.106:32049
# If this fails, EdgeLake is not accessible
# Check: firewall, EdgeLake is running, correct IP/port
```
### "Module 'mcp' not found"
```bash
pip install mcp
```
### "Server not showing in Claude"
1. Check config file has correct absolute paths
2. Restart Claude Desktop completely (Quit, not just close window)
3. Check Claude logs for errors
### "No databases returned"
```bash
# Test EdgeLake command directly
curl -H "User-Agent: anylog" \
-H "command: get databases" \
http://192.168.1.106:32049
# If this returns databases, the MCP server should work
```
## Environment Variables Reference
| Variable | Default | Description |
|----------|---------|-------------|
| `EDGELAKE_HOST` | 127.0.0.1 | EdgeLake IP |
| `EDGELAKE_PORT` | 32049 | REST API port |
| `EDGELAKE_TIMEOUT` | 20 | Request timeout (sec) |
| `EDGELAKE_MAX_WORKERS` | 10 | Thread pool size |
| `LOG_LEVEL` | INFO | DEBUG, INFO, WARNING, ERROR |
## Next Steps
- π Read [README.md](README.md) for complete documentation
- π§ See [INSTALL.md](INSTALL.md) for detailed installation
- π‘ Check [examples/query_examples.md](examples/query_examples.md) for more queries
- ποΈ Review [Design/mcp_service.md](Design/mcp_service.md) for architecture
## Getting Help
**Check logs:**
```bash
tail -f edgelake_mcp.log
```
**Enable debug logging:**
```bash
export LOG_LEVEL=DEBUG
python server.py
```
**Test EdgeLake connection:**
```bash
curl -v -H "User-Agent: anylog" \
-H "command: get status" \
http://your-host:32049
```
**File an issue:**
- GitHub: https://github.com/EdgeLake/EdgeLake
- Documentation: https://edgelake.github.io
## Useful Links
- **EdgeLake Docs**: https://edgelake.github.io
- **MCP Specification**: https://modelcontextprotocol.io
- **MCP Servers**: https://github.com/modelcontextprotocol/servers
- **Claude Desktop**: https://claude.ai/desktop
---
**β¨ Happy Querying!**