Oura Ring MCP Server

Oura Ring MCP Server

A Model Context Protocol server that provides access to Oura Ring health and fitness data through the Oura API v2, enabling retrieval of sleep, activity, readiness, and other health metrics.

Category
访问服务器

README

Oura Ring MCP Server

A Model Context Protocol (MCP) server that provides access to Oura Ring health and fitness data through the Oura API v2.

Features

This MCP server exposes all major Oura Ring data types as tools:

Health & Fitness Data

  • Personal Info - User profile information (age, weight, height, biological sex, timezone)
  • Sleep Data - Sleep scores, sleep stages, sleep contributors
  • Activity Data - Steps, calories, activity levels, MET minutes
  • Readiness Data - Daily readiness scores and contributing factors
  • Heart Rate - Heart rate measurements with timestamps and sources

Daily Summaries

  • Daily Activity - Daily activity summaries with scores and metrics
  • Daily Sleep - Daily sleep summaries with scores and contributors
  • Daily Readiness - Daily readiness summaries with temperature data
  • Daily Stress - Daily stress levels and recovery metrics

Sessions & Workouts

  • Workouts - Exercise sessions with activity type, duration, calories, distance
  • Sessions - Breathing exercises, meditation, naps, relaxation sessions
  • Tags - User-created tags and enhanced tags with metadata

Configuration & Time Data

  • Sleep Time - Bedtime and wake time data
  • Rest Mode Periods - Rest mode periods when enabled
  • Ring Configuration - Ring settings and preferences

Webhooks (Advanced)

  • Webhook Management - Create, list, and delete webhook subscriptions for real-time data updates

Installation

  1. Clone this repository:
git clone <repository-url>
cd oura-ring-mcp
  1. Install dependencies:
npm install
  1. Build the project:
npm run build

Configuration

1. Get Your Oura Access Token

For personal use, create a Personal Access Token:

  1. Go to Oura Cloud Personal Access Tokens
  2. Click "Create New Personal Access Token"
  3. Copy the generated token

2. Environment Setup

Create a .env file in the project root:

# Required: Your Oura Ring Personal Access Token
OURA_ACCESS_TOKEN=your_personal_access_token_here

# Optional: For webhook functionality only
OURA_CLIENT_ID=your_client_id_here
OURA_CLIENT_SECRET=your_client_secret_here

# Optional: Override the default API base URL (usually not needed)
# OURA_BASE_URL=https://api.ouraring.com

3. For Webhook Functionality (Optional)

If you want to use webhooks for real-time data updates:

  1. Register an API Application at Oura Cloud OAuth Applications
  2. Add your OURA_CLIENT_ID and OURA_CLIENT_SECRET to the .env file

Usage

Testing Locally

  1. Test server setup (no API calls needed):
npm test
  1. Test API connectivity (requires your Oura access token):
npm run test:api

This will test actual API calls to verify your credentials and show sample data.

Running the MCP Server

Start the MCP server for use with MCP clients:

npm start

Or run in development mode:

npm run dev

Note: The server runs on stdio transport and waits for MCP protocol messages. You need an MCP client (like Claude Desktop, Continue, or other MCP-compatible tools) to interact with it.

Available Tools

Personal Information

  • get_personal_info - Get user personal information

Sleep & Readiness

  • get_sleep - Get sleep data with optional date range
  • get_daily_sleep - Get daily sleep summaries
  • get_readiness - Get readiness data
  • get_daily_readiness - Get daily readiness summaries

Activity & Exercise

  • get_activity - Get activity data
  • get_daily_activity - Get daily activity summaries
  • get_workouts - Get workout sessions
  • get_heart_rate - Get heart rate measurements

Sessions & Wellness

  • get_sessions - Get breathing, meditation, and nap sessions
  • get_daily_stress - Get daily stress and recovery data
  • get_tags - Get user-created tags
  • get_enhanced_tags - Get enhanced tags with metadata

Time & Configuration

  • get_sleep_time - Get bedtime and wake time data
  • get_rest_mode_periods - Get rest mode periods
  • get_ring_configuration - Get ring settings

Webhooks (Advanced)

  • get_webhook_subscriptions - List active webhook subscriptions
  • create_webhook_subscription - Create new webhook subscription
  • delete_webhook_subscription - Delete webhook subscription

Date Range Parameters

Most tools accept optional date range parameters:

  • start_date - Start date in YYYY-MM-DD format
  • end_date - End date in YYYY-MM-DD format
  • next_token - Pagination token for large datasets

Example:

{
  "start_date": "2024-01-01",
  "end_date": "2024-01-31"
}

API Reference

This MCP server is built on the Oura API v2. Key features:

Authentication

  • Uses Bearer token authentication with Personal Access Tokens
  • Webhook operations require OAuth2 application credentials

Rate Limits

  • 5000 requests per 5-minute period
  • Webhooks are recommended to minimize API calls

Data Types

All data is returned as structured JSON with proper typing and validation using Zod schemas.

Error Handling

  • Comprehensive error handling for API errors, network issues, and invalid responses
  • Detailed error messages with status codes when available

Webhooks

Webhooks provide real-time notifications when your Oura data changes. This is the recommended approach for applications that need up-to-date data.

Setting Up Webhooks

  1. Ensure you have OURA_CLIENT_ID and OURA_CLIENT_SECRET configured
  2. Use the create_webhook_subscription tool with:
    • callback_url - Your endpoint URL (must be HTTPS)
    • verification_token - Secret token for verification
    • event_type - Type of events ('create', 'update', 'delete')
    • data_type - Type of data ('sleep', 'activity', etc.)

Webhook Data Types

  • tag - User tags
  • enhanced_tag - Enhanced tags with metadata
  • workout - Exercise sessions
  • session - Breathing, meditation, nap sessions
  • sleep - Sleep data
  • daily_sleep - Daily sleep summaries
  • daily_readiness - Daily readiness summaries
  • daily_activity - Daily activity summaries
  • daily_stress - Daily stress data

Development

Project Structure

src/
├── types.ts          # TypeScript types and Zod schemas
├── oura-client.ts    # Oura API client implementation
├── server.ts         # MCP server implementation
└── index.ts          # Main entry point

test/
├── test.ts           # Basic server instantiation test
├── manual-test.ts    # API connectivity test with real credentials
└── debug-test.ts     # Raw API response debugging tool

Building

npm run build

Testing

# Test server instantiation (no API calls)
npm test

# Test actual API connectivity with your credentials
npm run test:api

Linting

npm run lint

Troubleshooting

Common Issues

"Invalid or expired authentication token"

  • Check that your OURA_ACCESS_TOKEN is correct
  • Verify the token hasn't expired
  • Ensure you're using a Personal Access Token from the correct Oura account

"Access forbidden" (403 error)

  • Your Oura subscription may have expired
  • Some data types require an active Oura subscription

Rate limit exceeded (429 error)

  • You've exceeded 5000 requests in 5 minutes
  • Consider using webhooks to reduce API calls
  • Implement proper rate limiting in your application

Webhook verification failed

  • Ensure your webhook endpoint properly handles the verification challenge
  • Check that your verification_token matches what you provided
  • Verify your endpoint responds with the challenge in the correct format

License

MIT License - see LICENSE file for details.

Contributing

Contributions are welcome! Please read the contributing guidelines and submit pull requests for any improvements.

Links

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选