# Connect an AI agent over MCP

> Point an MCP client at Staffedly with an API key so an agent can read your schedule and propose changes that a person approves.

Staffedly runs an MCP (Model Context Protocol) server. An AI agent that speaks MCP can use it to answer questions from your live data and to propose changes. A proposal never takes effect by itself: a person approves or declines it in Staffedly.

## What you need

- A Pro, Agency, Enterprise or trial organization. Core does not include the MCP server.
- An API key from **Settings → API**, with the permissions the agent should have. See [API keys and permissions](https://staffedly.com/docs/developers/api-keys).
- An MCP client that can send a custom `Authorization` header to a remote server.

> **Sign-in is by API key only.** The server does not offer OAuth yet. Chat apps that can only connect to an MCP server through an OAuth sign-in cannot connect today. The server has been verified with the official MCP client library (`@modelcontextprotocol/sdk`); it has not yet been verified inside individual agent products.

## Connection details

| Setting | Value |
| --- | --- |
| Address | `https://app.staffedly.com/api/mcp` |
| Transport | Streamable HTTP, stateless. `POST` only; `GET` and `DELETE` answer 405 |
| Sign-in | Header `Authorization: Bearer sfk_…` |
| Protocol versions | `2025-06-18`, `2025-03-26`, `2024-11-05` |
| Batches | Up to 20 JSON-RPC messages in one request |
| Offers | Tools only. Resources and prompts are empty lists |

The same rules apply as for the REST API: the 120 requests a minute limit, key expiry and revocation, and the plan check.

## Connect with the official client library

```js
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js";

const transport = new StreamableHTTPClientTransport(new URL("https://app.staffedly.com/api/mcp"), {
  requestInit: { headers: { Authorization: `Bearer ${process.env.STAFFEDLY_API_KEY}` } },
});
const client = new Client({ name: "my-agent", version: "1.0.0" });
await client.connect(transport);

const { tools } = await client.listTools();
const answer = await client.callTool({ name: "open_gaps", arguments: {} });
console.log(answer.content[0].text);
```

## Clients set up with a JSON file

Some agent tools read their MCP servers from a JSON file. For a tool that supports a remote HTTP server with custom headers, the entry looks like this. The same snippet is shown in the app under **Settings → API**, **Connect an AI agent**.

```json
{
  "mcpServers": {
    "staffedly": {
      "type": "http",
      "url": "https://app.staffedly.com/api/mcp",
      "headers": { "Authorization": "Bearer sfk_your_key" }
    }
  }
}
```

The exact file and field names depend on the tool; check its own documentation. Make a separate key for each agent, with only the areas it needs, so you can see what each one did and revoke one without touching the others.

## Try it with curl

```bash
curl -X POST "https://app.staffedly.com/api/mcp" \
  -H "Authorization: Bearer $STAFFEDLY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"open_gaps","arguments":{}}}'
```

```json
{ "jsonrpc": "2.0", "id": 1, "result": { "content": [{ "type": "text", "text": "Summit Surgical Center · Nov 27, 06:00 EST · CRNA · normal · open · 0 offer(s)" }], "isError": false } }
```

## The tools

`tools/list` shows a key only the tools its permissions cover. People and sites are given by name, not by id. Dates are `YYYY-MM-DD`.

### Tools that read

| Tool | Answers | Permission the key needs |
| --- | --- | --- |
| `coverage_today` | Today's coverage by site, with required against scheduled | `schedule:read` |
| `who_is_working` | Who is working on a date, optionally at one site | `schedule:read` |
| `who_is_off` | Active people not working on a date | `schedule:read` |
| `open_gaps` | Open shifts: site, time, role, severity, status, offers so far | `schedule:read` |
| `open_issues` | Open issues with their response clocks | `schedule:read` |
| `call_equity` | The call equity ledger for each person | `schedule:read` |
| `swap_board` | Open swaps: who offered, which shift, claims so far | `schedule:read` |
| `rules_current` | The active scheduling rules and their settings | `schedule:read` |
| `upcoming_leave` | Approved and requested time off in the coming days | `leave:read` |
| `documents_status` | What is out for signature, and who is missing a required document. Never file contents | `documents:read` |
| `recruiting_status` | Open jobs with the number of applicants in each stage, where shifts keep going unfilled, and how many new hires are onboarding. No applicant is named | `recruiting:read` |
| `onboarding_status` | Everyone with an open onboarding checklist: steps done, what each person still owes, what is waiting on the office, and whether the link was sent and opened. Optionally one person by name. Never bank details, addresses or files | `onboarding:read` |
| `hours_report` | Hours logged this month by person | `time:read` |
| `anomalies` | Clock records that look wrong, such as a missing clock-out | `time:read` |
| `provider_lookup` | A person by name: role, status, credentials (never license numbers), upcoming shifts | `roster:read` and `credentials:read` |
| `payroll_preview` | What a pay run for a period would contain, from approved hours and the pay rules: hours, gross pay, each person's gross, hours with no pay rate, and how many entries are still waiting for approval. Changes nothing | `pay:read` |
| `pay_runs` | Recent pay runs: period, status, hours and gross | `pay:read` |
| `invoice_preview` | What an invoice to one site for a period would bill: hours, each line and the total. Changes nothing | `pay:read` |
| `invoice_status` | Unpaid and overdue invoices with number, site, total, balance and due date, plus drafts not sent yet. Optionally one site | `pay:read` |
| `video_calls` | Upcoming video calls, or past calls and uploaded call notes with whether notes are ready; optionally about one applicant, provider or site. Needs video calls on your plan | `meetings:read` |
| `last_call_notes` | What was said on the latest call (or uploaded call notes) about a person or site, or with a guest of that name: the AI summary, key points and follow-ups as written. Never the transcript, and never a rating of anyone | `meetings:read` |
| `booking_pages` | Your booking pages: length, who each is for, hosts and whether they have hours set, on or off, link | `meetings:read` |
| `forms_list` | Forms and surveys with status and number of answers | `forms:read` |
| `form_answers_summary` | One form's answers summed up: counts for choices and yes/no, average and spread for ratings, how many were marked worth a look. Figures for the form, not a verdict on anyone; written answers are not repeated | `forms:read` |
| `open_incidents` | Incident reports whose issue is still open: when, the issue's title, severity | `forms:read` |
| `ask_handbook` | An answer from your published handbook pages, with the pages it came from, or "not in the handbook" | `handbook:read` |
| `handbook_unconfirmed` | Who has not yet confirmed a must-read handbook page | `handbook:read` |
| `facility_contacts` | A site's contacts: name, title, email, phone, and whether they get the daily roster or the site's emails | `relationships:read` |
| `record_conversation` | The recent email conversation on a site's or provider's record. Not applicants | `relationships:read` |
| `offer_status` | Job offers and where each stands, for one applicant or all | `offers:read` |
| `run_report` | A summary report: `fills` (needs `schedule:read`), `hours` (`time:read`), `credentials` (`credentials:read`) | One of those, by report |

### Tools that propose a change

Each of these creates a proposal in [Approvals](https://staffedly.com/docs/run/approvals). Nothing changes until a person approves it.

| Tool | Proposes | Permission the key needs |
| --- | --- | --- |
| `create_open_shift` | Posting an open shift at a site | `schedule:write` |
| `register_call_off` | Recording a call-out, which releases the person's shifts and starts the fill | `schedule:write` |
| `draft_offers` | Sending ranked offers for an existing open shift | `schedule:write` |
| `set_leave` | Recording time off for a person | `leave:write` |
| `send_for_signature` | Sending a document template for signature | `documents:write` |
| `start_onboarding` | Starting a new hire's onboarding: they join the roster as onboarding and are emailed their checklist. Name and email are required | `onboarding:write` |
| `open_job` | Opening a job on the careers page. A pay range is required | `recruiting:write` |
| `invite_past_applicants` | Emailing past applicants for the same role an invitation to apply for an open job | `recruiting:write` |
| `create_provider` | Adding a person | `roster:write` |
| `add_credential` | Adding a credential to a person | `credentials:write` |
| `assign_provider` | Putting a person on a shift at a site | `schedule:publish` |
| `release_assignment` | Releasing a person's shift on a date | `schedule:publish` |
| `schedule_video_call` | Scheduling a video call; on approval each guest is emailed their join link and the recording notice | `meetings:write` |
| `send_booking_link` | Emailing one applicant, provider or site contact a private link to book a call from a booking page | `meetings:write` |
| `send_form` | Emailing an open form to people by name | `forms:write` |
| `add_todo` | Giving a team member a to-do. The agent must say who it is for: a key cannot keep one itself | `todos:write` |

## Proposals and approvals

A tool that changes something never acts on its own. This holds even when your [Automation settings](https://staffedly.com/docs/run/automation-settings) let the same action run automatically inside the app, and even when the key could make the change directly over the REST API. The key's permissions decide what an agent may propose; a person decides what happens.

On the Approvals screen each proposal says where it came from, for example: an AI agent using the API key "Scheduling assistant". Approving and declining are not tools. Only a signed-in person can decide.

Tool calls and proposals are written to the [Audit log](https://staffedly.com/docs/run/audit-log) with the key that made them.

## What an agent cannot do

Not offered over MCP at all: publishing or generating a schedule, approving hours, changing rates, inviting teammates, creating sites, sending messages, reading message history, reading the team list, and reading the audit log. Also not offered: adding a note to a record, starting a call link, drafting an announcement or a group email, drafting or sending a job offer, and reading call transcripts. Notes and transcripts are available over the REST API with their own permissions (see [API keys and permissions](https://staffedly.com/docs/developers/api-keys)).

## Questions

### Can I connect ChatGPT or Claude.ai to Staffedly?

Not as a documented flow today. Those apps connect to remote MCP servers through an OAuth sign-in, which Staffedly does not offer yet. An agent you run yourself, with a client that sends an `Authorization` header, can connect now.

### What happens when the key lacks a permission?

The tool is left out of `tools/list`. Calling it anyway returns a tool error that names the missing permission, so the agent can tell the user.

### Does each tool call count against the rate limit?

Each HTTP request counts once, whether it carries one message or a batch of up to 20.
