A Python-based Rize.io API client and MCP (Model Context Protocol) server for integrating with the Rize time tracking application through Claude Desktop.
Current Core Feature: Create Session
The primary fully-implemented and thoroughly tested feature of this project is Create Session - a robust, production-ready capability. Other features are either in development or planned for future expansion.
create_session is the flagship implementation of this project, offering flexible and powerful work session creation:
-
Flexible Time Handling (4 Time Specification Modes)
- Both start and end time specified: Precise control over session timeframe
- Only start time specified: Automatically calculates end time based on duration
- Only end time specified: Automatically calculates start time based on duration
- No time specified: Uses current time as start, calculates end time from duration
-
Multi-Format Time Parsing
Supports the following ISO8601 time formats:
2024-07-21T09:00:00 2024-07-21 09:00:00 2024-07-21T09:00 2024-07-21 09:00 2024-07-21T09:00:00Z -
Session Type Support
focus- Focus work session (default)break- Break time
-
Optional Metadata
- Session title
- Session description
-
Flexible Duration Control
- Default duration: 90 minutes
- Customizable to any duration
import asyncio
from src.rize_client import RizeClient
async def main():
# Initialize client
client = RizeClient(
api_token="your_token_here",
api_url="https://api.rize.io/api/v1/graphql"
)
# Example 1: Create default session (current time, 90 minutes)
result = await client.create_session()
# Example 2: Specify start time and duration
result = await client.create_session(
session_type="focus",
title="Deep Work: Write Project Documentation",
description="Complete README and API docs",
duration_minutes=120,
start_time="2024-07-21T09:00:00"
)
# Example 3: Specify complete time range
result = await client.create_session(
session_type="focus",
title="Code Review Meeting",
start_time="2024-07-21T14:00:00",
end_time="2024-07-21T15:30:00"
)
print(result)
asyncio.run(main())In Claude Desktop, use natural language commands:
"Create a 2-hour focus session starting at 2pm titled 'Project Development'"
"Create a 90-minute work session starting now"
"Log a focus time block from 9am to 11am"
Code Location: src/rize_client.py:619-699
Core Function Signature:
async def create_session(
self,
session_type: str = "focus",
title: Optional[str] = None,
description: Optional[str] = None,
duration_minutes: int = 90,
start_time: Optional[str] = None,
end_time: Optional[str] = None
) -> Dict[str, Any]GraphQL Mutation Structure:
mutation CreateSession($input: CreateSessionInput!) {
createSession(input: $input) {
session {
id
title
description
createdAt
updatedAt
startTime
endTime
duration
sessionType
}
errors {
message
path
}
}
}Response Data Structure:
{
"id": "session_123abc",
"title": "Deep Work: Write Project Documentation",
"description": "Complete README and API docs",
"startTime": "2024-07-21T09:00:00Z",
"endTime": "2024-07-21T11:00:00Z",
"duration": 120,
"sessionType": "focus",
"createdAt": "2024-07-21T08:55:00Z",
"updatedAt": "2024-07-21T08:55:00Z"
}The following features are implemented but should be used with caution as they may require further testing and optimization:
test_connection- Verify API connection and authentication
list_projects- Retrieve project listcreate_project- Create new project (basic functionality)- Note: Update and delete project operations are coded but not fully tested
get_current_session- Retrieve current active session information- Note: Task create, update, and delete operations are coded but not fully tested
- Caution:
start_session_timer- Start session timer (partially functional, parameter structure may need adjustment) - Not Recommended:
stop_session_timer- Stop session timer (incomplete implementation, not recommended)
The following features are supported by the Rize API but not yet implemented in this project. They are listed as future expansion directions:
-
Enhanced Session Timer Control
- Improve reliability of start/stop timer operations
- Implement session pause/resume functionality
- Implement extend current session duration
-
Time Entry Management
- Create client/project/task-level time entries
- Update and delete time entries
- Time entry queries and statistics
-
Client Management
- Create and manage client information
- Associate projects with clients
- Client-level time statistics
-
Advanced Query Features
- App and website usage tracking
- Time categorization and summary statistics
- Time budget tracking and alerts
-
Data Analysis and Reports
- Work productivity analysis
- Time distribution visualization
- Custom report exports
-
Comprehensive Task Management
- Task priority settings
- Task status tracking
- Task time budget management
- Python 3.11+
- Conda (recommended) or virtualenv
-
Clone Repository
git clone <repository-url> cd rize-ai-scheduler
-
Create Conda Environment
conda env create -f environment.yml conda activate ClaudecodeDemo
Or use pip:
pip install -r requirements.txt
-
Configure Environment Variables
Copy
.env.exampleto.env:cp .env.example .env
Edit
.envfile and add your Rize API Token:RIZE_API_TOKEN=your_rize_api_token_here RIZE_API_URL=https://api.rize.io/api/v1/graphql DEBUG=False
Steps to Obtain API Token:
- Open Rize app
- Go to Settings > API
- Click "Generate new token"
- Copy token and paste into
.envfile
Verify create_session functionality:
python src/test_basic_api.pypython src/server_simple.pyrize-ai-scheduler/
├── src/
│ ├── rize_client.py # Rize API client core implementation
│ ├── server_simple.py # MCP server (Claude Desktop integration)
│ └── test_basic_api.py # Basic functionality tests
├── .env.example # Environment variable template
├── requirements.txt # Python dependencies
├── environment.yml # Conda environment configuration
├── RizeIOAPIScheme # Rize GraphQL API Schema
└── README.md # Project documentation
| File | Size | Description |
|---|---|---|
src/rize_client.py |
28.7 KB | API client with complete create_session implementation |
src/server_simple.py |
18.1 KB | MCP server exposing 7 tool interfaces |
src/test_basic_api.py |
2.8 KB | Test script focusing on create_session |
RizeIOAPIScheme |
33 KB | Rize GraphQL Schema (JSON format) |
Edit Claude Desktop configuration file to add MCP server:
Windows: %APPDATA%\Claude\claude_desktop_config.json
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
{
"mcpServers": {
"rize-scheduler": {
"command": "python",
"args": ["C:\\Users\\yeche\\Desktop\\rize-ai-scheduler\\src\\server_simple.py"],
"env": {
"RIZE_API_TOKEN": "your_token_here",
"RIZE_API_URL": "https://api.rize.io/api/v1/graphql"
}
}
}
}Currently exposed 7 tools:
- Fully Functional:
create_session- Create work session - Basic:
test_connection- Test API connection - Basic:
list_projects- List projects - Basic:
create_project- Create project - Basic:
get_current_session- Get current session - Caution:
start_session_timer- Start timer (partially functional) - Not Recommended:
stop_session_timer- Stop timer (not recommended)
mcp>=1.0.0 # Model Context Protocol
httpx>=0.24.0 # Async HTTP client
graphql-core>=3.2.0 # GraphQL support
pydantic>=2.0.0 # Data validation
python-dotenv>=1.0.0 # Environment variable loading
colorama>=0.4.6 # Terminal colored output (Windows compatible)
-
Async-First
- All API calls use
asyncioandhttpx.AsyncClient - Supports high-concurrency request handling
- All API calls use
-
Separation of Concerns
RizeClienthandles pure API communicationserver_simple.pyadds MCP server wrapper with user-friendly responses
-
Multi-Layer Error Handling
- Network layer error handling (timeout, connection failures)
- HTTP error handling (401 auth, 429 rate limit, 5xx server errors)
- GraphQL error handling (field validation, business logic errors)
-
Cross-Platform Support
- Windows special handling (sets
WindowsSelectorEventLoopPolicy) - Emoji compatibility handling (Windows console)
- Windows special handling (sets
{
"data": {
"createSession": {
"session": { ... },
"errors": [
{
"message": "Error description",
"path": ["field", "path"]
}
]
}
},
"errors": [...] // GraphQL top-level errors
}-
Session Timer Functionality Unstable
stop_session_timerhas unclear input structure and may not work properly- Recommend using
create_sessionto log completed work sessions
-
Time Entry Not Implemented
- Supported in GraphQL Schema but not implemented in client code
- Important direction for future development
-
Some Features Not Fully Tested
- Project and task update/delete operations are coded but not verified in production
- Recommend testing in a test environment before use
-
Chinese Comments
- Code contains Chinese comments which may display incorrectly in some editors
Issues and Pull Requests are welcome!
- Improve Session Timer Functionality - Confirm correct API input structure
- Implement Time Entry Management - Complete Time Entry CRUD operations
- Add Unit Tests - Improve code quality and stability
- Enhance Error Handling - More user-friendly error messages and auto-retry mechanisms
- Add English Comments - Improve code maintainability
Project Status: Core Feature (Create Session) Stable & Production-Ready | Other Features In Development