Build Flows

AI agents & MCP · November 19, 2026 · 13 min read

Give an AI Vendor Read-Only API and MCP Access to Your Construction Data

How the Cattlemen OS proof of concept, built for Cattlemen Construction Services in Fort Worth, Texas, lets the company's AI vendor read project and financial data without any way to change it. Covers the three connection options (iframe embed, read-only agent API, MCP server), the six GET endpoints behind named, hashed, revocable bearer keys, the six read-only MCP tools served over streamable HTTP, the checks every MCP call passes (origin, company kill switch, key, read scope, MCP enabled per key, rate limit, tool allow-list), copy-paste curl tests and an MCP client config with placeholder keys, key handover and review, audit logging, what is never exposed, and the limit of system keys for user-facing answers.

By Charley Forey, founder of Build Flows

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.

An AI vendor's assistant and agents on the left send read requests through a gate in the middle and get data back from the operating system on the right. The gate lists: bearer key, named; read scope only; MCP off until enabled; tool allow-list; 60 calls a minute by default; origin check; every call logged; key shown once and stored hashed. The operating system offers projects and grades, project financials, the WIP schedule, card expenses and company KPIs from Procore, QuickBooks and Ramp. A red strip at the bottom says no write tools for agents: QuickBooks, Procore and Microsoft 365 writes stay in the app's approval queue, done by people, until the owner approves a tool in writing.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.

A cropped screenshot of the AI brain and API page in the Cattlemen OS proof of concept. The heading reads: let Cattlemen's AI tools read the OS through a secure, read-only key, or show it inside their own screens. Three cards, each marked Available. Embed the OS: their platform shows these pages in an iframe; people still sign in with their own account, so role-based access carries over. Read-only agent API: their agents call the API with a key from this page to answer questions like what's billed to date on job 26-001; keys can read, never write, and each call is logged. MCP server: the same read-only tools exposed over the Model Context Protocol, so any MCP-aware assistant can use them without custom code.Three ways for the AI vendor to connect (sample data)

OptionWho it's forIdentityGood for
Embed the OS (iframe)People using the vendor's appThe person's own login, so their role appliesShowing the scorecard or coding queue inside the assistant's screen
Read-only agent APIThe vendor's backend and agentsA named API keyScheduled pulls, summaries, answering "what's billed on 26-001?"
MCP serverAny MCP-aware assistant or agentThe same API key, with MCP turned on for itLive 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.

EndpointReturns
GET /api/v1/projects?status=activeProjects 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}/financialsOne 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/wipThe 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/gradesProject grades (0–100), bands, pillar scores and rank
GET /api/v1/openapiThe machine-readable description of these endpoints, for the vendor's tooling

A cropped screenshot of the Agent endpoints section, sample data. It reads: all read-only GET requests with the key in an Authorization Bearer header; replace cos_YOUR_KEY_HERE with a real key; never put keys in code or chat. Below, GET /api/v1/projects, active and won projects with contract, cost to date, grade and rank, with a curl example. Then GET /api/v1/projects/{number}/financials, billed to date, cost, margin and over/under billing for one job, answering what's billed to date on job 26-001, with its curl example.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:

ResponseMeaning
401 Send Authorization: Bearer <API key>No header, or not a key from this app
401 Invalid or revoked API keyWrong key, or someone revoked it
403 This key has no read scopeThe key exists but can't read
403 The AI & agent API is switched off for this companyThe 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:

ToolWhat it returnsInputs
list_projectsProjects with number, client, status, PM, contract, cost, margin, grade, rank, health and uncoded spendstatus (optional)
project_financialsThe financial snapshot for one jobnumber, e.g. "26-001"
wipThe WIP schedule with totalsnone
expensesCard expenses and coding statusstatus, project, limit (all optional)
gradesGrades, bands, pillar scores and ranknone
kpisCompany 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 statusnone

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. GET and DELETE on /mcp return 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, then tools/list and tools/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.

A cropped screenshot of the MCP server section, sample data. It reads: any MCP-aware assistant (Claude, the vendor's agents) can use the same read-only tools as the agent API; off by default for every key; turn it on per key and pick its tools. The MCP endpoint (streamable HTTP) is the app's /mcp URL. Below, the client config with "Replace the key": an mcpServers block named cattlemen-os with type http, the /mcp URL and an Authorization header of Bearer cos_YOUR_KEY_HERE.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

A row of checks an MCP request passes before a tool runs. One, origin: if an Origin header is sent it must be the app's own or allow-listed, else 403. Two, the company-wide AI and agent API switch must be on, else 403. Three, a bearer key that exists and isn't revoked, else 401. Four, the key has read scope, else 403. Five, an admin has enabled MCP for this key, off by default, else 403. Six, under the key's rate limit, 60 a minute by default, else 429. Then the tool must be on the key's allow-list; it runs read-only and its output is scrubbed. Each call is logged as mcp.call and each refusal as mcp.denied.Every check passes, or no tool runs

  1. Origin. If the request carries an Origin header, 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.
  2. Company switch. The AI and agent API must be switched on.
  3. Key. A bearer key that exists and isn't revoked. Keys are looked up by their hash.
  4. Scope. The key has read scope. There is no write scope to grant.
  5. MCP enabled for this key. Off by default.
  6. Rate limit. 60 calls a minute per key by default, adjustable from 1 to 600. Over the limit gets a 429 with Retry-After.
  7. 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

Six steps in a loop. Create: name it for the consumer; the full key is shown once and stored as a hash, with a short prefix kept so you can recognise it. Hand over: a secret-sharing link or the vendor's vault, never email, chat, a ticket or a screen share. Enable MCP, optional: off by default; pick tools and a rate limit from 1 to 600 a minute; the change is audited. Use: read-only GETs or MCP calls, each updating last used and writing a log line. Review monthly: last used and calls by tool; revoke keys unused for 30 days. Revoke or rotate: one click, refused on the next request, issue a fresh key if needed.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.manage capability, and all three are refused during a view-as session. See roles and view-as.

A cropped screenshot of the API key list, sample data, with the key prefixes blurred. Two rows named AI vendor test, each with read scope, created Nov 17, 2026, last used 1 day ago, and a red badge reading Revoked Nov 17, 2026.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.denied for 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:

  1. Write down what the vendor needs to answer, in plain questions. Map each to an endpoint or tool.
  2. Create one named key per use. Hand it over through a secret link or vault.
  3. Turn on MCP only for keys that need it, with only the tools they need, and a rate limit that fits the job.
  4. Run tools/list with the key and check the list.
  5. Confirm the vendor stores the key in a vault, not in code, chat or a prompt.
  6. Agree in writing: read-only, no write tools without the owner's written approval per tool.
  7. Put a monthly review on the calendar: last used, call counts, refusals.
  8. 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