Complete implementation examples for integrating Spike’s MCP server with AI providers
Integrate Spike’s health data into AI applications using the Model Context Protocol (MCP). The examples below show complete implementations for OpenAI and Anthropic clients, including authentication, server configuration, and data querying.
curl -X POST "https://api.openai.com/v1/responses" \ -H "Authorization: Bearer OPENAPI_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "o4-mini", "instructions": "you are a health and wellness analyst.", "input": "Analyze my health data for 2025-08-17 and provide a summary of my health data.", "tools": [ { "type": "mcp", "server_label": "spike-health-data", "server_url": "https://app-api.spikeapi.com/v3/mcp", "headers": { "Authorization": "Bearer SPIKE_ACCESS_TOKEN" }, "server_description": "Health and fitness data analysis server providing daily and hourly statistics from connected wearables and health devices.", "require_approval": "never" } ], "tool_choice": "auto", "max_tool_calls": 1, "max_output_tokens": 5000, "parallel_tool_calls": true, "metadata": { "analysis_type": "daily_health_review", "date": "2025-08-17", "tools_used": "mcp_health_data", "version": "1.0.0" } }'