Key takeaways
- Give the AI vendor read-only access only: one named bearer key per consumer, read scope, and no write tools without the owner's written approval per tool.
- Six GET endpoints cover most questions: projects, one job's financials, the WIP schedule, card expenses, grades and an OpenAPI description.
- The MCP endpoint exposes the same data as six read-only tools over streamable HTTP; MCP is off by default and enabled per key with a tool allow-list.
- Every MCP call passes origin, a company kill switch, key, scope, per-key enablement, a rate limit (60 a minute by default) and the tool allow-list, and is logged either way.
- Keys are shown once, stored hashed, handed over through a vault or one-time link, reviewed monthly and revocable in one click.
- Credentials, tokens, users, the audit log and all write actions never go through the API, and tool output is scrubbed of secret-looking fields.
- A key belongs to a system, so use the embed with each person's own login for user-facing answers.
55 seconds · From a Build Flows walkthrough
Plug it into an AI platform: iframe, read-only API, MCP
Embed the OS by iframe, give agents read-only API keys, and expose an MCP server that can be switched on or off per capability.
Read the clip transcript
we do have an MCP here as well. So this is how they're wanting to embed the operating system within their AI platform. And so there is the, you can embed it just via iframe here, and you could then get access to the read-only agent API, which then we have our API keys that we have access to, and then the MCP server that any agent can then go through and use to gain access to, be able to do approvals, and we can even remove access to do an update specific things. But it could also give you access to any outstanding bills, any alerts, any data, outstanding projects, or progression on how it's developing. And then that can then be leveraged and turned on or off. And then we have our endpoints for agents as well. And so as agents are developing and leveraging these endpoints, they have access to it as well. So it's quite robust, fully functional and developed.
Captions adapted from the source video; proper names may reflect automatic transcription. Original segment: 28:26–29:20. Watch at the source.
More contractors are hiring an AI vendor to build an assistant over their email, files and project data. Sooner or later that vendor asks for access to the numbers: WIP, job cost, uncoded spend, project grades. This guide shows how we answered that request in the operating system we built for Cattlemen Construction Services in Fort Worth, Texas: read-only agent endpoints behind revocable bearer keys, an MCP endpoint over streamable HTTP with a per-key tool allow-list and rate limit, a log line for every call, and a short list of things the vendor never gets. The commands and config below are ready to copy, with placeholder keys.
Cattlemen's AI vendor is building what the company calls its "brain." Our job was to let that brain read the operating system without giving it a way to change anything. The app runs on sample data in the screenshots. To see the screens, watch the walkthrough; the AI brain and API page starts at about 27:50. The planning conversation that led here, and the three integration patterns in general terms, are in embedding a construction dashboard in an AI assistant. This guide is the build.
One read-only door for the AI vendor
Three ways in, one rule
The admin page in the app offers three connection types. All three are read-only.
Three ways for the AI vendor to connect (sample data)
| Option | Who it's for | Identity | Good for |
|---|---|---|---|
| Embed the OS (iframe) | People using the vendor's app | The person's own login, so their role applies | Showing the scorecard or coding queue inside the assistant's screen |
| Read-only agent API | The vendor's backend and agents | A named API key | Scheduled pulls, summaries, answering "what's billed on 26-001?" |
| MCP server | Any MCP-aware assistant or agent | The same API key, with MCP turned on for it | Live questions from Claude or the vendor's agents, without custom code |
On the call, Charley summed up the first two: "you can embed it just via iframe here, and you could then get access to the read-only agent API." The rule behind all three comes from the access principles we agreed with Cattlemen: agents get read-only, scoped keys, one per agent or vendor, and no write tools for QuickBooks, Procore or Microsoft 365 without the owner's explicit, written approval per tool. If a write tool ever arrives, it goes through the same approval queue people use: the agent proposes, a person approves.
The agent endpoints
Every endpoint is a GET, authenticated with an Authorization: Bearer header. Cookies are ignored, so a signed-in browser can't call these by accident, and a key can't be used to drive the web app.
| Endpoint | Returns |
|---|---|
GET /api/v1/projects?status=active | Projects with number, client, status, PM, revised contract, cost to date, projected margin %, grade, rank, health and uncoded card spend. status is optional: pursuit, won, active, closed or lost. |
GET /api/v1/projects/{number}/financials | One job: contract, changes, budget, committed, cost to date (QuickBooks and Procore), EAC, projected margin, % complete, earned, billed to date, over/under billing, cash received, retainage, AR open, cost gap |
GET /api/v1/wip | The WIP schedule: per job revised contract, EAC, cost, % complete, earned, billed, over/under billing, projected margin %, backlog, plus totals |
GET /api/v1/expenses?status=&project=&limit= | Card expenses and their coding status, newest first. limit up to 500. |
GET /api/v1/grades | Project grades (0–100), bands, pillar scores and rank |
GET /api/v1/openapi | The machine-readable description of these endpoints, for the vendor's tooling |
Agent endpoints with placeholder keys (sample data)
To try one, keep the key in an environment variable so it never sits in your shell history or a script:
# Put the key in the environment once (paste it at the prompt, don't type it into a file)
read -rs COS_API_KEY && export COS_API_KEY
# One job's financials
curl -s -H "Authorization: Bearer $COS_API_KEY" \
"https://os.example.com/api/v1/projects/26-001/financials"
# Active projects
curl -s -H "Authorization: Bearer $COS_API_KEY" \
"https://os.example.com/api/v1/projects?status=active"
# Card expenses waiting on a cost code for one job
curl -s -H "Authorization: Bearer $COS_API_KEY" \
"https://os.example.com/api/v1/expenses?status=to_code&project=26-001&limit=50"
Replace os.example.com with your app's host. Expense status is one of to_code, coded, approved, synced, error or excluded. /api/v1/openapi lists every parameter.
What a refusal looks like:
| Response | Meaning |
|---|---|
401 Send Authorization: Bearer <API key> | No header, or not a key from this app |
401 Invalid or revoked API key | Wrong key, or someone revoked it |
403 This key has no read scope | The key exists but can't read |
403 The AI & agent API is switched off for this company | The company-wide switch is off |
That last one is a kill switch. A super admin can turn the whole AI and agent API off in Flags & security, and every key stops working at once, without revoking them one by one.
The MCP endpoint
The Model Context Protocol lets an assistant discover and call named tools. If MCP is new to you, start with what MCP is. The app exposes the same read-only data as the agent API through six tools:
| Tool | What it returns | Inputs |
|---|---|---|
list_projects | Projects with number, client, status, PM, contract, cost, margin, grade, rank, health and uncoded spend | status (optional) |
project_financials | The financial snapshot for one job | number, e.g. "26-001" |
wip | The WIP schedule with totals | none |
expenses | Card expenses and coding status | status, project, limit (all optional) |
grades | Grades, bands, pillar scores and rank | none |
kpis | Company KPIs: gross margin, margin fade, over/under billing, DSO, AR over 60, backlog months, cash runway, uncoded spend, coding on time, average grade, with green, amber or red status | none |
Every tool is annotated read-only.
How it's served
- One endpoint:
POST /mcp, streamable HTTP, JSON responses. Every tool is a quick read, so there's no long-lived event stream.GETandDELETEon/mcpreturn 405. - Stateless. No session ID is issued; the spec makes sessions optional for servers.
- Protocol versions: clients on 2025-03-26, 2025-06-18 and 2025-11-25 use the usual
initialize, thentools/listandtools/call. Newer clients that send the protocol version on every request are supported too. - Same keys as
/api/v1. MCP is off by default for every key. An admin turns it on per key and picks which tools that key may call.
The MCP endpoint and client config, with a placeholder key (sample data)
Client config
Most MCP clients that support remote HTTP servers accept a block like this. The name is up to you; the key is a placeholder.
{
"mcpServers": {
"contractor-os": {
"type": "http",
"url": "https://os.example.com/mcp",
"headers": {
"Authorization": "Bearer cos_YOUR_KEY_HERE"
}
}
}
}
Two cautions. Config files like this are often stored in plain text in the user's profile, so put the key in the client's secret store or an environment variable if it supports one, and never commit the file to a repository. And field names differ between clients, so check your client's documentation for remote servers; some use url with a headers map, some take the header on a command line.
Test it with curl
Before handing the endpoint to the vendor, confirm it answers and lists only the tools you meant to allow:
curl -s https://os.example.com/mcp \
-H "Authorization: Bearer $COS_API_KEY" \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-H "MCP-Protocol-Version: 2025-06-18" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'
Then call one tool:
curl -s https://os.example.com/mcp \
-H "Authorization: Bearer $COS_API_KEY" \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-H "MCP-Protocol-Version: 2025-06-18" \
-d '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"project_financials","arguments":{"number":"26-001"}}}'
If the tool isn't on the key's allow-list, the call is refused and logged. If tools/list shows a tool you didn't expect, fix the key's policy before the vendor connects.
Every check, in order
Every check passes, or no tool runs
- Origin. If the request carries an
Originheader, it must be the app's own origin or on the embed allow-list. This stops a random web page in someone's browser from calling the endpoint. - Company switch. The AI and agent API must be switched on.
- Key. A bearer key that exists and isn't revoked. Keys are looked up by their hash.
- Scope. The key has
readscope. There is no write scope to grant. - MCP enabled for this key. Off by default.
- Rate limit. 60 calls a minute per key by default, adjustable from 1 to 600. Over the limit gets a 429 with
Retry-After. - Tool allow-list. The tool must be one this key is allowed to call. Leaving the list empty means none; "all tools" means every read tool, including ones added later, so pick that only on purpose.
Refusals are logged too, with a cap so a flood of bad requests from one IP can't fill the audit table: the first five in ten minutes are logged, then one "suppressed" line, and past thirty the IP gets a 429 before any key lookup.
The general hardening checklist for MCP servers (transport, timeouts, error envelopes, prompt injection from fetched content) is in hardening MCP servers for production. This app passes the parts that apply to a read-only server; the rest matter once you add writes.
Keys: create, hand over, review, revoke
The life of one vendor key
- One key per consumer. "AI vendor, assistant" and "AI vendor, nightly digest" are two keys. The log then tells you which system made each call, and you can revoke one without breaking the other.
- Shown once. The full key appears once at creation. The app stores a hash and a short prefix so you can tell keys apart in the list. Nobody, including us, can read it back later.
- Handed over safely. Use a one-time secret link or put it straight into the vendor's vault. We wrote up the habits that stop keys leaking in secure API key handoff.
- Revocable in one click. Revoking takes effect on the next request. The key list keeps the revoked key with its date, which is useful when the vendor asks why their test stopped working.
- Only admins manage keys. Creating, revoking and changing MCP policy need the
apikeys.managecapability, and all three are refused during a view-as session. See roles and view-as.
Test keys, revoked after use (sample data, prefixes blurred)
Logging
Every agent API call is written to the audit log as api.read with the key, path and query. Every MCP tool call is written as mcp.call, and every refusal as mcp.denied with the reason. Each key's "last used" time updates on every call.
What to look at once a month:
- Keys with no calls in 30 days. Revoke them.
- A key calling far more than its job needs. A nightly digest shouldn't make 3,000 calls.
- Refusals. A burst of
mcp.deniedfor a tool not on the allow-list usually means the vendor's agent wants something you haven't agreed to give it. Talk about it before you widen the list.
What never goes to the vendor
The tool outputs are the same serializers the app's own API uses, and as a second layer, any field whose name looks like a secret (password, token, secret, hash, API key, refresh, credential) is stripped before it leaves. Separately, these are never exposed through keys or MCP at all:
- Write actions of any kind: coding, approving, QuickBooks writes, Procore changes, Microsoft 365 actions
- Credentials: QuickBooks, Procore, Ramp and Microsoft OAuth tokens (stored encrypted and never returned by any API), API keys, password hashes, two-step secrets
- People administration: the user list, roles, sessions, invites
- The audit log itself, settings and connection details
- Anything not on the six-tool list. New tools are added in code, reviewed and shipped; nothing appears in the API because a table happened to exist.
The limit to be honest about
An API key belongs to a system, not a person. A key with access to project_financials can read any job's financials. That's right for the vendor's backend building an owner's Monday summary. It's wrong if the vendor's assistant uses that one key to answer a superintendent's question, because the superintendent would see numbers their own login hides.
So for anything user-facing, use the embed, where people sign in with their own account and their role applies. The MCP specification describes OAuth-based authorization for HTTP servers, which is how a per-user identity can reach the server, and that's the natural next step if the vendor needs per-user answers from agents. Until then, give keys only to uses an owner would be comfortable reading over the shoulder of. The wider question of how far to let agents act is in the AI agent write governance ladder.
Before you hand over a key
The printable AI vendor access checklist has the full list. The short version:
- Write down what the vendor needs to answer, in plain questions. Map each to an endpoint or tool.
- Create one named key per use. Hand it over through a secret link or vault.
- Turn on MCP only for keys that need it, with only the tools they need, and a rate limit that fits the job.
- Run
tools/listwith the key and check the list. - Confirm the vendor stores the key in a vault, not in code, chat or a prompt.
- Agree in writing: read-only, no write tools without the owner's written approval per tool.
- Put a monthly review on the calendar: last used, call counts, refusals.
- Know where the kill switch is.
Next step
Ask your AI vendor for the list of questions their assistant needs to answer from your project and financial data. If every one maps to a read-only endpoint or tool, you're ready to issue a key. If some need writes, that's a separate conversation, with an approval queue in the middle.
If you'd like this kind of read-only door built over your own Procore, QuickBooks and Ramp data, email charley@buildflows.ai or tell us what you're building.
Frequently asked questions
Can I give an AI tool read-only access to Procore and QuickBooks data?
Yes, and a safe way is through a layer you control instead of handing over Procore or QuickBooks credentials. Expose a small set of read-only endpoints or MCP tools over the data you already sync, authenticate them with a named, revocable key, and log every call.
What is an MCP endpoint over streamable HTTP?
It is a single HTTPS URL, usually /mcp, that accepts Model Context Protocol messages as POST requests. A client lists the server's tools and calls them with JSON-RPC. Read-only servers can answer every call with a plain JSON response and need no sessions or long-lived streams.
How do I add a remote MCP server to an AI client?
Most clients that support remote HTTP servers accept an entry with the server's URL and an Authorization header, for example a type of http, the /mcp URL and Bearer followed by the key. Store the key in the client's secret store or an environment variable where possible, never in a shared file or repository, and check your client's documentation because field names vary.
How should API keys for an AI vendor be managed?
Create one key per consumer and name it for that use. Show it once and store only a hash. Hand it over through a one-time secret link or the vendor's vault, never email or chat. Review last-used times and call volumes monthly, revoke unused keys, and keep a company-wide switch that turns all AI access off at once.
What rate limit should an MCP server set per key?
Start with something modest, such as 60 calls a minute per key, and adjust it to the job. A nightly digest needs far fewer; an interactive assistant might need more. Return 429 with a Retry-After header when a key goes over, and log it.
What should never be exposed to an AI vendor's agents?
Write actions of any kind, credentials such as OAuth tokens, API keys, password hashes and two-step secrets, user and role administration, the audit log, settings and connection details. Strip any secret-looking field from tool output as a second layer.
Is one API key safe for a user-facing AI assistant?
Not on its own. A system key sees everything its scope allows for every job, so a superintendent asking through it could see numbers their own login hides. For user-facing use, embed the app with each person's own sign-in, or pass the user's identity to the server with OAuth.
Next step
Have a workflow in mind?
Start with a readiness review: the task, the data and tools it needs, the access boundaries, and how a pilot would be evaluated.
Prefer email? charley@buildflows.ai
Keep learning
AI agents & MCP · November 18, 2026
One System, Not Two Tabs: Plug Your Construction Dashboard into Your AI Assistant
From a discovery call with Cattlemen Construction Services, whose separate AI vendor is building a company 'brain' over SharePoint, Outlook, calendar and texts: how to make the operating dashboard and the assistant one system. Covers embedding in an iframe with SSO, CSP frame-ancestors and short-lived embed tokens; a scoped read-only API key; an MCP server with tools like get_job_billed_to_date and list_uncoded_expenses; row-level security so the model never sees what the user can't; logging every tool call; and a one-page interface contract for working in parallel with another vendor.
AI agents & MCP · October 9, 2026
Hardening MCP Servers for Production: A Checklist
A checklist-style guide to running MCP servers safely in front of ERPs and project platforms, covering auth modes, read-only defaults, write allowlists, approval handshakes, reliability controls, transport security, untrusted content, error envelopes, telemetry and hosting options.
AI agents & MCP · October 8, 2026
What Is MCP? A Practical Guide for Construction Teams
A plain-language guide to the Model Context Protocol for contractors: what MCP servers and gateways do, why large APIs like Procore and P6 need tool routing, and how to start safely.
