Skip to main content
Glama

UNC LibCal MCP

MCP server for booking UNC Davis Library study spaces from Claude, Cursor, Codex, or any MCP client.

Built for UNC students, faculty, and staff with a valid Onyen. Not affiliated with or endorsed by UNC Libraries.

What it does

Ask your agent:

Book me a Davis cube tomorrow at 2pm

The server will:

  1. Check LibCal availability (public API — no login needed)

  2. Suggest ranked options (libcal_suggest) or book a slot you confirm (libcal_book)

  3. Complete the reservation in your browser session (Playwright + saved Onyen login)

Related MCP server: @aiwerk/mcp-server-cal

Requirements

  • Node.js 20+

  • UNC Onyen (for booking; availability checks work without login)

  • Chromium (installed automatically via Playwright)

Quick start

Already on this machine?

If you already have the repo and ~/.unc-libcal/:

cd ~/Projects/unc-libcal-mcp   # or wherever you cloned it
npm run build
npm test
  • ~/Projects/unc-libcal-mcp — the project (clone from GitHub)

  • ~/.unc-libcal/ — your private session + config (never commit this)

    • storage-state.json — saved login cookies from npm run login

Skip to step 2 if you've logged in before, or re-run login if booking fails.

1. Clone and install

git clone https://github.com/Thespaceblade/unc-libcal-mcp.git
cd unc-libcal-mcp
npm install
npx playwright install chromium
npm run build
npm test

2. Log in to LibCal

npm run login

A browser opens to the Davis cubes page (this is normal — the calendar is public and does not ask for Onyen immediately).

The script auto-clicks a test slot and opens UNC Onyen. Sign in (+ Duo if prompted).

You may land on Booking Details with a held test slot — that is normal. Do not click "Submit my Booking".

Press Enter in the terminal. The script clears the held slot and returns you to the Davis cubes calendar where Logout should appear.

Your session is saved to ~/.unc-libcal/storage-state.json (never commit this file).

3. Configure (optional)

On first run, ~/.unc-libcal/config.json is created with defaults:

{
  "defaultCategory": "davis-cubes",
  "preferSameDay": true,
  "minLeadMinutes": 30,
  "searchHorizonDays": 7,
  "bookingPurpose": "Study session"
}

4. Connect your MCP client

Every client needs the absolute path to dist/index.js. From inside the repo:

pwd   # e.g. /Users/you/projects/unc-libcal-mcp
# Use: <that-path>/dist/index.js

Or one-liner:

node -e "const p=require('path'); console.log(p.join(process.cwd(),'dist/index.js'))"

All clients below run the same stdio server:

{
  "command": "node",
  "args": ["/absolute/path/to/unc-libcal-mcp/dist/index.js"]
}

Restart the client after editing config.

Claude Desktop

File: ~/Library/Application Support/Claude/claude_desktop_config.json

If the file is new or empty, paste:

{
  "mcpServers": {
    "unc-libcal": {
      "command": "node",
      "args": ["/absolute/path/to/unc-libcal-mcp/dist/index.js"]
    }
  }
}

If the file already has other keys (e.g. preferences, coworkUserFilesPath), add only the unc-libcal block inside the existing mcpServers object — do not replace the whole file.

Fully quit and reopen Claude Desktop (Cmd+Q, not just closing the window).

Cursor

Option A — UI: Settings → MCP → Add server → paste the JSON block above.

Option B — project file: .cursor/mcp.json in this repo (good for sharing with teammates):

{
  "mcpServers": {
    "unc-libcal": {
      "command": "node",
      "args": ["./dist/index.js"]
    }
  }
}

Use ./dist/index.js only if Cursor's MCP cwd is the project root; otherwise use the absolute path.

OpenAI Codex (CLI)

Codex uses TOML, not JSON. File: ~/.codex/config.toml (or .codex/config.toml in a trusted project).

[mcp_servers.unc-libcal]
command = "node"
args = ["/absolute/path/to/unc-libcal-mcp/dist/index.js"]

Or via CLI:

codex mcp add unc-libcal -- node /absolute/path/to/unc-libcal-mcp/dist/index.js
codex mcp list   # verify it appears

If servers don't show up, confirm the project is trusted (codex trust in the repo) when using a project-local .codex/config.toml.

Claude Code (CLI)

File: ~/.claude.json (global) or .mcp.json in the project:

{
  "mcpServers": {
    "unc-libcal": {
      "command": "node",
      "args": ["/absolute/path/to/unc-libcal-mcp/dist/index.js"]
    }
  }
}

In a Claude Code session, run /mcp to confirm tools are loaded.

Other MCP clients

Any client that supports stdio MCP can use the same command + args. Point it at dist/index.js after npm run build.

5. Verify it works

In your agent, try:

Check libcal auth status

Then:

Suggest Davis cubes for 2 hours tomorrow

You should see libcal_auth_status, libcal_suggest, libcal_check_availability, and libcal_book available once the server is connected.

Troubleshooting

Problem

Fix

npm run login opens cubes page, no Onyen prompt

Wait — the script auto-clicks a slot and Submit Times to reach Onyen

libcal_auth_status says not logged in

Run npm run login (see above)

Session expires quickly

Normal for UNC SSO — re-run npm run login when booking fails

Login saved but booking redirects to SSO

Re-run npm run login — press Enter only after you see Logout on LibCal

libcal_book fails after suggest

Slot was taken — run libcal_suggest again

MCP tools don't appear in Claude Desktop

Fully quit (Cmd+Q) and reopen; confirm mcpServers path points to dist/index.js

Sessions expire periodically (LibCal auth ~24h; UNC SSO sooner with inactivity). Run npm run login again when libcal_auth_status reports expired.

MCP tools

Tool

Login required

Purpose

libcal_suggest

No

Ranked booking options; same-day priority unless you specify a date

libcal_check_availability

No

Open slots on one date

libcal_book

Yes

Book a confirmed slot

libcal_auth_status

Yes

Check if saved session is still valid

Booking workflow

  1. For open-ended requests (“book a cube”, “max hours”) → agent calls libcal_suggest first

  2. Agent shows numbered options; you pick one

  3. Agent calls libcal_book with user_confirmed: true and the chosen date/time

libcal_book will not run without explicit confirmation.

Space categories

ID

Description

davis-cubes

Davis Collaboration Cubes (default)

davis-study-rooms

Davis group study rooms

davis-computers

Data Services lab computers

Example prompts

Book me a study room for as long as possible
→ libcal_suggest shows TODAY vs later; you pick; then libcal_book

Book me a Davis cube tomorrow 11am–1pm
→ libcal_suggest or direct libcal_book with your exact time

Any study rooms free Friday afternoon?
→ libcal_check_availability or libcal_suggest

How it works

  • Availability — reverse-engineered LibCal grid API (/spaces/availability/grid)

  • Booking — Playwright drives the real LibCal UI: select slot → submit times → /spaces/auth checkout → confirm form

CLI scripts

# Refresh Onyen session
npm run login

# Run unit tests (46 tests)
npm test

# Book via CLI (uses saved session)
node dist/scripts/run-task.js --date 2026-09-01 --start 14:00 --duration 120

Cancelling bookings

This MCP server cannot cancel reservations. LibCal does not expose cancel links in the web UI or any API we can call.

To cancel, use the link in your confirmation email from alerts@mail.libcal.com. Search your inbox for that sender if you need an old booking.

LibCal limits (UNC Davis)

  • Up to 3 hours per day, in 30-minute / 1-hour segments

  • Popular slots can be taken between suggest and book

  • Cubes may require a “course or group name” on the checkout form (defaults to bookingPurpose in config)

Development

npm run build    # compile TypeScript → dist/
npm test         # unit + integration tests
npm run dev      # build and start MCP server on stdio

Caveats

  • Personal automation tool — use responsibly and follow UNC Library policies

  • Only tested against calendar.lib.unc.edu (UNC Chapel Hill)

  • Other LibCal institutions would need different lid/gid constants in src/libcal/constants.ts

License

MIT — see LICENSE.

Available Tools

5 tools
libcal_auth_statusA

Check whether your saved UNC LibCal login session is still valid. Run npm run login in the unc-libcal-mcp project if expired.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

A4.2/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are present, so the description carries the burden. It states the tool checks a saved session and provides remediation if expired, but does not disclose the return format, whether any network call is made, or what happens with no saved session. The behavior is generally self-evident for a status check, but richer context would help.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two short sentences with no filler. The core purpose is stated first, and the actionable recovery command follows immediately. Every word earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a zero-parameter, no-output-schema tool, the description is largely complete: it states what is checked and what to do if the session is expired. A minor gap is not describing what the tool returns, but the purpose sentence implies a validity result, and the recovery step covers the main downstream need.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has zero parameters, so parameter semantics are trivially satisfied. The description adds no parameter details, but none are needed. Baseline 4 applies for a no-parameter tool.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Description uses a specific verb ('Check whether') and a precise resource ('saved UNC LibCal login session') with an explicit outcome (valid vs expired). The name and description together clearly distinguish this auth-status tool from the sibling booking/availability tools.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Clearly indicates when to use the tool: to verify saved session validity. It also gives an actionable alternative by telling the user to run 'npm run login' if expired. It doesn't enumerate when not to use it, but no sibling competes with this auth check, so the guidance is sufficient.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

libcal_bookA

Book a specific UNC LibCal slot. BOOKING WORKFLOW (required):

  1. For open-ended requests ("book a room", "max hours", "soonest available") → call libcal_suggest FIRST.

  2. Present numbered options to the user. Explain the recommended option (usually same-day if available).

  3. Only call libcal_book after the user picks an option (or gives explicit date+time).

  4. Never auto-book a far-future date when sooner options exist. Requires user_confirmed=true. Categories: davis-cubes, davis-study-rooms, davis-computers

ParametersJSON Schema
NameRequiredDescriptionDefault
dateYesBooking date YYYY-MM-DD (from user choice or libcal_suggest option)
categoryNoSpace category id (default: davis-cubes)
space_idNoLibCal item/space id (from libcal_suggest option if available)
start_timeYesStart time HH:MM (from user choice or libcal_suggest option)
user_confirmedYesMust be true — confirms the user explicitly chose this slot
add_to_calendarNoAdd to Apple Calendar after booking (default true)
duration_minutesYesBooking length in minutes

TDQS

A4.6/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the burden of behavioral disclosure. It clearly states the user_confirmed=true requirement, the category restrictions, and the anti-far-future-booking guardrail. It could additionally mention side effects like calendar creation or failure behavior, but the key behavioral constraints are well covered.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is tightly structured with a numbered workflow and no filler. Each sentence contributes necessary operational guidance, and key constraints are front-loaded before the raw category list.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The description covers the critical workflow context: prerequisites, confirmation requirement, category options, and when invocation is appropriate. It leaves some operational details to the schema (duration bounds, optional parameters) and doesn't describe error/return behavior, but for a booking action the core invocation context is complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the baseline is 3. The description adds value by clarifying that date and start_time come from user choice or libcal_suggest options, that user_confirmed must be true, and by listing valid categories. This goes beyond the schema's basic descriptions.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Description clearly states the tool's function: 'Book a specific UNC LibCal slot.' It distinguishes itself from siblings by describing the required prerequisite workflow with libcal_suggest and by limiting scope to confirmed, specific bookings.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Provides explicit, step-by-step usage guidance: call libcal_suggest first for open-ended requests, present options, only call after user picks an option or gives explicit date/time, and never auto-book a far-future date when sooner options exist. This is strong, actionable routing guidance.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

libcal_check_availabilityA

Check open slots on ONE specific date. For smart ranked search across days, use libcal_suggest instead. Categories: davis-cubes, davis-study-rooms, davis-computers

ParametersJSON Schema
NameRequiredDescriptionDefault
dateYesDate to check, YYYY-MM-DD
categoryNoSpace category id (default: davis-cubes)
after_timeNoOnly show slots at or after this time, HH:MM (24h)
duration_minutesNoDesired booking length in minutes (default 60)

TDQS

A4.4/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. The verb 'Check' implies a non-destructive read operation, and the date-specific scope is clear. However, it does not explicitly confirm that no booking is made, nor does it mention authentication requirements or output characteristics. These gaps are notable but not severe for an availability-check tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is two compact sentences plus a short category list. The core purpose is front-loaded, the differentiation is in the second sentence, and there is no wasted wording.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with 4 documented parameters and a clear purpose, the description is largely complete. The category list and date-scope note cover the key details. The main omission is the response shape (what an 'open slot' looks like), which matters more because there is no output schema, but the operation is simple enough that this is a minor gap.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, giving a baseline of 3. The description adds concrete valid category values ('davis-cubes, davis-study-rooms, davis-computers'), which is not in the schema's generic 'Space category id' description. This gives the agent actionable parameter knowledge beyond the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a specific verb and resource: 'Check open slots on ONE specific date.' It also explicitly distinguishes itself from the sibling libcal_suggest, which is the cross-day ranked search, so an agent can clearly tell them apart.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description gives explicit when-to-use context ('on ONE specific date') and names the alternative for a different case ('For smart ranked search across days, use libcal_suggest instead'). This directly routes the agent to the correct sibling without leaving it to inference.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

libcal_list_calendarsA

List Apple Calendar calendar names (use one in ~/.unc-libcal/config.json as calendarName).

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

A4.3/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the behavioral burden. The verb 'List' clearly indicates a read-only operation with no destructive side effects, and the config.json reference provides useful context about where the result is consumed. It does not spell out authentication requirements, but for a simple listing tool the implied read-only nature is sufficient.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the action and resource, then appends the one essential usage hint. There is no filler or redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a zero-parameter, no-output-schema tool, the description fully covers what the tool does and why the agent would call it. It tells the agent the output (calendar names) and how to use it, making it complete enough for correct invocation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has zero parameters, so parameter semantics are largely not applicable; the baseline for zero parameters is 4. The description adds value by explaining how the output relates to config.json, which is more than the empty schema provides.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a clear, specific action ('List') and resource ('Apple Calendar calendar names'), which is immediately distinct from the sibling tools that check availability, book, authenticate, or suggest. It also tells the agent the practical outcome, selecting a name for config.json, so the purpose is unambiguous.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The parenthetical 'use one in ~/.unc-libcal/config.json as calendarName' implies when the tool is needed (before configuring a calendar) and how its output should be used. However, it does not explicitly state when to use this tool instead of a sibling, nor does it provide exclusions or prerequisites.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

libcal_suggestA

Find ranked booking options with same-day priority. Use BEFORE booking when the user has not given an exact date+time. BOOKING WORKFLOW (required):

  1. For open-ended requests ("book a room", "max hours", "soonest available") → call libcal_suggest FIRST.

  2. Present numbered options to the user. Explain the recommended option (usually same-day if available).

  3. Only call libcal_book after the user picks an option (or gives explicit date+time).

  4. Never auto-book a far-future date when sooner options exist. Categories: davis-cubes, davis-study-rooms, davis-computers

ParametersJSON Schema
NameRequiredDescriptionDefault
categoryNoSpace category id (default: davis-cubes)
max_optionsNoHow many options to return (default 5)
preferred_dateNoUser's preferred date YYYY-MM-DD (optional, boosts ranking)
prefer_same_dayNoPrioritize today if slots exist (default true)
duration_minutesNoDesired length in minutes (default 60; use 180 for max/LibCal limit)
preferred_start_timeNoUser's preferred start HH:MM (optional, boosts ranking)

TDQS

A4.5/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It discloses ranking behavior, same-day priority, numbered option output, and the recommended-option explanation. It does not detail return format or error/no-result behavior, but for a non-destructive suggestion tool the disclosed workflow is reasonably transparent.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is front-loaded with the core purpose and then gives a structured, actionable workflow. There is minor redundancy between the opening 'Use BEFORE booking...' and step 1, but the numbered format and categories list keep it scannable and useful.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with six optional parameters, no output schema, and no annotations, the description plus detailed input schema covers invocation behavior, defaults, categories, and the follow-up booking step. It does not cover the exact-date+time path to libcal_check_availability or what to do when no options are found, so it is not fully complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the baseline is 3. The description adds practical meaning beyond the schema by listing exact category values (davis-cubes, davis-study-rooms, davis-computers), clarifying duration semantics with 'use 180 for max/LibCal limit', and explaining preferred_date/preferred_start_time as ranking boosts.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a specific action ('Find ranked booking options') on a specific resource with a clear behavioral qualifier ('same-day priority'). It also positions the tool in the booking workflow relative to libcal_book, so an agent can distinguish when this tool is intended.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It explicitly says to use this tool BEFORE booking when the user has not given an exact date+time, provides a required numbered workflow, and names the condition for calling libcal_book instead. It also instructs the agent never to auto-book far-future dates when sooner options exist.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. 5 tool updatesv0.3.0
    • First observedlibcal_auth_status
    • First observedlibcal_book
    • First observedlibcal_check_availability
    • First observedlibcal_list_calendars
    • First observedlibcal_suggest

TDQS

A4.1/5.0
Disambiguation4/5

The core booking tools are clearly separated: check_availability is for a single date, suggest is for ranked multi-day searching, and book handles the actual reservation. Support tools like auth_status and list_calendars are distinct, though check_availability and suggest could still cause minor confusion without their descriptions.

Naming Consistency3/5

All tools share the libcal_ prefix and snake_case, but the patterns are mixed: some are verb_noun (check_availability, list_calendars), some are bare verbs (book, suggest), and one is noun_noun (auth_status). This is readable but not fully consistent.

Tool Count5/5

Five tools is a well-scoped set for a library booking server. Each tool serves a distinct role: availability checking, ranked suggestions, booking, authentication status, and calendar configuration.

Completeness2/5

The server covers finding and booking slots but lacks obvious lifecycle operations like listing existing bookings or cancelling a booking. Users or agents needing to modify or cancel a reservation would hit a dead end, which is a significant gap for a booking-focused server.

Maintenance

ActivityMaintained
ResponsivenessNo issues

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Thespaceblade/unc-libcal-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server