Dev.to Security πŸ” Cybersecurity πŸ‘ 0 πŸ“– 8 min read

Letting an AI assistant touch your billing data without handing it your margins

If you give an AI assistant access to a real business system, you inherit a question the demos skip: how do you let it see enough to be useful without letting it see what you'd never paste into a chat window? We run int

If you give an AI assistant access to a real business system, you inherit a question the demos skip: how do you let it see enough to be useful without letting it see what you'd never paste into a chat window?

We run into this daily. We build Timix.AI, a time-tracking and billing system for service firms (agencies, consultancies, IT shops, law and accounting firms), and it ships a remote MCP server so people can ask Claude, ChatGPT or Cursor things like "which projects are close to budget?" or say "log 45 minutes on the Acme onboarding call". The data behind those sentences includes hours, but also cost rates, margins and client contact details. Those are the fields that make "just connect it" uncomfortable.

This post walks through the choices we made, what they protect, and where they fall short. It is a small team's early design, not a standard; we'd rather you steal the parts that fit and tell us what we got wrong.

The server in a paragraph

It is a remote MCP server over Streamable HTTP at one endpoint, https://api.timix.ai/api/integration/v1/mcp. It is stateless: no sessions, no resumable streams, no JSON-RPC batching. It exposes tools only (no resources or prompts) and does not offer the older HTTP+SSE transport, so a client that speaks only that cannot connect. The catalog is 115 tools, 29 of them read-only and 86 that write, and every tool carries a title and the standard annotations (readOnlyHint, destructiveHint, idempotentHint, openWorldHint).

It is a thin protocol adapter over the same per-request pipeline as our REST API: tenant isolation, role checks and rate limiting. That decision turned out to matter more than any single feature, because the MCP layer inherits the controls we already trusted instead of re-implementing them.

Two ways in

Chat clients and IDEs want different things.

  • OAuth 2.1 with PKCE and dynamic client registration, for Claude and ChatGPT. Nobody copies a key; the client registers itself, the user signs in and approves in a browser window.
  • API keys (tmx_...), sent as X-Api-Key or as a Bearer token, for Claude Code, Cursor and scripts.

Connecting from Claude Code is one command and a sign-in:

claude mcp add --transport http timix https://api.timix.ai/api/integration/v1/mcp
# then, inside Claude Code:
/mcp

In Cursor, a remote server is a url entry in mcp.json:

{
  "mcpServers": {
    "timix": {
      "url": "https://api.timix.ai/api/integration/v1/mcp"
    }
  }
}

If you prefer a key to OAuth, add a headers entry with it and treat that file as a secret. One gotcha we document: in Claude Code, if you set an Authorization header, it uses it and does not fall back to OAuth.

In Claude on the web or desktop it is a custom connector (Customize, then Connectors, then Add custom connector, paste the URL). We are not in Claude's or ChatGPT's connector directories today, so custom connector / custom MCP server it is. We have no affiliation with Anthropic or OpenAI.

Layer 1: a credential is a scope plus a role, in one organization

The failure mode we wanted to avoid is the god-mode integration token: authenticate once, then the model can do anything the account can.

  • Every key has scopes: read, write, financial, destructive, admin. A key created by hand starts with read; everything else is opted in per key.
  • On top of the scope, a key acts with its owner's role (Owner, Admin, Finance, Manager, Member, Viewer). An agent can never do something the person behind it couldn't do in the app. A Viewer connection can read and cannot log time.
  • The organization is fixed by the credential. There is no tool to list or switch organizations, so a prompt-injected "now look at the other tenant" has nothing to call.
  • tools/list returns only the tools the role may use, and tools/call checks the role again. The filter is a courtesy to the model (fewer tools to choose from); the second check is the one that counts.

Scope and role compose rather than replace each other. That is deliberate: it lets you hand a script a read-only key owned by an Admin and know that "read-only" wins.

Layer 2: fail-closed redaction

This is the part we'd argue for even if you copy nothing else.

Each key has an "Allow sensitive financial and contact data over MCP" setting that is off by default. With it off, cost rates, profit and margin figures, and contact details (email, phone, VAT number) are replaced with a marker before a result leaves the server. Hours, revenue, budgets, customer names and notes stay visible, so the useful questions still work: "which projects are near budget" and "how much is unbilled for Contoso" don't need anyone's cost rate.

Two details we think are important:

  1. It is opt-in per credential, and only possible while the key's owner holds a role that may see that data (Owner, Admin, Finance, Manager). Demoting the owner doesn't silently leave a powerful key behind.
  2. It fails closed. A misconfiguration under-shares instead of leaking.

What it is not: a proof against inference. Revenue and hours are visible by design, so someone who has both can estimate an average rate. Redaction is data minimization for the fields we classify as sensitive, not a guarantee that nothing can be derived. Everything the model does read, such as names, notes and hours, goes to whichever AI provider you connected, under their terms. We say that in our docs because it is the part people forget.

Layer 3: writes are drafts, destructive writes preview first

Reads are the easy half. For writes we made three rules:

  • Time entries are always created as Drafts. The user reviews them in the app before they count. Generated invoices are drafts too and can be edited or deleted before they are issued.
  • Most other writes (creating a customer or a project) take effect immediately. We don't pretend otherwise; the role and scope limit who can do that.
  • 35 of the write tools preview first. Deleting, closing a period, issuing or voiding an invoice, approving a timesheet: the first call returns a preview and runs nothing; the action runs only when the tool is called again with the confirmation the preview names.

That last mechanism deserves an honest caveat. The second call is made by the assistant, not by a human. It stops a one-shot accidental deletion and gives the client something concrete to show you, but it is a speed bump, not an approval. The real human gate is your client's own tool-confirmation prompt (ChatGPT, for one, asks for confirmation before write actions) and keeping the key's scopes narrow. If you build something similar, don't let a preview-then-confirm flow convince you that you have human approval when you don't.

Layer 4: an audit trail that doesn't become a second copy of your data

Every tools/call is logged on our side with who ran it, which tool, with which key, the outcome, whether the result was redacted, and the network address. We deliberately do not log the arguments or the result; an audit log that contains everything the model read is itself a data-leak. The gap we'll own: there is no screen in the app to browse that log yet. It exists for us to answer "what did this assistant run?", not yet for customers to self-serve.

The lesson that cost us the most time: open discovery, gated data

Our first version required authentication for everything. It's the natural default. It also means that anything that crawls MCP servers unattended (directories, health checkers) can't complete an interactive OAuth consent, gets a 401 on its first request, and concludes your server is down.

The split we landed on:

  • initialize and tools/list are open. They expose only names, descriptions and JSON schemas: effectively the API docs you'd publish anyway. No tenant data.
  • tools/call is authenticated, and returns a proper 401 with a WWW-Authenticate challenge so real clients start OAuth.

After that change our directory health check stopped failing, without handing any crawler a credential. A side effect we like: you can inspect the entire catalog before deciding to trust us, with no account:

curl -s https://api.timix.ai/api/integration/v1/mcp \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json, text/event-stream' \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'

(When we ran this for this post it returned 115 tools, 29 with readOnlyHint set. Check it yourself; the catalog changes as we ship.)

If your server lists names that are themselves sensitive, don't copy this. For a tool catalog of generic business verbs like log_time and get_budget_health, we think open discovery is the right trade.

Limits, so nobody is surprised

  • Per-key rate limits in a 60-second window: 120 calls on Free and Starter, 300 on Professional, 1000 on Business or an active trial; past that you get 429 with Retry-After.
  • Tools that belong to paid features (invoicing, timesheet approvals and utilization reports on Professional and up; scheduled reports and AI insights on Business) answer with a clear message naming the feature and plan. The connection itself, OAuth and API keys work on every plan, Free included.
  • Keys minted through the OAuth sign-in have no expiry and no refresh token. They work until revoked, or until their owner is removed or disabled. Revoking takes effect immediately.
  • 115 tools is a lot for a model's context. The role filter shrinks the list for most users, and every tool has a title and annotations, but we haven't published measurements of how that behaves across clients. Treat it as a known cost.

Why not just a REST API?

We have one (Professional and up), and the MCP server doesn't replace it. The difference is who writes the glue. With REST, a developer wires up and maintains the integration. With MCP, the client reads the tool list and wires itself, so a non-developer can ask a question in the assistant they already use. For a services business that mostly means the part everybody forgets, logging the hour, happens in the chat where the work was discussed.

What we'd like feedback on

  • Is drafts-only time entries the right default trust level, or should some writes require a real human click?
  • Is a preview-then-confirm step worth having if the model makes both calls?
  • Would you expose a catalog this size, or split it into several narrower servers by role?

If you want to try it

Timix.AI has a free plan for up to 5 users (the MCP server is included), paid plans from $7 per seat per month, and a 90-day full-access trial with no card. It also runs in English and Hebrew (right-to-left). It is early and we are a small team, so expect rough edges. The server is listed in the official MCP Registry as ai.timix/time-tracking.

The reference version of this write-up, kept up to date, is on our site: Time tracking with an MCP server.

πŸ“° Read the original article on Dev.to Security

Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes β€” full credit and traffic to the original publisher.