Skip to main content

MCP server for HidrateSpark smart water bottle API integration

Project description

HidrateSpark MCP Server

Model Context Protocol (MCP) server for HidrateSpark smart water bottle API integration.

Track hydration, analyze water intake patterns, and manage your HidrateSpark data directly through Claude Desktop.

Features

  • Bottle Management: List registered bottles with battery, capacity, and firmware info
  • Hydration Tracking: Query water intake by date or date range
  • Daily Summaries: Get daily totals, goals, and progress percentages
  • Weekly Analytics: 7-day breakdown with daily averages
  • Manual Logging: Add manual sip entries for water from other sources
  • Session Caching: Efficient authentication with in-memory token caching

Installation

1. Clone or Download

cd ~/Desktop/Projects/04-Personal-Tools
git clone https://github.com/yourusername/hidratespark-mcp.git
cd hidratespark-mcp

2. Install Package

pip install -e .

Or with uv:

uvx --from . hidratespark-mcp

3. Configure Environment Variables

Copy the example configuration:

cp .env.example .env

Edit .env with your credentials:

# API Keys (use provided defaults or extract from APK)
HIDRATE_APP_ID=a5Il6d0n6WWkLQwBzlxvpF5P7PEkUYkX045CRgwM
HIDRATE_CLIENT_KEY=mWasknCNtr9dSQGPwUBWb5u4Ilf8Qkeqkwz9Q4eL

# Your HidrateSpark Account
HIDRATE_EMAIL=your.email@example.com
HIDRATE_PASSWORD=your_password_here

4. Add to Claude Desktop

Option A: Global Configuration (available in all projects)

Edit your Claude Desktop config (~/Library/Application Support/Claude/claude_desktop_config.json on macOS):

{
  "mcpServers": {
    "hidratespark": {
      "command": "python",
      "args": ["-m", "hidratespark_mcp.server"],
      "env": {
        "HIDRATE_APP_ID": "a5Il6d0n6WWkLQwBzlxvpF5P7PEkUYkX045CRgwM",
        "HIDRATE_CLIENT_KEY": "mWasknCNtr9dSQGPwUBWb5u4Ilf8Qkeqkwz9Q4eL",
        "HIDRATE_EMAIL": "your.email@example.com",
        "HIDRATE_PASSWORD": "your_password_here"
      }
    }
  }
}

Or with uvx:

{
  "mcpServers": {
    "hidratespark": {
      "command": "uvx",
      "args": ["--from", "/Users/yourusername/Desktop/Projects/04-Personal-Tools/hidratespark-mcp", "hidratespark-mcp"],
      "env": {
        "HIDRATE_APP_ID": "a5Il6d0n6WWkLQwBzlxvpF5P7PEkUYkX045CRgwM",
        "HIDRATE_CLIENT_KEY": "mWasknCNtr9dSQGPwUBWb5u4Ilf8Qkeqkwz9Q4eL",
        "HIDRATE_EMAIL": "your.email@example.com",
        "HIDRATE_PASSWORD": "your_password_here"
      }
    }
  }
}

Option B: Project-Specific Configuration (available only in this project)

Copy the example config:

cp .claude/mcp.json.example .claude/mcp.json

Edit .claude/mcp.json with your credentials and correct Python path.

Important: .claude/mcp.json is git-ignored to protect your credentials.


Restart Claude Desktop.

Available Tools

hidrate_get_bottles

Get list of registered HidrateSpark bottles.

Parameters: None

Returns: Array of bottles with name, capacity, battery level, serial number, firmware version, glow settings.

Example:

Show me my HidrateSpark bottles

hidrate_get_sips

Get water intake sips for a specific date or date range.

Parameters:

  • date (optional): Specific date in YYYY-MM-DD format
  • start_date (optional): Range start in YYYY-MM-DD format
  • end_date (optional): Range end in YYYY-MM-DD format
  • limit (optional): Max results (default: 100, max: 500)

Returns: Array of sips with timestamp, amount (ml), manual/sensor indicator, hydration impact.

Examples:

How much water did I drink today?
Show me all sips from January 15th
Get my water intake for the last week

hidrate_get_daily_summary

Get daily hydration summary with totals and progress.

Parameters:

  • date (optional): Date in YYYY-MM-DD format (default: today)

Returns: Total ml, goal ml, progress %, hydration score, hourly goals, weather data.

Examples:

How am I doing on my hydration goal today?
Show yesterday's hydration summary
Did I hit my water goal on January 18th?

hidrate_log_sip

Log a manual water intake entry.

Parameters:

  • amount_ml (required): Amount in milliliters
  • timestamp (optional): ISO 8601 timestamp (default: now)

Returns: Created sip with ID, amount, timestamp.

Examples:

Log 250ml of water I just drank
Add a manual entry for 500ml at 2pm today

hidrate_get_weekly_summary

Get weekly hydration summary with daily breakdown.

Parameters:

  • week_offset (optional): Week offset (0 = this week, -1 = last week, default: 0)

Returns: Week start/end dates, total week ml, daily average, daily breakdown with progress %.

Examples:

Show me this week's hydration stats
How did I do last week?
What's my weekly water intake average?

hidrate_get_profile

Get user profile information.

Parameters: None

Returns: Email, username, account creation date, session status.

Example:

Show my HidrateSpark profile

Available Resources

hidrate://today

Real-time access to today's hydration summary.

Returns: Current day total ml, goal ml, progress %.


hidrate://bottles

Quick access to registered bottles list.

Returns: Array of bottles with name, capacity, battery level.

Usage Examples

Daily Tracking

User: How much water have I drunk today?
Claude: [uses hidrate_get_daily_summary]

User: Show me all my sips from today
Claude: [uses hidrate_get_sips with date=today]

Weekly Analysis

User: How did my hydration look this week?
Claude: [uses hidrate_get_weekly_summary]

User: Compare this week to last week
Claude: [uses hidrate_get_weekly_summary with week_offset=0 and week_offset=-1]

Manual Logging

User: I just drank 300ml from a glass
Claude: [uses hidrate_log_sip with amount_ml=300]

Bottle Management

User: What's my bottle's battery level?
Claude: [uses hidrate_get_bottles]

How It Works

API Architecture

HidrateSpark uses Parse Server (Backend-as-a-Service) with REST API:

Session Token Caching

The client implements in-memory session token caching:

  1. First API call triggers login
  2. Session token stored in memory
  3. Subsequent calls reuse token
  4. No persistent storage (security best practice)

Critical Implementation Detail

The API has two timestamp fields:

  • time: When the sip actually occurred (authoritative)
  • createdAt: When the sip synced to cloud

This server correctly filters on time to avoid data inconsistencies when bottles sync late.

Troubleshooting

Authentication Errors

{"error": "Invalid username/password"}

Solution: Verify HIDRATE_EMAIL and HIDRATE_PASSWORD in your config.


Empty Results

{"count": 0, "sips": []}

Possible causes:

  • No data for requested date
  • Bottle hasn't synced recently
  • Date format incorrect (use YYYY-MM-DD)

API Keys Changed

If you get 403/unauthorized errors with default keys:

  1. Download latest HidrateSpark APK from APKMirror
  2. Decompile with apktool: apktool d hidratespark.apk
  3. Extract keys from com/hidratespark/hidrate/HidrateApplication.smali
  4. Update HIDRATE_APP_ID and HIDRATE_CLIENT_KEY

Development

Project Structure

hidratespark-mcp/
├── hidratespark_mcp/
│   ├── __init__.py       # Package metadata
│   ├── client.py         # HidrateSpark API client
│   └── server.py         # MCP server implementation
├── pyproject.toml        # Project config
├── .env.example          # Config template
└── README.md

Running Tests

# Install dev dependencies
pip install -e ".[dev]"

# Run tests (when implemented)
pytest

Code Quality

# Format code
black hidratespark_mcp/

# Lint
ruff check hidratespark_mcp/

Reverse Engineering Notes

This server was created by reverse engineering the official HidrateSpark Android app:

  1. APK Decompilation: Used apktool to extract smali bytecode
  2. Key Extraction: Found Parse API keys in HidrateApplication.smali
  3. Endpoint Discovery: Parsed Retrofit annotations to map API endpoints
  4. Testing: Validated all endpoints with real account data

Extracted API Keys

// From HidrateApplication.smali lines 507-514
Application-Id: a5Il6d0n6WWkLQwBzlxvpF5P7PEkUYkX045CRgwM
Client-Key: mWasknCNtr9dSQGPwUBWb5u4Ilf8Qkeqkwz9Q4eL

These keys are embedded in the public Android app and shared across all users.

Privacy & Security

  • No data storage: This server doesn't store any hydration data
  • Session tokens: In-memory only, cleared on server restart
  • Credentials: Never logged or transmitted beyond Parse API
  • Open source: All code available for security review

License

MIT License - see LICENSE file for details

Contributing

Contributions welcome! Please:

  1. Fork the repository
  2. Create a feature branch
  3. Add tests for new functionality
  4. Submit a pull request

Acknowledgments

  • HidrateSpark LLC for the smart water bottle
  • Parse Server for the BaaS platform
  • MCP protocol by Anthropic

Disclaimer

This is an unofficial reverse-engineered client. Not affiliated with or endorsed by HidrateSpark LLC. Use at your own risk. API keys and endpoints may change without notice.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hidratespark_mcp-1.0.1.tar.gz (14.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hidratespark_mcp-1.0.1-py3-none-any.whl (12.1 kB view details)

Uploaded Python 3

File details

Details for the file hidratespark_mcp-1.0.1.tar.gz.

File metadata

  • Download URL: hidratespark_mcp-1.0.1.tar.gz
  • Upload date:
  • Size: 14.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.8

File hashes

Hashes for hidratespark_mcp-1.0.1.tar.gz
Algorithm Hash digest
SHA256 65895e54965d22146321176129f39525d83fd3a88fbc2f6bdcfb11261afc7af5
MD5 f9ec141c00dae05156d488ccdb0832fa
BLAKE2b-256 adc9f3c29c8fb6fb309a0d34ba86aa65b139b5a0b9cc92601978173fc1dae05c

See more details on using hashes here.

File details

Details for the file hidratespark_mcp-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for hidratespark_mcp-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9e39731401d1546c56d1a4129535bf5765719fddbd0d29cc29a412097439e586
MD5 8b79b81eb1d813b9c8bdd0f7b7928b80
BLAKE2b-256 0bfbf39c4590a3d37999765ac2440a22d269933f915fb7dae40ac0075b093704

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page