AI
MCP server
XFiles speaks the Model Context Protocol, so an AI agent can read these docs and work with your project directly — upload and serve files, fill a search collection, publish live events, notify users, set up email and send it.
What it does
| Endpoint | https://www.xfiles.dev/api/mcp |
| Transport | Streamable HTTP, stateless: every request stands alone, nothing is kept between them. |
| Authorization | Bearer xf_… — a project's API key. Or an organization key with X-XFiles-Project. |
| Without a key | The docs tools still work, so an agent can learn XFiles before you sign up. |
| Billing | Calls go through the public API as you: the same limits, the same prices, from your balance. |
Connect your agent
Make a project for the agent and copy its key (dashboard: project menu → New project). Then add the server to your client.
1claude mcp add --transport http xfiles https://www.xfiles.dev/api/mcp \2 --header "Authorization: Bearer xf_…"1{2 "mcpServers": {3 "xfiles": {4 "url": "https://www.xfiles.dev/api/mcp",5 "headers": { "Authorization": "Bearer xf_…" }6 }7 }8}1{2 "servers": {3 "xfiles": {4 "type": "http",5 "url": "https://www.xfiles.dev/api/mcp",6 "headers": { "Authorization": "Bearer xf_…" }7 }8 }9}Other clients: Any client that speaks Streamable HTTP and can send a header connects the same way: the endpoint above and an Authorization header. Keep the key out of files you commit — most clients read it from an environment variable.
Tools
24 tools, each described for the agent with what it does and what it costs. Read-only tools are marked so clients can run them without asking; deleting is marked as destructive.
Docs
search_docsno key | Search XFiles' complete reference (the files API, bundles, Next.js, search, live updates, chat, notifications, multiplayer, email, organizations, billing, limits and errors). Returns the best sections with their ids; read one in full with read_docs. Use this before writing code against XFiles. |
read_docsno key | Read a section of XFiles' reference in full, with the sections under it. Give the id search_docs returned, or a section title. Without a section, returns the table of contents. |
Files
list_filesreads | List the project's files, 20 a page — each with its CDN url and, for images with variants, the url of every width. Filter by the object a file is attached to, its owner or visibility. |
get_filereads | One file's details, its CDN url (signed, 5 minutes, when private) and its image variants. |
upload_filechanges | Store a file in the project and serve it from the CDN: text as it is, or binary as base64 (up to 3 MB; larger files go through the REST API's upload flow). Images can get resized WebP variants (100–1200 px wide). Returns the file and its url. Uploading draws on the account's credit. |
get_file_urlreads | A fresh CDN url for one file: permanent when public, signed for 5 minutes when private. list_files and get_file already include urls; use this only to re-sign a private one. |
update_filechanges | Change a file's visibility, owner, display position, or whether it has image variants. |
delete_filedeletes | Delete a file: it leaves the CDN and every listing at once. It can be restored with restore_file for 30 days. |
restore_filechanges | Undo a delete, within 30 days of it. |
Search
list_search_collectionsreads | The project's search collections, each with its settings, document count and state. |
create_search_collectionchanges | Create a search collection, or change its settings. fields declares what is indexed: { name, type: "string" | "string[]" | "int" | "float" | "bool" | "date" | "geo", weight?: 1–10, facet?, filter?, sort? }. visibility: "public" (anyone with a search token), "users" (signed-in users) or "restricted" (per-document _access; the default). A change the engine cannot make in place rebuilds the index without downtime. |
index_documentschanges | Add or replace documents in a collection, up to 1,000 at a time, all or nothing. Each document needs an id. They are searchable within about a second. |
delete_documentsdeletes | Remove documents from a collection by id, up to 1,000 at a time. |
searchreads | Search a collection with typo tolerance. filters are data, e.g. { "brand": ["Acme"], "price": { "gte": 10, "lte": 100 } }; facets returns counts per value; sort is "field:asc", "field:desc" or "_relevance". |
Live updates
publish_eventchanges | Send an event to everyone subscribed to a channel, over the project's WebSocket connections — e.g. channel "orders:42", event "status", data { "status": "shipped" }. persist keeps it 7 days so late subscribers can catch up. |
Notifications
send_notificationchanges | Notify users of your app: in-app, live, and as web push on the devices they allowed. Up to 1,000 users at a time; dedupeKey makes a retry send nothing twice. |
email_domainreads | The project's email domain: its state, and every DNS record to publish with whether it passes. A project has one email domain; register it with register_email_domain. |
register_email_domainchanges | Start email on a domain the user owns, e.g. yourbusiness.com. Returns the ownership TXT record to publish; after that, email_domain lists the mail records. XFiles checks every few minutes, and verify_email_domain checks now. |
verify_email_domainchanges | Check the email domain's DNS now instead of waiting for the next automatic check; activates it when every required record passes. |
list_mailboxesreads | The project's mailboxes, with their addresses, state and storage. |
create_mailboxchanges | Create a mailbox on the project's domain, e.g. localPart "anna" for anna@yourbusiness.com. A mailbox is charged by the day while it exists (read_docs "Prices"). externalId (your user's id) makes a retry return the same mailbox. |
send_emailchanges | Send an email from a mailbox, as its own address (or from, one of its aliases). Give the same idempotencyKey when retrying, so it is never sent twice. Returns the message and its delivery, whose status says what happened to each recipient. |
list_emailsreads | A mailbox's messages, newest first, with sender, subject and a preview. q searches the text; unread and hasAttachments narrow it. Pass next back as cursor for the following page. |
read_emailreads | One message in full: sender, recipients, text and HTML, and its attachments. |
What to ask
Agents pick the tools themselves. A few things to try:
| Files | “Upload ./logo.png as a public image with variants, and give me the 400 px url.” |
| Search | “Make a products collection from products.json — title weighted, brand as a facet — and search it for ‘wireless keybaord’.” |
| Live | “Publish a status event with { status: "shipped" } on orders:42.” |
| “Register mail.acme.example for email and tell me which DNS records to add.” | |
| Docs | “How do I give a browser a token for search only? Check the XFiles docs first.” |
Keys and safety
A key opens exactly one project, and the agent can do anything that project's key can. Give each agent — or each experiment — a project of its own: deleting the project ends everything the agent made. The server keeps nothing: no key, no session, no log of what was sent. Calls carry your origin on, so a project's allowed origins still apply.
Uploads: upload_file takes text or base64 up to 3 MB. Larger files go through the upload flow, straight to storage.
Troubleshooting
| “needs a project’s API key” | The client sends no Authorization header. Check the header in its configuration, and restart the client. |
401 | The key is wrong or was rotated. Copy the current key from Keys & access. |
402 | The account is out of credit. Add credit under Billing. |
403 | An origin the project does not allow, or a suspended account. |
| Nothing at all | Check the client speaks Streamable HTTP. A GET to the endpoint answers 405 — it takes POST only. |
Building with an AI assistant?
Point it at the complete reference, or connect the MCP server so it can read these docs and use your project.