
when-free
io.github.YauhenBichelv0.4.0更新于 Oct 9, 2026
Which days and times am I free? Reads your calendar feeds and answers with the slots you can offer.
概览
读取你的私有 iCal 日历订阅,告诉助手你在哪些日期和时间有空,以便回答约时间的消息。
- 功能
- 该服务器提供两个工具:free_slots 按天返回空闲时间,可传入日期、日期范围或一段消息文本,并支持时段、最短时长、缓冲、时区、周末和忙碌详情等选项;check_calendars 报告每个日历能否读取以及事件数量。它能解析常见的约时间文字,例如“下周二或周三上午10点到下午4点”,并说明它是如何理解日期的。它只读取日历,从不写入。
- 适用场景
- 当你希望助手回答“我什么时候有空”,或根据招聘方、同事的消息提出会议时间,并且要基于真实日历时,适合使用。适合使用 Google、Outlook、iCloud 或其他 .ics 日历、希望在不暴露事件详情的情况下获得空闲时间的人。
- 运行要求
- 作为本地 stdio MCP 服务器运行,用 uvx when-free mcp 启动(需要 Python 3.11 或更高版本,以及 uv 或 pipx)。需要至少配置一个日历:通过 whenfree add 命令,或用 WHENFREE_CALENDARS 环境变量提供私密 iCal 地址。WHENFREE_TZ 可选,用于指定回答所用时区。不需要账号或 API 密钥。
安装
在 SourceWeft 中
- 打开 控制台中的 when-free,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
其他 MCP 客户端
参照 仓库 中的启动说明。
README
when-free
Someone asks when you're free. This reads your calendar and gives you the answer, ready to paste.
[tests] [PyPI] [License: Apache-2.0]
[A recruiter's message goes in; the free slots on those days come out]
- Paste the message, get the slots. It reads "Tuesday or Wednesday next week, between 10am and 4pm" and answers for exactly those days and hours.
- Works with Google, Outlook and iCloud calendars, or any
.icsfile. Several calendars at once. - Private. It runs on your computer, needs no account and no API key, and never changes your calendar.
- Works from your AI tools too: Claude, Cursor and other MCP clients, Open WebUI, n8n, Shortcuts, scripts.
- And on your other devices: phones, tablets and watches, Home Assistant (and Alexa, Google Home, Siri through it), and the menu bar or status bar of macOS, Linux and Windows.
Contents
Try it · Add your calendar · Everyday use · Reading a message · Use it from other tools · Other devices · Privacy · Settings · What counts as busy · Limits · Problems
Try it in a minute
With uv, nothing to install first:
To keep it (needs Python 3.11 or newer):
Using Claude Desktop? You can skip all of this: install the one-click extension.
whenfree demo makes up a calendar for next week and answers a recruiter's message from it. It reads none of your data and saves nothing:
Add your calendar
-
Copy your calendar's private address. It's a link that ends in
.ics: -
Run
whenfree addand paste it. The address isn't shown while you paste. It's checked first, and saved only if it works: -
Run
whenfree. You'll see your free time for the next working days.
On a Mac, pbpaste | whenfree add takes the address straight from the clipboard.
Keep the address secret. It works like a password: anyone who has it can read that calendar. Give it to
whenfree addand to nothing else, so not to a chat, a shell command or a repository. If it leaks, reset it in your calendar's settings.
Google Calendar, step by step
Do this in a browser, because the phone app doesn't show the address.
- Open Google Calendar settings: the gear icon, then Settings.
- In the left column, under Settings for my calendars, click the calendar you want. The one with your own name is where invitations arrive.
- Scroll down to Integrate calendar and copy Secret address in iCal format. It ends in
basic.ics. Don't take "Public address in iCal format", which only works for a calendar you've made public. - Run
whenfree addand paste it when asked.
No "Secret address"? Work and school accounts can have it switched off. Export the calendar instead (Settings → Import & export → Export), unzip it, and run whenfree add ~/calendars/work.ics. An export is a snapshot, so export again when your calendar changes.
More than one calendar
A slot counts as free only if it's free in every calendar you add.
They're kept in ~/.config/when-free/config.toml, one [[calendar]] block each, with a name and a url or path. You can edit that file by hand. whenfree init creates an empty one.
Everyday use
Only the slot lines go to standard output. The context goes to standard error, so | pbcopy copies exactly what you'd paste into a reply.
Reading a message
--message finds the days and hours in ordinary text. It understands:
- Dates written in any common way:
Thu 1 Oct·Thursday the 1st of October·Monday, October 5th·5 October·2026-10-05·Wednesday 30th - Hours:
between 10:00am and 4:00pm·10:00–16:00·9-5pm·2 to 4 pm - Words, when there's no date (here, today is Thursday 1 Oct):
It always tells you how it read the dates, so you can check them against the message. A few rules keep it from guessing:
- Explicit dates win. A heading like "Next week:" above "Wednesday 30th, Thursday 1st" doesn't add a whole week.
- "Good morning" is a greeting, not a time.
- Days already past are left out and named, never dropped silently. "Wednesday 30th" means the nearest Wednesday that's a 30th, so a message from last week reads as last week.
- Words count from today. For an older message that says "tomorrow", give the days yourself with
--days.
when-free never connects to your mailbox. You paste the message, pipe it in, or save it to a file.
Let your own language model read the message
If you run a model yourself, it can do the reading instead. Add this to the settings file:
The command receives the message and must print JSON: {"days": ["2026-10-05"], "hours": "10:00-16:00", "minutes": 60}. If it fails, pattern matching is used instead. Nothing runs unless you configure it, and --no-extract skips it for one run. The message goes to whatever that command talks to, so use a local model for private text.
Use it from other tools
Every way gives the same answer, only reads, and leaves event titles out unless asked.
Claude Code plugin
The plugin bundles the MCP server with a skill that tells Claude when to use it: when you ask about your availability, paste a message asking when you can meet, or before it proposes a time.
Then add your calendar once, if you have not yet: uvx when-free add.
MCP: Claude, Cursor and other assistants
For Cursor and other MCP clients, add this to their server list. uvx fetches when-free the first time, so there's nothing to install:
If you installed it with uv tool install, use "command": "whenfree", "args": ["mcp"] instead. It's also listed in the MCP registry as io.github.YauhenBichel/when-free.
Then just ask: "Here's the recruiter's message. Which of those times can I do?" The assistant calls free_slots and answers from your real calendar.
If a tool can't do its job, the assistant gets an error it can read ("could not read the calendar 'work'"), never a guess.
HTTP: Open WebUI, n8n, Shortcuts and scripts
POST /free_slotswith a JSON body, orGETwith a query string. Same for/check_calendars.- The answer is
{"ok": true, "text": "...", "data": {...}}, or{"ok": false, "error": "..."}with status 400. - OpenAPI description at
/openapi.json. To set up Open WebUI, n8n or Shortcuts, see the recipes. - The token is created on first run and kept in
~/.config/when-free/token, readable only by you. Or set your own withWHENFREE_TOKEN. Every tool call needs it. - Requests addressed to any host other than this computer are refused. A web page may call it only from an origin you allow:
whenfree serve --allow-origin http://localhost:3000. With--host 0.0.0.0it's reachable from your network, and the token alone protects it, so use that only on a network you trust.
Function-calling harnesses
whenfree call prints {"ok": true, "text": "...", "data": {...}}, or {"ok": false, "error": "..."} with exit code 1. Arguments can also come on standard input.
Python
find_free returns plain dicts and lists, ready for json.dumps, and raises api.Problem with a message that's safe to show. Pass reader= to supply calendar text yourself instead of fetching it.
On your other devices
Devices see whether you're free and your free slots, never event titles. Each phone has its own token that you can revoke, and an unreadable calendar shows as "unknown", never "free".
Privacy
- It runs on your computer. It fetches your calendar feeds and nothing else. It never writes to a calendar and never sends a message.
- Your calendar address stays secret. It's never printed, isn't shown while you paste it, and is stored in a file only you can read. Errors name the calendar ("personal"), never its address.
- Assistants see free time, not your events. Event titles are left out unless the assistant asks with
include_busy, and that option's description tells the model that titles are private. No tool can add, change or delete anything, and no tool takes a calendar address, which goes from you towhenfree addonly.
Settings
All optional except a calendar. They live in ~/.config/when-free/config.toml, and command-line flags win over the file.
Environment variables
For scripts, containers and MCP client configurations. All optional.
WHENFREE_CALENDARS holds passwords. A private calendar address lets anyone who has it read that calendar. Treat the variable like an API key: keep it out of shared shell profiles, committed MCP configurations, CI logs and screenshots. The settings file whenfree add writes is readable only by you, so use it instead where you can.
What counts as busy
A slot shorter than min_minutes after the buffers isn't offered. For today, the day starts at the next quarter hour, not in the past.
Limits
- It reads; it doesn't book. It never writes to a calendar and never sends a message.
- It's as fresh as the feed. Google refreshes the secret address with some delay, so an event added a minute ago may be missing. Run
whenfree --busyto see what it saw. - Every calendar or none. If one calendar can't be read, no slots are shown, because busy time would look free.
- Repeating events. Daily, weekly, monthly (by date, or "first Monday", "last Friday") and yearly rules are expanded, with intervals, end dates, counts, skipped dates and moved occurrences. Rarer rules (
BYSETPOS, week numbers) aren't. For those the first date is blocked and a note says so. - Time zones come from the events. A zone name the time zone database doesn't know (some Outlook exports) is read in your own zone.
If something does not work
Development
The tests use a small calendar in tests/data/sample.ics and a fixed clock (WHENFREE_NOW). The code is grouped by component:
tests/test_structure.py fails if a component imports one it may not, so the domain stays free of front ends.
See CONTRIBUTING.md.
Licence
Apache-2.0.
来源:README.md,提交 6328582
工具
0版本历史
1- v0.4.0最新Oct 9, 2026

