Skip to main content

What is MCP?

The Model Context Protocol (MCP) is a JSON-RPC 2.0 interface that enables AI agents and applications to discover and interact with Mirobody Health’s tools and resources. It provides a standardized way for LLMs to access health data, call functions, and retrieve contextual information.
MCP Endpoint: http://localhost:18080/mcp (public) or http://localhost:18080/mcp/{user_secret} (user-specific)Protocol Version: 2025-06-18

Key Concepts

Tools

Callable functions that perform actions (e.g., fetch health data, render charts, link providers)

Resources

Read-only data sources that provide context (e.g., user profiles, chart templates, upload forms)

JSON-RPC 2.0

Standard protocol for remote procedure calls with request/response format

Authentication

JWT-based authentication with optional OAuth flow for tool authorization

MCP Methods

The MCP service supports the following standard methods:
MethodDescription
initializeHandshake to establish protocol version and capabilities
tools/listList all available tools
tools/callExecute a specific tool
resources/listList all available resources
resources/readRead a specific resource
prompts/listList available prompt templates
prompts/getGet a specific prompt template

Authentication

MCP endpoints support two authentication modes:
Some tools require authentication. If called without valid credentials, they return an OAuth flow URL for user authorization.

Example: Initialize

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "initialize",
  "params": {
    "protocolVersion": "2025-06-18",
    "clientInfo": {
      "name": "MyHealthApp",
      "version": "1.0.0"
    }
  }
}

Example: List Tools

{
  "jsonrpc": "2.0",
  "id": 2,
  "method": "tools/list"
}

Example: Call Tool

{
  "jsonrpc": "2.0",
  "id": 3,
  "method": "tools/call",
  "params": {
    "name": "get_health_data",
    "arguments": {
      "user_id": "user_123",
      "indicator": "steps",
      "start_date": "2024-01-01",
      "end_date": "2024-01-07"
    }
  }
}

Error Handling

MCP uses standard JSON-RPC 2.0 error codes:
CodeNameDescription
-32700Parse errorInvalid JSON
-32600Invalid RequestMissing required fields
-32601Method not foundUnknown method
-32602Invalid paramsInvalid method parameters
-32603Internal errorServer-side error
-32000Auth requiredAuthentication needed
{
  "jsonrpc": "2.0",
  "id": 4,
  "error": {
    "code": -32000,
    "message": "Authentication required",
    "data": {
      "authorization_url": "http://localhost:18080/mcplogin?...",
      "instructions": "Please authenticate to access this tool"
    }
  }
}

Tool Categories

Mirobody Health MCP tools are organized into categories:

Next Steps