time-left-mcp-chatgpt

time-left-mcp-chatgpt

Provides a single tool to display visual progress bars for time remaining in the current day, week, month, and year, enabling ChatGPT to answer 'how much time is left?' queries with elegant visualizations.

Category
访问服务器

README

Preview

Time Left - ChatGPT App

A simple ChatGPT app that shows elegant progress bar visualizations of how much time is left in the current day, week, month, and year.

Features

  • Single Tool: get_time_remaining - answers "how much time is left?" queries
  • Visual Progress Bars: Animated, color-coded bars for each time period
  • Light/Dark Theme: Automatically matches ChatGPT's theme
  • Real-time Calculation: Shows current elapsed/remaining percentages

Quick Start

# Install dependencies
uv sync

# Run the server
uv run python server/main.py

The server will start on http://localhost:8000.

Running Tests

# Install dev dependencies
uv sync --all-extras

# Run all tests
uv run pytest

# Run tests with verbose output
uv run pytest -v

# Run a specific test
uv run pytest server/test_main.py::TestCalculateTimeRemaining::test_noon_day_progress_is_fifty -v

Testing with MCP Inspector

npx @modelcontextprotocol/inspector@latest http://localhost:8000/mcp

Note: MCP Inspector tests the protocol but doesn't render the widget UI. Use web/preview.html to preview the widget locally.

Testing in ChatGPT (with Cloudflare Tunnel)

ChatGPT needs a public HTTPS URL to connect to your MCP server. Cloudflare Tunnel provides this for free without an account.

1. Install Cloudflare Tunnel (one-time)

# macOS
brew install cloudflared

# Or download from https://developers.cloudflare.com/cloudflare-one/connections/connect-apps/install-and-setup/installation/

2. Start the server and tunnel

# Terminal 1: Start the MCP server
uv run python server/main.py

# Terminal 2: Create a tunnel to localhost:8000
cloudflared tunnel --url http://localhost:8000

Cloudflare will output a URL like:

Your quick Tunnel has been created! Visit it at:
https://random-words-here.trycloudflare.com

3. Configure ChatGPT

  1. Go to ChatGPT: Settings → Apps & Connectors → Advanced settings
  2. Enable Developer mode
  3. Click Create connector
  4. Enter the Cloudflare URL with /mcp path: https://random-words-here.trycloudflare.com/mcp
  5. Save the connector

4. Test it

Ask ChatGPT: "How much time is left?" or "What's my time progress?"

Local Widget Preview

To preview the widget without ChatGPT:

  1. Start the server: uv run python server/main.py
  2. Open web/preview.html in a browser

This preview mocks the window.openai API that ChatGPT normally provides.

Project Structure

time-left-chatgpt-app/
├── server/
│   ├── main.py           # MCP server with get_time_remaining tool
│   ├── test_main.py      # Unit tests
│   └── requirements.txt  # Legacy deps (use pyproject.toml instead)
├── web/
│   ├── widget.html       # Progress bar visualization widget
│   └── preview.html      # Local preview with mocked window.openai
├── pyproject.toml        # Project config and dependencies
└── README.md

Architecture

User Prompt → ChatGPT Model → MCP Tool Call → This Server → Response + Widget Metadata
                                                              ↓
                                           ChatGPT loads widget.html in iframe
                                                              ↓
                                           Widget reads from window.openai.toolOutput

Key data flow:

  • structuredContent in server response → window.openai.toolOutput in widget
  • _meta contains OpenAI directives only (openai/outputTemplate, etc.)

Production Deployment

For production deployment to Google Cloud Run (or similar), the server includes:

CSP Configuration

The tool metadata includes Content Security Policy settings required for ChatGPT app submission:

"openai/widgetCSP": {
    "connect_domains": [],      # Empty - widget doesn't make external API calls
    "resource_domains": [],     # Empty - all assets are inline
},
"openai/widgetDomain": WIDGET_DOMAIN

Environment Variables

Variable Default Description
PORT 8000 Server port (Cloud Run sets this automatically)
WIDGET_DOMAIN https://web-sandbox.oaiusercontent.com Widget execution domain

Deploying to Google Cloud Run

# Build and deploy
gcloud run deploy time-left \
  --source . \
  --region us-central1 \
  --allow-unauthenticated \
  --set-env-vars WIDGET_DOMAIN=https://your-domain.com

# Map custom domain
gcloud run domain-mappings create \
  --service time-left \
  --domain your-domain.com \
  --region us-central1

App Submission Checklist

  • [x] CSP configured (openai/widgetCSP)
  • [x] Widget domain configured (openai/widgetDomain)
  • [ ] Organization verified on OpenAI Platform
  • [ ] Production URL deployed and accessible
  • [ ] Privacy policy URL prepared

Submit at: https://platform.openai.com/apps-manage

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选