Repository avatar
Databases
v0.12.3
active

slotlock

io.github.PILOTAAI/slotlock

Calendars for AI agents: free/busy, next free slot, and bookings PostgreSQL never double-books.

Documentation

Slotlock

Slotlock is a calendar for AI agents. It books vehicles, rooms, machines, people or anything else reservable, answers "when is this free?" from weekly availability rules, and lets PostgreSQL reject double bookings, however many writers race. Agents call it over MCP or A2A; your code calls it as a TypeScript library.

Why it is built for agents

  • Resources own calendars, not users, and the tenant comes only from the authenticated caller.
  • Intervals are half-open [start, end), so back-to-back bookings never collide.
  • A PostgreSQL exclusion constraint decides overlaps; a conflict comes back as data, not an error.
  • Writes are idempotent and take an expected revision.
  • Free/busy says whether it is certain: a calendar not yet synced makes time unproven, not free.
  • Tool names, schemas and errors work on Claude, OpenAI and every MCP host.

Get started

The documentation is at slotlock.pylota.io/docs, with a page each for the booking MCP server, the booking API, use cases and pricing. There are three ways to run Slotlock:

  • Slotlock Cloud: nothing to run. Sign in with GitHub or Google at https://app.slotlock.pylota.io/dashboard, create a key, and connect an agent to https://slotlock-api.pylota.io/mcp. Start on Free, with no card; Developer and Team add room for agents in production (pricing). Best effort, with no service level agreement.
  • Self-host with Docker, or from npm with Self-hosting.
  • As a TypeScript library inside your own Node.js service.

Self-host with Docker

From a clone of this repository:

scripts/quickstart-env.sh > .env    # .env.example, its four secrets set to openssl rand -hex 32
docker compose up --build --detach
docker compose exec slotlock slotlock resource add vehicle-42 --timezone Europe/London
URLWhat
http://localhost:8080/mcpMCP, with Authorization: Bearer <SLOTLOCK_AUTH_TOKEN>
http://localhost:8080/a2aA2A 1.0, same token; card at /.well-known/agent-card.json
http://localhost:8080/v1/…REST: the tools, and the application API for admin keys; described at /openapi.json
http://localhost:8080/healthzReadiness, including the database
http://localhost:8080/metricsPrometheus metrics, with Authorization: Bearer <SLOTLOCK_METRICS_TOKEN>; off without it

The server listens on 127.0.0.1:8080, as a database role that cannot bypass row-level security. .env.example makes every resource bookable on weekdays 09:00 to 17:00 and every write wait for a person. The Quickstart walks through it with Claude Code; Self-hosting covers the published image, configuration and commands, and Operations the production checklist.

Quick start: the next free slot

npm install slotlock postgres

Node.js 22.12+, PostgreSQL 16 or newer with btree_gist (created for you if missing), and postgres ^3.4.5 as a peer dependency. TypeScript declarations are included. The availability maths needs no database:

import { expandRules, findNextAvailable } from 'slotlock';

const searchWindow = {
  start: new Date('2026-09-14T00:00:00Z'),
  end: new Date('2026-09-21T00:00:00Z'),
};

const windows = expandRules(
  [{ rrule: 'FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR', startMinutes: 9 * 60, durationMinutes: 8 * 60 }],
  searchWindow,
  'Europe/London',
);

export const slot = findNextAvailable({
  windows,
  busy: [{ start: new Date('2026-09-14T09:00:00Z'), end: new Date('2026-09-14T10:00:00Z') }],
  durationMs: 2 * 60 * 60 * 1000,
});
// slot: 2026-09-14 10:00–12:00 UTC, the first two free hours after the busy one

The TypeScript library guide sets up PostgreSQL, then books, holds and reads time under row-level security.

Connect an agent

Point any Streamable HTTP MCP client at http://localhost:8080/mcp with the token (on Slotlock Cloud, https://slotlock-api.pylota.io/mcp with an API key). Claude Code:

claude mcp add --transport http slotlock http://localhost:8080/mcp \
  --header "Authorization: Bearer $SLOTLOCK_AUTH_TOKEN"

On Slotlock Cloud, Claude Code can also install Slotlock as a plugin: its tools, and skills for booking without double-booking and for setting Slotlock up in a project. Put your API key in SLOTLOCK_API_KEY, then:

/plugin marketplace add PILOTAAI/slotlock
/plugin install slotlock@slotlock

Cursor, VS Code, the Claude API and the MCP and A2A SDKs are in Connect an agent, and every slotlock_* tool's input, output and errors in the Tools reference.

Documentation

ForRead
Running itQuickstart, Self-hosting, Slotlock Cloud
API keys and scopesAPI keys
Bookable hours and booking rulesHours and booking rules
The dashboard, organizations and the assistantDashboard, on Cloudflare Workers
Agents: tools, errors and protocolsConnect an agent, Tools reference, Protocol reference
REST, the application API, changes and webhooksREST API, Protocol reference
The library: store, holds, waitlistsTypeScript library
Recurring eventsRecurring events
External calendars and iCalendarExternal calendars
Rate limits and tenant limitsLimits
Maintenance, retention and the production checklistOperations
Scaling and benchmarksScaling, Benchmarks
Clients for Python, Go, Rust, Java and .NETClients
Concepts and the security modelConcepts, Security, SECURITY.md
The exact rulesSPEC.md

Supported versions

Version
MCP2026-07-28 (stateless), 2025-11-25, 2025-06-18
A2A1.0, JSON-RPC binding
MCP Appsio.modelcontextprotocol/ui 2026-01-26
Node.js≥ 22.12 (CI: 22 and 24; the image runs 24)
PostgreSQL16, 17 and 18 (CI runs the database suites on each; Compose ships 18)
postgres (peer)^3.4.5

0.2.0 and older can double-book around daylight-saving changes: known issues.

Project status and boundaries

Slotlock is availability maths, holds and reservations, events with recurrence, coverage-aware free/busy, tenant isolation, iCalendar interchange, MCP and A2A with human confirmation and live updates, an MCP Apps view, REST with the application API, scoped API keys, a GitHub sign-in dashboard, maintenance, and clients for five languages. Hosted Slotlock runs it for you, or you self-host it. Provider sync (Google, Microsoft, CalDAV), notifications to people, and a human calendar app are yours to build around it. What each version promises is in VERSIONING.md.

Events need a finite duration (all-day events are whole local days; one event may last 3,660 days). Open-ended entries are refused rather than guessed.

The normative rules are in SPEC.md; tools can read slotlock.manifest.json without running package code. Report vulnerabilities as described in SECURITY.md. See CONTRIBUTING.md and GOVERNANCE.md for how the project runs.

License

Apache-2.0. Copyright 2026 TREFT LTD. Dependency notices are in NOTICE.

OCI
ghcr.io/pilotaai/slotlock:0.12.3
Install Command
docker pull ghcr.io/pilotaai/slotlock:0.12.3:undefined
Runtime: docker