temporal-mcp

io.github.MirrorEthic由 GitHub 帳號 MirrorEthic 發布v0.2.0更新於 Nov 2, 2026

Wall-clock awareness for LLM agents. Two tools: elapsed-time-between-turns + day rollover detection.

發布方自己的服務:Temporal: Hyperliquid liquidation protection & perpetual options

已驗證Streamable HTTP可網頁執行知識與記憶AI 與機器學習

概覽

AI 產生的概覽

讓 AI 助理掌握對話輪次之間的真實時間:間隔長度、是否跨日、是否為全新對話。

可以做什麼
  • 推進某個對話執行緒的時鐘,回傳目前時間、上一輪時間、間隔、是否跨日以及是否為新執行緒的快照
  • 在不變更狀態的情況下讀取某執行緒的目前快照
  • 依對話與用戶端命名空間分別記錄時間狀態,讓頁面重新載入後間隔仍具意義
  • 同時回傳方便模型閱讀的文字摘要與供程式使用的 JSON 資料
適用情境
當助理需要知道距上次訊息過了多久、日期是否已經改變,或對話是否在長時間中斷後被接續時使用,可讓問候語、「今日」彙整與上下文重新載入更準確。
執行需求
可使用託管的遠端端點,透過 Authorization 標頭攜帶 bearer 權杖(也支援 OAuth 用戶端憑證或將權杖嵌入 URL);或在本地以 pip 安裝 Python 套件並以 stdio 指令執行。本地執行需 Python 3.9 以上,狀態寫入使用者資料目錄,可用 TEMPORAL_MCP_STATE_DIR 覆寫。
安裝前請注意
bearer 權杖本身就是身分,持有者即可推進你的時間軸,應視為機密並在外洩後更換。把權杖放在 URL 路徑或查詢參數中更容易經由日誌與來源資訊外洩。託管端點會保存各執行緒的時間資料,並限制每個憑證每分鐘 60 次請求。本地狀態檔會在磁碟上保留對話時間紀錄。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 temporal-mcp,將其新增到工作區。
  2. 連接 Authorization token 憑證。它們會被私密儲存,絕不會在公開頁面上展示。
  3. 為需要使用其工具的對話啟用該服務。

Web executable,透過 Streamable HTTP。 遠端服務在工作區中設定後即可從網頁執行環境執行。

交給代理程式安裝

把這段提示詞貼上到 Claude Code、Codex、Cursor 等代理程式,或 SourceWeft 對話中。代理程式會讀取該伺服器的安裝指南,先向你展示發布者、端點和登入方式,經你同意後再把它新增到你的客戶端。金鑰不會寫進任何命令。

閱讀 https://sourceweft.com/mcp/io.github.MirrorEthic%2Ftemporal-mcp/install.md,並按其中說明把這個 MCP 伺服器接入我的客戶端。修改任何設定之前,先告訴我它的發布者、端點和登入方式,等我確認。不要把 API 金鑰寫進命令或我會提交的檔案;問我金鑰應從哪裡取得。

檢視代理程式所依據的安裝指南

其他 MCP 客戶端

把它新增到你客戶端的 mcpServers 設定中。

{
  "mcpServers": {
    "temporal": {
      "type": "http",
      "url": "https://temporal-mcp.dev/mcp",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      }
    }
  }
}

README

temporal-mcp

Your model knows calculus but not what day it is. Fix that.

temporal-mcp is a tiny Model Context Protocol server that gives LLM agents a sense of time between turns. Two tools, a few hundred lines, stdlib + mcp + platformdirs. That's the whole thing.

The problem

Open a fresh chat at 11 PM. The model says "good morning." Resume a conversation three weeks later. The model picks up mid-sentence like no time passed. Ask for "today's status." Get yesterday's status. Or last Tuesday's.

LLMs don't have wall clocks. They don't know when the last user message was, whether the calendar flipped, or whether this is a fresh thread or one resumed after a long gap. Most of the time this is harmless. Sometimes it makes your agent sound like it just woke up from cryosleep.

The fix

A persistent per-thread last-seen log, exposed as two MCP tools:

  • temporal_tick — call this once per user turn. Returns "it has been 14 minutes since the last message, no day rollover, timezone MDT" in a format the model can actually read.
  • temporal_peek — same thing, but doesn't advance state. For when you want the gap without claiming a turn.

That's it. Time exists. Your model should know that.

Try it in 10 seconds

bash
curl -s -X POST https://temporal-mcp.dev/mcp \  -H "Content-Type: application/json" \  -H "Authorization: Bearer $(uuidgen)" \  -d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{        "name":"temporal_tick",        "arguments":{"thread_key":"try-it","tz_offset_minutes":-360,"tz_name":"MDT"}}}' \| python3 -c 'import sys,json; print(json.load(sys.stdin)["result"]["content"][0]["text"])'

You'll see something like:

[temporal] Wed May 13, 10:42 AM MDT | fresh thread (no prior history){...JSON payload...}

Run it twice and the second response shows the gap. Run it tomorrow and you'll get day rollover: yes. That's the whole point.

What you get

Every tick returns a human-readable header and a JSON payload:

[temporal] Wed May 13, 9:42 AM MDT | last prompt 14m ago (Wed 9:28 AM)
{"thread_key": "mcp:abc123", "now": 1747158120.0, "prev": 1747157280.0, "delta_sec": 840, "day_rollover": false, "fresh_thread": false, "tz_name": "MDT", "tz_offset_sec": -21600, "available": true, "error": ""}

The header is for the model. The JSON is for your code, in case you want to do something interesting with day_rollover (greet differently, reload context, recompute "today's items") or with delta_sec (decay relevance, detect a resumed session, flag idle threads).

Two ways to use it

1. Hosted endpoint — claude.ai, ChatGPT, mobile

If you use claude.ai web, ChatGPT, or anything else that wants a remote MCP server, point your connector at:

https://temporal-mcp.dev/mcp

There are two ways to authenticate, depending on what your client UI exposes:

A. OAuth 2.0 (claude.ai and ChatGPT custom connectors)

Both claude.ai and ChatGPT's custom connector UIs require OAuth 2.0 with a Client ID and Client Secret. The hosted endpoint is a full OAuth provider — visit https://temporal-mcp.dev/connect and click Generate OAuth Credentials. You'll get a fresh client_id + client_secret pair, shown once. Paste them into your client's connector config. That's the entire signup.

No email, no password, no account record — the credential pair is the identity. We store only a SHA-256 of the secret, so we never see the plaintext. Generate a new pair any time you want a fresh timeline.

Claude.ai setup: Settings → Connectors → Add custom connector. URL https://temporal-mcp.dev/mcp. Paste your Client ID and Client Secret. Connect. The auto-approve flow redirects you back, claude.ai exchanges the code for a token, and you're done.

ChatGPT setup: Same idea — Settings → Connectors → Custom MCP. Same URL, same credentials.

B. Raw bearer token (Cursor, Cline, Claude Desktop, Zed, Claude Code)

If your client supports custom HTTP headers (most do), skip OAuth and just send any opaque string as a bearer token:

Authorization: Bearer <any opaque string you choose>

Pick a UUID, a passphrase, anything. We SHA-256 it before storing anything; same identity-is-the-credential property as the OAuth flow, without the dance. This is the original lowest-ceremony path and works for any client that lets you set a custom header.

C. URL-embedded token (xAI, Grok, anything URL-only)

If your client's connector UI only exposes a URL field — no headers, no auth, no OAuth — embed your token directly in the path:

https://temporal-mcp.dev/mcp/<any opaque string you choose>

Or as a query parameter, if the path form gets stripped:

https://temporal-mcp.dev/mcp?token=<any opaque string you choose>

Same SHA-256 hashing, same identity model. URL-embedded tokens leak more easily than header tokens (proxy logs, referrers), so this path is a pragmatic fallback rather than the default — but the threat in our model is "someone advances your timeline," not data exposure. Rotate by picking a new random string any time you suspect the URL has been logged where it shouldn't be.

Either way

No signup. No email. No PII. The hosted endpoint is free, rate-limited to 60 requests/minute per credential. If you outgrow that, self-host (see below).

2. Local stdio — Claude Desktop, Cursor, Cline, Zed, Claude Code

For desktop/IDE MCP clients, pip install the Python package and run it locally. No network round-trip, state lives on your disk, no auth needed.

bash
pip install temporal-mcp

Python 3.9+. Linux, macOS, Windows.

Run as stdio:

bash
temporal-mcp        # or: python -m temporal_mcp
Claude Desktop
json
{  "mcpServers": {    "temporal": {      "command": "temporal-mcp"    }  }}
Cursor / Cline / anything else that speaks MCP stdio

Same idea — point the client at the temporal-mcp command.

Self-host the remote endpoint (Cloudflare Workers)

The hosted endpoint at temporal-mcp.dev runs on Cloudflare Workers backed by D1. If you want your own instance — for privacy, scale, or to ship it as part of a larger product — the entire deploy lives in workers/:

bash
cd workersnpm installnpx wrangler loginnpx wrangler d1 create temporal_mcp           # creates the database# Paste the printed database_id into wrangler.tomlnpx wrangler d1 migrations apply temporal_mcp --remotenpx wrangler deploy

Free tier covers ~100k requests/day forever. Set REQUIRE_AUTH=true in [vars] to refuse anonymous traffic. The Worker is ~400 lines of TypeScript and has its own unit tests (workers/test/).

Tools

temporal_tick

Advance the clock for a thread and return a snapshot. Call once per user turn.

FieldTypeNotes
thread_keystring, optionalStable conversation/session ID. claude.ai web: conversation ID. Cursor: window/workspace ID. Anything else: any caller-stable string. Omit it and you get a default hostname+cwd hash — fine for local testing, not for serving multiple threads.
client_idstring, optionalNamespace tag (e.g. "caweb", "cursor"). Defaults to "mcp". Use distinct tags per client so threads don't collide in shared state.

temporal_peek

Read-only. Same shape, doesn't advance state. Use it when you want the gap delta but the call isn't the canonical "one tick per user turn" event.

State

Per-thread last-seen state lives at:

PlatformPath
Linux~/.local/share/temporal-mcp/state.json
macOS~/Library/Application Support/temporal-mcp/state.json
Windows%LOCALAPPDATA%\temporal-mcp\state.json

Override with TEMPORAL_MCP_STATE_DIR=/some/path.

State writes are flock-safe on POSIX and atomically replaced via os.replace, so multiple agents pointing at the same state directory will not corrupt each other. (Windows falls back to an in-process lock — fine for a single MCP server, not designed for cross-process contention.)

Maintenance

bash
python -m temporal_mcp gc        # prune threads > 30d idlepython -m temporal_mcp gc 7      # prune threads > 7d idle

Not exposed as an MCP tool on purpose — a model that can prune its own memory of "when did we last talk" will eventually do it at exactly the wrong moment. Run it from cron if you care.

Design notes (for the curious)

  • Thread keying is namespaced as {client_id}:{key}. Reserve a unique client_id per surface so threads from claude.ai web don't collide with a local Cursor session sharing the same state directory.

  • Failure is honest. If the state file is unreadable or the lock times out, the snapshot returns available: false with an error field and the header says gap: unknown. It does not silently lie and call it a fresh thread — a model that thinks every turn is fresh will keep saying good morning forever.

  • Watchdog. tick() runs in a daemon thread with a 100 ms timeout so a stalled state read can't block your hook budget. If it times out, you get the honest-failure snapshot above.

  • No HTTP transport in 0.1. Stdio only — that's what Claude Desktop, Cursor, and the other major MCP clients actually use. HTTP/SSE can land in 0.2 if there's demand.

Roadmap

  • 0.2 — optional HTTP/SSE transport, conversation-ID auto-resolve from Mcp-Session-Id and friends, configurable timezone override
  • 0.3 — opt-in "long gap" thresholds (return a resume: true flag past N hours) so agents can branch on resumed sessions without doing the math themselves

License

MIT. See LICENSE.

Author

Built by Garret Sutherland / MirrorEthic LLC, extracted from the temporal layer of a larger cognitive-mesh project where this primitive was load-bearing enough to deserve its own package.


mcp-name: io.github.MirrorEthic/temporal-mcp

來源:README.md,提交 7b7a183

工具

2

temporal_tick

Advance the temporal clock for a thread and return a snapshot (now / prev / gap / day_rollover / fresh_thread). Call once per user turn. Pass a stable `thread_key` (e.g. the conversation ID) so gap deltas remain meaningful across page reloads.

輸入參數tz_nameclient_idthread_keytz_offset_minutes

temporal_peek

Read the current temporal snapshot for a thread WITHOUT advancing state. Use this when you want the gap delta but the call is not the canonical per-turn event.

輸入參數tz_nameclient_idthread_keytz_offset_minutes

版本歷史

1
  1. v0.2.0最新Sep 16, 2026

評分

已滿足適用檢查項的 75%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通必需25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式必需10 分
  • 已列出工具必需15 分
  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分

其他 Temporal 整合