< back to profile

the-goodies

Smart Home Knowledge Graph Distributed MCP Library for Swift iOS and Python Backend

Pythonrepo ->Apr 2, 2026
the-goodies screenshot

The Goodies - Smart Home Knowledge Graph System

๐Ÿ  Overview

The Goodies is a modern smart home knowledge graph data store layer built around the Model Context Protocol (MCP) architecture. The system provides a unified interface for managing smart home devices, relationships, and automations through a graph-based data model.

Current Status: โœ… Production Ready - All tests passing (225/225), comprehensive MCP functionality, full client-server synchronization, and enterprise-grade security features.

Related Projects: adrianco/consciousness is an early prototype of the backend server that will be rewritten from scratch later. adrianco/c11s-house-ios is a native Swift iOS app that is the front end for the system. This repo is the knowledge graph protocol that will interface the app to the backend, and includes a command line client in Python that acts as a prototype implementation for the next phase, adrianco/the-goodies-swift, which will be integrated with adrianco/c11s-house-ios.

๐Ÿ—๏ธ Architecture

Core Components

  1. ๐Ÿš€ FunkyGibbon (Server) - Python-based backend server

    • FastAPI REST API with graph operations
    • 12 MCP tools for smart home management
    • Entity-relationship knowledge graph
    • SQLite database with immutable versioning
    • Security: JWT authentication, rate limiting, audit logging
    • Access Control: Admin and guest roles with QR code access
  2. ๐Ÿ“ฑ Blowing-Off (Client) - Python synchronization client

    • Real-time sync with server
    • Local graph operations and caching
    • CLI interface matching server functionality
    • Conflict resolution and offline queue
  3. ๐Ÿ› ๏ธ Oook (CLI) - Development and testing CLI

    • Direct server MCP tool access
    • Graph exploration and debugging
    • Database population and management
  4. ๐Ÿ”— Inbetweenies (Protocol) - Shared synchronization protocol

    • Entity and relationship models
    • MCP tool implementations
    • Conflict resolution strategies
    • Graph operations abstraction

๐Ÿš€ Quick Start

Prerequisites

  • Python 3.11 or higher
  • pip package manager
  • curl (for testing authentication)

Installation Options

Option 1: Quick Install (Recommended)

bash
# Navigate to project root
cd /workspaces/the-goodies
 
# Run installer for development mode
./install.sh --dev
 
# Or run installer for production mode (will prompt for password)
./install.sh

Option 2: Manual Setup

bash
# Navigate to project root
cd /workspaces/the-goodies
 
# Set Python path (required)
export PYTHONPATH=/workspaces/the-goodies:$PYTHONPATH
 
# Install dependencies
cd funkygibbon && pip install -r requirements.txt && cd ..
cd inbetweenies && pip install -e . && cd ..
cd oook && pip install -e . && cd ..
cd blowing-off && pip install -e . && cd ..
 
# Configure security
export ADMIN_PASSWORD_HASH=""  # For dev mode with "admin" password
export JWT_SECRET="development-secret"
 
# Populate database
cd funkygibbon && python populate_graph_db.py && cd ..

Starting the System

bash
# If you used the installer:
./start_funkygibbon.sh
 
# If you did manual setup:
python -m funkygibbon
 
# In another terminal, test with Oook CLI
oook stats
oook search "smart"
oook tools

5. First Time Authentication

bash
# Login as admin (password is "admin" in dev mode)
curl -X POST http://localhost:8000/api/v1/auth/admin/login \
  -H "Content-Type: application/json" \
  -d '{"password": "admin"}'
 
# Response will include an access token:
# {
#   "access_token": "eyJhbGciOiJIUzI1NiIs...",
#   "token_type": "bearer",
#   "expires_in": 604800,
#   "role": "admin"
# }
 
# Save the token for API requests
export AUTH_TOKEN="<your-access-token>"
 
# Test authenticated access
curl http://localhost:8000/api/v1/auth/me \
  -H "Authorization: Bearer $AUTH_TOKEN"

๐Ÿ› ๏ธ MCP Tools (12 Available)

The system provides 12 Model Context Protocol tools for smart home management:

ToolDescriptionParameters
get_devices_in_roomFind all devices in a specific roomroom_id
find_device_controlsGet controls for a devicedevice_id
get_room_connectionsFind connections between roomsroom_id
search_entitiesSearch entities by name/contentquery, entity_types, limit
create_entityCreate new entityentity_type, name, content
create_relationshipLink entitiesfrom_entity_id, to_entity_id, relationship_type
find_pathFind path between entitiesfrom_entity_id, to_entity_id
get_entity_detailsGet detailed entity infoentity_id
find_similar_entitiesFind similar entitiesentity_id, threshold
get_procedures_for_deviceGet device proceduresdevice_id
get_automations_in_roomGet room automationsroom_id
update_entityUpdate entity (versioned)entity_id, changes, user_id

๐Ÿ“Š Entity Types

The knowledge graph supports these entity types:

  • HOME - Top-level container
  • ROOM - Physical spaces
  • DEVICE - Smart devices and appliances
  • ZONE - Logical groupings
  • DOOR/WINDOW - Connections
  • PROCEDURE - Instructions
  • MANUAL - Documentation
  • NOTE - User annotations (including photo documentation)
  • SCHEDULE - Time-based rules
  • AUTOMATION - Event-based rules
  • APP - Mobile/web applications that control devices

๐Ÿ”„ Client Synchronization

Blowing-off Client Usage

bash
# First, ensure Python path is set (required for finding inbetweenies)
export PYTHONPATH=/workspaces/the-goodies:$PYTHONPATH
 
# Get an auth token by logging in as admin
curl -X POST http://localhost:8000/api/v1/auth/admin/login \
  -H "Content-Type: application/json" \
  -d '{"password": "admin"}' | jq -r '.access_token'
 
# Connect to server with the token
blowing-off connect --server-url http://localhost:8000 --auth-token <your-token> --client-id device-1
 
# Check status
blowing-off status
 
# Synchronize with server
blowing-off sync
 
# Use MCP tools locally
blowing-off tools
blowing-off search "smart"
blowing-off execute get_devices_in_room -a room_id="room-123"

๐Ÿงช Testing

The system has comprehensive test coverage:

  • Unit Tests: 150+ passing
  • Integration Tests: 40+ passing
  • Security Tests: 21 passing
  • Performance Tests: 10 passing
  • E2E Tests: 10 passing
  • UGC Tests: 14 passing
  • Total: 225 tests passing (60% coverage)
bash
# Run all tests
python -m pytest -v
 
# Run with coverage
python -m pytest --cov=funkygibbon --cov=blowingoff --cov=inbetweenies --cov-report=term-missing
 
# Run security tests only
python -m pytest tests/auth/ -v

๐Ÿ“ Project Structure

plaintext
the-goodies/
โ”œโ”€โ”€ funkygibbon/          # Server (Python FastAPI)
โ”‚   โ”œโ”€โ”€ api/             # REST API routes
โ”‚   โ”œโ”€โ”€ mcp/             # MCP server implementation  
โ”‚   โ”œโ”€โ”€ graph/           # Graph operations
โ”‚   โ”œโ”€โ”€ repositories/    # Data access layer
โ”‚   โ””โ”€โ”€ tests/           # Comprehensive test suite
โ”œโ”€โ”€ blowing-off/         # Client (Python)
โ”‚   โ”œโ”€โ”€ cli/             # Command line interface
โ”‚   โ”œโ”€โ”€ sync/            # Synchronization engine
โ”‚   โ”œโ”€โ”€ graph/           # Local graph operations
โ”‚   โ””โ”€โ”€ tests/           # Unit and integration tests
โ”œโ”€โ”€ oook/                # CLI tool (Python)
โ”‚   โ”œโ”€โ”€ oook/            # CLI implementation
โ”‚   โ””โ”€โ”€ examples/        # Usage examples
โ”œโ”€โ”€ inbetweenies/        # Shared protocol (Python)
โ”‚   โ”œโ”€โ”€ models/          # Entity and relationship models
โ”‚   โ”œโ”€โ”€ mcp/             # MCP tool implementations
โ”‚   โ””โ”€โ”€ sync/            # Synchronization protocol
โ””โ”€โ”€ plans/               # Documentation and plans
    โ””โ”€โ”€ archive/         # Archived documentation

๐ŸŒŸ Key Features

  • โœ… MCP Protocol Support - 12 standardized tools
  • โœ… Graph-based Data Model - Flexible entity relationships
  • โœ… Real-time Synchronization - Client-server sync
  • โœ… Immutable Versioning - Complete change history
  • โœ… Conflict Resolution - Multiple strategies available
  • โœ… Search & Discovery - Full-text entity search
  • โœ… CLI Interface - Both server and client CLIs
  • โœ… Production Ready - 225 tests passing (including 14 UGC tests), 60% coverage
  • โœ… User Generated Content - Support for PDFs, photos, and user notes
  • โœ… BLOB Storage - Binary data storage with sync capabilities
  • โœ… Device-App Integration - Link devices to their control apps

๐Ÿ“ธ User Generated Content (UGC) Features

The system supports comprehensive User Generated Content functionality for storing and managing device documentation, photos, and user notes:

UGC Entity Types

APP Entity Type

  • Store mobile/web applications that control smart devices
  • Link apps to devices using CONTROLLED_BY_APP relationship
  • Track app metadata (platform, URL scheme, icon, description)

BLOB Storage

  • Binary large object storage for PDFs and photos
  • Support for multiple blob types: PDF, JPEG, PNG, and generic binary
  • Automatic checksum generation (SHA-256)
  • Sync status tracking (pending upload, uploaded, downloaded)
  • Metadata storage for structured information

User Notes

  • Free-form text notes with categorization
  • Link notes to devices using DOCUMENTED_BY relationship
  • Support for device references within notes
  • Photo documentation with blob references

Key UGC Features

PDF Document Management

  • Store device manuals and instruction books
  • Automatic summary generation from PDF content
  • Model number extraction from filenames
  • Link manuals to specific devices
  • Full-text searchable content

Photo Documentation

  • Store installation photos and serial numbers
  • Extract metadata from photo files
  • Categorize photos by type (serial_number, installation, etc.)
  • Link photos to devices with HAS_BLOB relationship
  • Support for JPEG and PNG formats

Mitsubishi Thermostat Integration

  • Specialized support for Mitsubishi PAR-42MAA thermostats
  • Store thermostat capabilities and configuration
  • Link to Mitsubishi Comfort mobile app
  • Track integration details (WiFi adapter, features)

UGC API Usage Examples

python
# Create an APP entity
app = Entity(
    entity_type=EntityType.APP,
    name="Mitsubishi Comfort",
    content={
        "platform": "iOS",
        "url_scheme": "mitsubishicomfort://",
        "description": "Control Mitsubishi HVAC systems"
    }
)
 
# Create a BLOB for PDF storage
pdf_blob = Blob(
    name="PAR-42MAAUB_Manual.pdf",
    blob_type=BlobType.PDF,
    mime_type="application/pdf",
    data=pdf_bytes,
    blob_metadata={"pages": 50, "model": "PAR-42MAAUB"}
)
 
# Create a user NOTE with photo references
photo_note = Entity(
    entity_type=EntityType.NOTE,
    name="Installation Photos",
    content={
        "content": "Photos from HVAC installation",
        "category": "photo_documentation",
        "has_blob": True,
        "blob_references": ["blob_id_1", "blob_id_2"]
    }
)
 
# Link device to app
relationship = EntityRelationship(
    from_entity_id=device.id,
    to_entity_id=app.id,
    relationship_type=RelationshipType.CONTROLLED_BY_APP,
    properties={"integration": "wifi_adapter"}
)

UGC Relationship Types

  • CONTROLLED_BY_APP - Device controlled by mobile/web app
  • DOCUMENTED_BY - Entity documented by note or manual
  • HAS_BLOB - Entity has associated binary data

๐Ÿ” Security Features (Phase 5)

The system includes enterprise-grade security features that have been fully implemented and tested:

Core Security Features

  • โœ… Authentication System - Admin password login with Argon2id hashing
  • โœ… JWT Tokens - Secure token-based API access with configurable expiration
  • โœ… Rate Limiting - Brute force protection (5 attempts/5 min window)
  • โœ… Audit Logging - Comprehensive security event tracking with 15 event types
  • โœ… Guest Access - QR code-based temporary read-only access
  • โœ… Progressive Delays - Increasing lockout periods (up to 5x) for repeated failures
  • โœ… Permission System - Role-based access control (admin/guest)

Security Configuration

1. Development Setup (Quick Start)

bash
# For development/testing - uses "admin" as the default password
export ADMIN_PASSWORD_HASH=""
export JWT_SECRET="development-secret"
 
# Start the server
python -m funkygibbon

2. Production Setup (Secure)

bash
# Option A: Use the installer (recommended)
./install.sh
# The installer will:
# - Prompt for a secure admin password
# - Generate password hash automatically
# - Create a secure JWT secret
# - Set up start_funkygibbon.sh with your configuration
 
# Option B: Manual setup
# Step 1: Generate a secure password hash
python -c "from funkygibbon.auth import PasswordManager; pm = PasswordManager(); print(pm.hash_password('YourSecurePassword123!'))"
 
# Step 2: Set environment variables with generated values
export ADMIN_PASSWORD_HASH="$argon2id$v=19$m=65536,t=2,p=1$..."  # Use output from step 1
export JWT_SECRET="$(openssl rand -hex 32)"  # Generate secure random string
 
# Step 3: Start the server
python -m funkygibbon

3. Security Environment Variables

VariableDescriptionDefaultProduction Recommendation
ADMIN_PASSWORD_HASHArgon2id hash of admin passwordEmpty (dev mode)Required - use strong password
JWT_SECRETSecret key for signing JWT tokens"development-secret"Required - use random 32+ chars
RATE_LIMIT_ATTEMPTSMax login attempts per window53-5 recommended
RATE_LIMIT_WINDOWTime window in seconds300 (5 min)300-900 recommended
AUDIT_LOG_FILEPath to security audit log"security_audit.log"Secure location with rotation

Authentication Usage

Admin Login

bash
# Login with admin password
curl -X POST http://localhost:8000/api/v1/auth/admin/login \
  -H "Content-Type: application/json" \
  -d '{"password": "admin"}'
 
# Save the access token from response
export AUTH_TOKEN="<access-token-from-response>"
 
# Use token for authenticated requests
curl http://localhost:8000/api/v1/auth/me \
  -H "Authorization: Bearer $AUTH_TOKEN"

Guest Access (QR Code)

bash
# Generate guest QR code (requires admin token)
curl -X POST http://localhost:8000/api/v1/auth/guest/generate-qr \
  -H "Authorization: Bearer $AUTH_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"duration_hours": 24}'
 
# Response includes QR code image and guest token

Security Implementation Details

Rate Limiting

  • Protection: Prevents brute force attacks on authentication endpoints
  • Configuration: 5 attempts allowed per 5-minute window per IP address
  • Progressive Delays: Failed attempts result in increasing lockout periods (up to 5x)
  • Response: HTTP 429 (Too Many Requests) with Retry-After header
  • Automatic Cleanup: Old rate limit entries cleaned up hourly

Audit Logging

  • Coverage: All authentication attempts, token operations, and permission checks
  • Event Types: 15 different security events tracked including:
    • Authentication success/failure/lockout
    • Token creation/verification/expiration
    • Permission grants/denials
    • Guest access generation
    • Suspicious pattern detection
  • Format: Structured JSON logs for easy analysis
  • Pattern Detection: Automatic detection of credential stuffing and repeated failures
  • Location: Logs written to security_audit.log (configurable)

๐Ÿ“š Documentation

๐ŸŽฏ Status: Production Ready

The system is fully functional with:

  • 225/225 tests passing (including UGC features)
  • Complete MCP tool suite working
  • Client-server synchronization operational
  • Full human testing scenarios verified
  • User Generated Content support (PDFs, photos, notes)
  • BLOB storage with sync capabilities
  • Zero remaining issues

Ready for deployment and use! ๐Ÿš€

Command Palette

Search hackers, navigate pages