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

# OnTime for AI agents

> What the MCP server lets an agent do, the two ways to authenticate, and why an agent is never more powerful than the person it acts as.

OnTime exposes a **Model Context Protocol** server, so an AI agent — Claude, ChatGPT, or your own — can operate the product directly: check a team's attendance, file a leave request, clear an approvals queue, run a payroll cycle.

## The endpoint

```text theme={null}
POST https://app.ontime.hosai.app/api/mcp
```

JSON-RPC over HTTP. It is not part of the REST API and does not appear in the API Reference.

## Identity is the whole design

<Warning>
  **An agent acts as a specific employee, with exactly that employee's permissions and scope.**

  This is the property everything else rests on. A credential bound to a team lead can approve their direct reports' leave and nobody else's. A credential bound to an ordinary employee can punch and apply for leave and see nothing about anyone else.

  An agent is never more powerful than the person it acts as. A compromised agent key is exactly as dangerous as that person's password — no more.
</Warning>

Around 71 tools are exposed, but **what any given credential sees is a subset**. Tools whose permission the credential lacks are not listed at all — they are invisible, not visible-then- denied.

## Two ways to authenticate

<CardGroup cols={2}>
  <Card title="API key" icon="key">
    An `ont_…` key issued in the admin console, **bound to an employee**. Sent as a bearer token.

    Best for Claude Code, scripts, and anything that can set a header. See [Claude Code](/ai-mcp/connect/claude-code).
  </Card>

  <Card title="OAuth" icon="shield">
    An `oat_…` access token obtained through OnTime's OAuth 2.1 facade. Used by hosted connectors that will not accept a static key.

    Required for claude.ai, Claude Desktop and ChatGPT. See [Claude](/ai-mcp/connect/claude).
  </Card>
</CardGroup>

<Note>
  **An OAuth login is always employee-bound.** There is no service-account path through OAuth — authorizing a connector means authorizing it as *you*.
</Note>

### Service keys

An API key that is **not** bound to an employee is a *service key*. It gets a narrower, org-level view and cannot call any tool that requires an employee identity — self-service tools, anything using approval scope. Bind a key to an employee unless you specifically want the narrower surface.

## What an agent can do

<CardGroup cols={2}>
  <Card title="Self-service" icon="user">
    Punch, check the day, apply for leave, request a regularization or overtime, read payslips.
  </Card>

  <Card title="Team management" icon="users">
    See who is in, drill into a report, clear the approvals queue for leave, regularizations and overtime.
  </Card>

  <Card title="Administration" icon="settings">
    Create and update employees, departments, locations, roles; edit shift templates, rosters, holidays and swaps; run reports.
  </Card>

  <Card title="Payroll & compliance" icon="indian-rupee">
    Start and advance a payroll cycle, review it, apply overrides, disburse; generate filings, registers and Form 16.
  </Card>
</CardGroup>

The full list is in the [tool catalog](/ai-mcp/tool-catalog).

## Guardrails

<AccordionGroup>
  <Accordion title="Permissions and scope, server-side" icon="shield">
    Every tool declares the permission it needs, and scope-checked tools verify the subject employee is in the actor's scope. Both are enforced by the same code the web app uses — not reimplemented for MCP.
  </Accordion>

  <Accordion title="The same-actor rule still applies" icon="user-x">
    An agent acting as you cannot approve your own requests.
  </Accordion>

  <Accordion title="Every write is audited" icon="scroll-text">
    Mutations through MCP land in the same audit log as mutations through the web app, attributed to the bound employee.
  </Accordion>

  <Accordion title="Four tools are confirm-gated" icon="triangle-alert">
    Deleting a holiday, disbursing payroll, filing a compliance return and generating Form 16 all require an explicit human "yes" in the conversation before the agent calls them. See [Security](/ai-mcp/security).
  </Accordion>
</AccordionGroup>

## Where to go next

<CardGroup cols={2}>
  <Card title="Quickstart for agents" icon="rocket" href="/ai-mcp/quickstart-for-agents">
    Written for the agent: conventions, discovery, and how to not get things wrong.
  </Card>

  <Card title="Connect a client" icon="plug" href="/ai-mcp/connect/claude">
    Claude, Claude Code, or ChatGPT.
  </Card>

  <Card title="Tool catalog" icon="list" href="/ai-mcp/tool-catalog">
    All 71 tools with permissions and read/write annotations.
  </Card>

  <Card title="Troubleshooting" icon="circle-help" href="/ai-mcp/troubleshooting">
    401s, missing tools, refused writes.
  </Card>
</CardGroup>
