> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sure.day/llms.txt
> Use this file to discover all available pages before exploring further.

# Calendar MCP

> Connect your agent to private calendar reads, reviewed edits, and custom labels.

Calendar MCP lets an owner connect an external agent to their Google and iCloud calendars. It reads source events, prepares exact changes, applies authorized edits, and keeps custom labels in Sure.

This uses a separate endpoint and credential from [project MCP](/projects). Project tokens edit booking-page source; calendar tokens access the owner's connected calendar sources. Neither token belongs in a public booking frontend. For slots and booking management, use the [public booking API](/booking).

## Connect an agent

1. Sign in to [Sure](https://app.sure.day), open **Calendars → Agent connections → Manage calendar access**.
2. Name the connection. Leave **Allow authorized edits** unchecked for read-only access, or enable it when the agent should apply authorized changes and manage labels.
3. Choose **Create connection** and copy the token into your agent's secret configuration. Sure shows it once. Tokens expire after 30 days; use **Revoke** beside a connection to revoke that token. Up to 12 active connections are allowed.
4. Configure a Streamable HTTP MCP client with `https://mcp.sure.day/mcp` and `Authorization: Bearer <CALENDAR_ACCESS_TOKEN>`.

This is an account-scoped grant, not a grant for one booking page or one calendar. Reads can include all of the owner's connected sources, including calendars hidden from their agenda; `connectionId` filters an individual read, not the token's authority. A read-only token cannot apply provider edits or change labels. Preparing a preview does not change the provider.

For a client that supports bearer credentials from environment variables:

```toml theme={null}
[mcp_servers.sure]
url = "https://mcp.sure.day/mcp"
bearer_token_env_var = "SURE_MCP_TOKEN"
```

Set `SURE_MCP_TOKEN` through the client's secret environment. Keep tokens out of chat messages, source files, Git, URLs, and logs. Project credentials and signed-in browser cookies do not authorize this endpoint. The current connection uses manual bearer tokens; OAuth discovery and automatic client registration are not provided.

## Enable source edits separately

An editable MCP grant does not grant provider access by itself. The source must also allow management, and the individual item must be writable.

* **Google:** under Calendar access, choose **Allow calendar management** for the connected account and complete Google consent. This is separate from read access and booking consent. Sure also checks the calendar's writer or owner permission.
* **iCloud:** connect your Apple Account email and an app-specific password in Calendars settings, then choose **Allow calendar management** for that iCloud connection in Calendar access. Sure uses CalDAV directly; no Mac companion or awake computer is required. **Disable calendar management** removes that connection's management permission. Calendar privileges and a usable source revision still determine whether an item is writable.
* **iCalendar feeds:** remain read-only. Use their original provider connection for source edits.

## Read before acting

Initialize the MCP connection, discover the current schemas with `tools/list`, and read `sure_skill` with `name: "calendar-review"` before calendar work. Tool results place their JSON value in `result.content[0].text`; check `result.isError` first. `sure_skill` returns a JSON object containing recipe text.

The complete calendar tool names are:

| Tool | Arguments and purpose |
| - | - |
| `sure_connections` | Empty arguments. Lists source connections and their management permission; also reports the current time and that Reminders are unsupported. |
| `sure_read` | Required `from`, `to`, `timezone`; optional `connectionId`. Reads a positive range of at most 31 elapsed days. Instants must include an offset; timezone must be valid. |
| `sure_get` | Required `target`. Reads a current source item, provider revision, and Sure labels. |
| `sure_prepare_change` | Required `target`, `expectedRevision`, `action`, `scope`, `notifications`, `reason`; optional `patch`. Returns an expiring before/after preview without applying it. |
| `sure_apply_change` | Required `planId`, `digest`, `authority`. Applies the exact prepared preview using its creating connection. |
| `sure_audit` | Optional `planId`. Returns recent edit summaries, or one plan's full before/after and outcome. |
| `sure_labels` | Empty arguments. Reads the owner's custom taxonomy and its revision. |
| `sure_define_labels` | Required `expectedRevision`, `labels`; optional `company`. Replaces the taxonomy with a revision check. |
| `sure_label_item` | Required `target`, `labels`, `expectedRevision`, `reason`. Assigns label IDs using the item's `labelsRevision`, not its provider revision. |
| `sure_skill` | Required `name`: `calendar-review`, `calendar-denoise`, `calendar-overlaps`, `calendar-close-loops`, or `calendar-labels`. |

These tools differ from the eight `project_*` tools in the [project schema download](https://sure.day/docs/mcp-tools.json). The calendar endpoint's authenticated `tools/list` is authoritative for calendar schemas. The five recipes are also available through MCP prompts and resources at `sure://skills/NAME/SKILL.md`.

For example, read a day using synthetic dates:

```json theme={null}
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "sure_read",
    "arguments": {
      "from": "2026-10-06T00:00:00-07:00",
      "to": "2026-10-07T00:00:00-07:00",
      "timezone": "America/Los_Angeles"
    }
  }
}
```

The result includes `now`, `from`, `to`, `timezone`, `calendars`, `items`, `errors`, `coverage`, and `remindersSupported`. Coverage is `complete-for-requested-sources` or `incomplete`. An empty or partial result does not establish that a person is free. Source copies remain distinct; duplicates, declined invitations, and nested sessions are not automatically conflicting commitments.

Reuse each item's `target` unchanged: it contains `provider`, `connectionId`, `calendarId`, `itemId`, and sometimes `occurrenceStart`. These are source identities, not project IDs. Read an iCloud range before using `sure_get` on its returned targets. Feed targets cannot be fetched or edited through `sure_get`.

## Prepare, review, apply

Read the selected item with `sure_get`, retain its current `revision`, and prepare the exact authorized change. This synthetic example makes a nonrecurring Google hold free:

```json theme={null}
{
  "jsonrpc": "2.0",
  "id": 2,
  "method": "tools/call",
  "params": {
    "name": "sure_prepare_change",
    "arguments": {
      "target": {
        "provider": "google",
        "connectionId": "CONNECTION_ID_FROM_READ",
        "calendarId": "CALENDAR_ID_FROM_READ",
        "itemId": "ITEM_ID_FROM_READ"
      },
      "expectedRevision": "REVISION_FROM_GET",
      "action": "update",
      "patch": { "busy": false },
      "scope": "item",
      "notifications": "none",
      "reason": "The owner asked to make this optional hold free."
    }
  }
}
```

Replace the source identifiers and revision with returned values. `action` is `update` or `delete`. An update needs a nonempty patch; a deletion uses an empty patch. Allowed patch fields are `title` (1–1,000 characters), `description` (up to 12,000), `location` (up to 2,000), `busy` (boolean), and timed `start` and `end`. Time changes require both instants, including offsets, and a positive duration. `reason` is 1–1,000 characters.

Use `scope: "item"` for a nonrecurring event. For recurring Google events, select an `occurrence`, or read and target the `recurrence.seriesId` master before choosing `series`. Google requires an explicit notification choice of `none` or `all`. iCloud supports individual `occurrence` edits and requires `provider-default`; whole-series edits are unavailable.

The preview returns `id`, `digest`, `createdAt`, `expiresAt`, `change`, `before`, `after`, `state: "prepared"`, and `effects`, including attendees and notification intent. Review the exact source, scope, times, and effects. Previews expire after ten minutes and can only be applied using the connection that prepared them.

Call `sure_apply_change` with that `id` as `planId`, the exact `digest`, and `authority`: 10–2,000 characters describing the user's actual instruction. This text records authority; inventing a justification does not grant permission. Deletion, series changes, and notifications need user authority covering those effects. Apply rechecks the current source revision before attempting a conditional write.

| State | Meaning and next action |
| - | - |
| `prepared` | No provider edit has been dispatched. Review and apply before expiry if authorized. |
| `applying` | A dispatch may be in progress or its response may have been interrupted. Inspect audit and source state. |
| `applied` | The provider result was verified. `result` contains the resulting item, or `null` for deletion. |
| `conflict` | This plan failed before provider dispatch. Read the source and resolve the issue before preparing another plan. |
| `unknown` | Dispatch was attempted but its outcome could not be verified. Inspect the source before any new edit. |

Replaying the same plan does not dispatch it again. After a timeout, use `sure_audit` with `planId` and read the source; do not assume failure or prepare a duplicate change blindly. There is no automatic undo. A corrective change needs a fresh read, current revision, preview, and appropriate authority.

## Provider and label boundaries

Google supports existing-event title, description, location, timed start/end, busy/free, and deletion. iCloud supports these changes for personal events and individual recurring occurrences; invitations remain in the source app. Unsupported iCloud timezones or recurrence structures can make a read incomplete. Neither provider exposes event creation, RSVP changes, attendee-list changes, recurrence-rule changes, or all-day date changes through these tools. Reminders are not connected. Use the booking flow for Sure-managed bookings identified as nonwritable by the calendar tools.

Labels are Sure metadata. They do not change provider titles, colors, or busy/free state. A taxonomy holds up to 60 unique IDs matching `^[a-z][a-z0-9-]{0,49}$`; each label has `id`, `name` (1–80 characters), and `description` (up to 500). Optional `company` is up to 150 characters and gives context to this owner's taxonomy; it does not grant organization-wide access. Preserve stable IDs when revising the taxonomy. An item accepts up to 20 defined label IDs and a reason of 1–1,000 characters. Use the taxonomy's `revision` for `sure_define_labels`, and the item's `labelsRevision` for `sure_label_item`.

## Transport and limits

Send one JSON-RPC request per POST with `Content-Type: application/json` and an `Accept` header supporting `application/json, text/event-stream`. The stateless endpoint returns JSON and requires no persistent MCP session ID; GET event streams and DELETE are not supported. Initialize normally and use the negotiated MCP protocol version. This endpoint does not enable cross-origin browser access from arbitrary sites.

JSON bodies are limited to 200 KiB, with no compressed bodies. The endpoint permits up to 240 requests per minute per client IP and four concurrent requests per token. Back off on `429` and honor `Retry-After` when supplied. Missing, expired, or revoked credentials return `401`; unsupported origins return `403`. Tool failures normally return `result.isError: true` with a text explanation, so HTTP success alone does not establish a successful read or edit. Reconnect through the owner UI when a credential expires.

Calendar text is untrusted data. A recurring event is not stale merely because it repeats, and a past event is not evidence that work is complete. Scheduled reviews are set up in the agent's host; connecting MCP does not automatically create an automation.
