Skip to main content
Glama

UNC LibCal MCP

Servidor MCP para reservar espacios de estudio de UNC Davis Library desde Claude, Cursor, Codex o cualquier cliente MCP, con integración opcional de Apple Calendar.

Hecho para estudiantes, profesorado y personal de UNC con un Onyen válido. No está afiliado ni respaldado por UNC Libraries.

Qué hace

Pídele a tu agente:

Reserva un cubículo de Davis mañana a las 2 pm

El servidor hará lo siguiente:

  1. Comprobará la disponibilidad en LibCal (API pública — no se necesita inicio de sesión)

  2. Sugerirá opciones ordenadas (libcal_suggest) o reservará un espacio que confirmes (libcal_book)

  3. Completará la reserva en tu sesión del navegador (Playwright + inicio de sesión guardado de Onyen)

  4. Añadirá opcionalmente el evento a Apple Calendar (solo macOS)

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

Requisitos

  • Node.js 20+

  • UNC Onyen (para reservar; las comprobaciones de disponibilidad funcionan sin iniciar sesión)

  • macOS para la sincronización con Apple Calendar (opcional)

  • Chromium (se instala automáticamente mediante Playwright)

Inicio rápido

1. Clona e instala

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. Inicia sesión en LibCal

npm run login

Se abre un navegador → inicia sesión con tu Onyen (+ Duo si se solicita) → cuando se cargue la página de Davis LibCal, pulsa Enter en la terminal.

Tu sesión se guarda en ~/.unc-libcal/storage-state.json (nunca hagas commit de este archivo).

3. Configura (opcional)

En la primera ejecución, se crea ~/.unc-libcal/config.json con valores predeterminados:

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

Pide al agente que ejecute libcal_list_calendars y luego establece calendarName en tu Apple Calendar preferido. Concede el permiso de Automatización cuando macOS lo solicite (Terminal o Cursor → Calendar).

4. Conecta tu cliente MCP

Cada cliente necesita la ruta absoluta a dist/index.js. Desde dentro del repositorio:

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

O en una sola línea:

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

Todos los clientes siguientes ejecutan el mismo servidor stdio:

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

Reinicia el cliente después de editar la configuración.

Claude Desktop

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

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

Cierra y vuelve a abrir Claude Desktop por completo.

Cursor

Opción A — Interfaz: Settings → MCP → Add server → pega el bloque JSON de arriba.

Opción B — archivo de proyecto: .cursor/mcp.json en este repositorio (útil para compartir con compañeros):

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

Usa ./dist/index.js solo si el directorio de trabajo MCP de Cursor es la raíz del proyecto; de lo contrario, usa la ruta absoluta.

OpenAI Codex (CLI)

Codex usa TOML, no JSON. Archivo: ~/.codex/config.toml (o .codex/config.toml en un proyecto de confianza).

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

O mediante CLI:

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

Si los servidores no aparecen, confirma que el proyecto es de confianza (ejecuta codex trust en el repositorio) cuando uses un .codex/config.toml local del proyecto.

Claude Code (CLI)

Archivo: ~/.claude.json (global) o .mcp.json en el proyecto:

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

En una sesión de Claude Code, ejecuta /mcp para confirmar que las herramientas están cargadas.

Otros clientes MCP

Cualquier cliente que admita stdio MCP puede usar los mismos command + args. Configúralo para que apunte a dist/index.js después de npm run build.

5. Verifica que funciona

En tu agente, prueba:

Check libcal auth status

Luego:

Suggest Davis cubes for 2 hours tomorrow

Deberías ver libcal_auth_status, libcal_suggest, libcal_check_availability, libcal_book y libcal_list_calendars disponibles una vez que el servidor esté conectado.

Herramientas MCP

Herramienta

Requiere inicio de sesión

Propósito

libcal_suggest

No

Opciones de reserva ordenadas; prioridad para el mismo día a menos que especifiques una fecha

libcal_check_availability

No

Espacios disponibles en una fecha

libcal_book

Sí

Reserva un espacio confirmado + evento opcional de Apple Calendar

libcal_auth_status

Sí

Comprueba si la sesión guardada sigue siendo válida

libcal_list_calendars

No

Lista los nombres de Apple Calendar (macOS)

Flujo de reserva

  1. Para solicitudes abiertas («reserva un cubículo», «máximo de horas») → el agente llama primero a libcal_suggest

  2. El agente muestra opciones numeradas; tú eliges una

  3. El agente llama a libcal_book con user_confirmed: true y la fecha/hora elegida

libcal_book no se ejecutará sin confirmación explícita.

Categorías de espacios

ID

Descripción

davis-cubes

Cubículos de colaboración Davis (predeterminado)

davis-study-rooms

Salas de estudio en grupo Davis

davis-computers

Ordenadores del laboratorio de Data Services

Ejemplos de 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

Cómo funciona

  • Disponibilidad — API de cuadrícula de LibCal obtenida mediante ingeniería inversa (/spaces/availability/grid)

  • Reserva — Playwright maneja la interfaz real de LibCal: selecciona un espacio → envía los horarios → checkout en /spaces/auth → confirma el formulario

  • Calendario — AppleScript → Calendar.app (requiere permiso de Automatización de macOS)

Las sesiones caducan periódicamente. Ejecuta npm run login de nuevo cuando libcal_auth_status indique que ha caducado.

Scripts de CLI

# Refresh Onyen session
npm run login

# Run unit tests (38 tests)
npm test

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

# Check public bookings page / cancel-link availability
node dist/scripts/list-bookings.js

Cancelar reservas

UNC LibCal no expone una página de cancelación de «mis reservas» en la interfaz web. Cancela mediante el enlace del correo de confirmación de alerts@mail.libcal.com.

Límites de LibCal (UNC Davis)

  • Hasta 3 horas al día, en segmentos de 30 minutos / 1 hora

  • Los espacios populares pueden ocuparse entre la sugerencia y la reserva

  • Los cubículos pueden requerir un «nombre de curso o grupo» en el formulario de checkout (por defecto, bookingPurpose en la configuración)

Desarrollo

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

Advertencias

  • Herramienta de automatización personal: úsala con responsabilidad y sigue las políticas de UNC Library

  • Solo probada con calendar.lib.unc.edu (UNC Chapel Hill)

  • Otras instituciones de LibCal necesitarían constantes lid/gid diferentes en src/libcal/constants.ts

Licencia

MIT — consulta 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.

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

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

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).

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

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.

  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

Scored across 5 tools

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

ActivitySlowing
ResponsivenessUnresponsive

Related MCP Connectors

Related MCP Servers