Skip to main content

External service integrations, utilities, and MCP server for HACS

Project description

HACS Utils

MCP server and essential utilities for Healthcare Agent Communication Standard

Provides the Model Context Protocol server and core utilities for healthcare AI agent integration.

🌐 MCP Server

The core HACS MCP server provides 25+ healthcare tools via JSON-RPC:

  • Port: 8000 (default)
  • Protocol: Model Context Protocol (MCP)
  • Interface: JSON-RPC 2.0
  • Tools: Healthcare-specific operations

Tool Categories

  • 🔍 Resource Discovery - Explore healthcare resources and schemas
  • 📋 Record Management - Full CRUD for clinical records
  • 🧠 Memory Management - Clinical memory and context
  • Validation & Schema - Data validation and schema tools
  • 🎨 Advanced Tools - LLM optimization and versioning
  • 📚 Knowledge Management - Clinical guidelines and protocols

🔗 Core Integrations

Database Storage

  • PostgreSQL - Primary database with healthcare schema
  • pgvector - Vector storage for clinical embeddings
  • Migration Support - Automated schema management

LLM Providers

  • Anthropic Claude - Healthcare-optimized AI (recommended)
  • OpenAI GPT - General purpose AI models
  • Environment-based - Auto-configuration from API keys

Agent Frameworks

  • LangGraph - AI agent workflows with memory
  • MCP Protocol - Standard tool calling interface

📦 Installation

pip install hacs-utils

🚀 Quick Start

Start MCP Server

# Via HACS setup
python setup.py --mode local

# MCP server runs on http://localhost:8000
curl http://localhost:8000/

Use Healthcare Tools

import requests

def call_tool(tool_name, arguments):
    """Call HACS MCP tools"""
    response = requests.post('http://localhost:8000/', json={
        "jsonrpc": "2.0",
        "method": "tools/call",
        "params": {
            "name": tool_name,
            "arguments": arguments
        },
        "id": 1
    })
    return response.json()

# List all available tools
tools = call_tool("tools/list", {})
print(f"Available tools: {len(tools['result']['tools'])}")

# Create patient record
patient = call_tool("create_hacs_record", {
    "resource_type": "Patient",
    "resource_data": {
        "full_name": "Sarah Johnson",
        "birth_date": "1985-03-15",
        "gender": "female"
    }
})

🏥 Healthcare Workflow Integration

Clinical Memory Management

# Store clinical memory
memory_result = call_tool("create_memory", {
    "content": "Patient reports significant improvement in symptoms after medication adjustment",
    "memory_type": "episodic",
    "importance_score": 0.9,
    "tags": ["medication_response", "symptom_improvement"]
})

# Search memories
search_result = call_tool("search_memories", {
    "query": "medication adjustment outcomes",
    "memory_type": "episodic",
    "limit": 5
})

Clinical Templates

# Generate assessment template
template = call_tool("create_clinical_template", {
    "template_type": "assessment",
    "focus_area": "cardiology",
    "complexity_level": "comprehensive"
})

⚙️ Configuration

Environment Variables

# Database
DATABASE_URL=postgresql://hacs:password@localhost:5432/hacs

# LLM Provider (choose one)
ANTHROPIC_API_KEY=sk-ant-...  # Recommended for healthcare
OPENAI_API_KEY=sk-...         # Alternative

# Vector Store
VECTOR_STORE=pgvector  # Recommended for healthcare compliance

# Organization
HACS_ORGANIZATION=your_health_system
HEALTHCARE_SYSTEM_NAME=Your Health System

MCP Server Configuration

# MCP server automatically starts with HACS setup
# Provides healthcare tools via JSON-RPC
# No additional configuration needed

🧠 LangGraph Integration

The optional LangGraph agent provides AI workflows with clinical memory:

# Start LangGraph agent (optional)
cd apps/hacs_developer_agent
uv run langgraph dev

# Agent runs on http://localhost:8001
# Automatically connects to MCP tools

📊 Performance

  • MCP Tools: <200ms average response time
  • Memory Search: <100ms for semantic queries
  • Record Operations: <50ms for CRUD operations
  • Tool Discovery: <10ms for tool listing

🔐 Security Features

  • Actor-based Security - Role-based access control
  • Audit Trails - Complete operation logging
  • Session Management - Secure authentication
  • Healthcare Compliance - HIPAA-aware design

🛠️ Development

Health Checks

# Check MCP server
curl http://localhost:8000/

# List available tools
curl -X POST -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","method":"tools/list","id":1}' \
  http://localhost:8000/

Custom Tool Development

# Tools are implemented in hacs_utils/mcp/tools.py
# Follow MCP protocol standards
# Focus on healthcare-specific functionality

📄 License

Apache-2.0 License - see LICENSE for details.

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

hacs_utils-0.3.0.tar.gz (65.1 kB view details)

Uploaded Source

Built Distribution

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

hacs_utils-0.3.0-py3-none-any.whl (72.4 kB view details)

Uploaded Python 3

File details

Details for the file hacs_utils-0.3.0.tar.gz.

File metadata

  • Download URL: hacs_utils-0.3.0.tar.gz
  • Upload date:
  • Size: 65.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for hacs_utils-0.3.0.tar.gz
Algorithm Hash digest
SHA256 561c1c700ba2020513c8fb7ab430d4c818f8dad018e3c296651ba5b9db2bde90
MD5 7d377d36ddf1d79adf3ab25fd3abc385
BLAKE2b-256 407bd355a99af9db9b68f2c9a9b600785206a6c347f381a805247b0c6e23694b

See more details on using hashes here.

File details

Details for the file hacs_utils-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: hacs_utils-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 72.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for hacs_utils-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f8ccca15c028bbbf4ce624a4ca57c9cfb02e26ed5eee63d665fb95e76b3874db
MD5 50f3facc350128b471d2f47e855b540f
BLAKE2b-256 6f1efd69c8f9acdd20c17094da247fef862ed9a66614a776316c70d471afe5ed

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