Orchestrating AI agents through one MCP hub: scopes, a shared bus and merges only on green CI
How we let a dozen AI agents work on real company systems through one MCP gateway: one login per agent, narrow scopes, a shared message bus, spending caps, and code that reaches production only through green CI.
- Our agents reach company systems through one MCP gateway: offers and prices, ERP, support tickets, mail drafts, git, image generation. They never hold the systems' keys themselves.
- Every agent has its own login and a narrow scope. Write tools appear only where the scope allows them, and nothing can be sent or deleted from mailboxes.
- Agents coordinate on a shared bus, not through a person. Git work goes branch → pull request → green CI → merge, never straight to production.
- Paid tools have monthly caps per agent, and anything irreversible waits for a human approval.
A single AI assistant with a few connectors is easy to reason about. A dozen agents that each look after a different part of a company, sales, support, accounting, websites, firmware, are not. Each needs data from several systems, some need to write, and all of them make mistakes now and then. Wiring every agent directly to every system gives you a pile of keys nobody can audit.
We solved it with one MCP hub in front of everything. This article explains how it is put together and which rules made it safe enough to let agents work without someone watching each step. If MCP itself is new to you, start with MCP servers for a small business.
One gateway, many systems
The hub is a single MCP endpoint. Behind it sit small servers for each system, and every tool name carries a prefix that says which one answers: offers, ERP, support, mail, calendar, git, the agent bus, image generation and so on. An agent sees one connection and a list of tools; it does not know or care where each system lives.
The hub holds the credentials. When an agent calls a tool, the hub checks the agent's login and scope, forwards the call with the right key, and logs it. If a key has to change, it changes in one place. If an agent misbehaves, its login is switched off and nothing else is affected.
The hub also carries the how-to guides. An agent opened for a single task reads the guide for that workflow from the hub itself, so the rules travel with the tools and do not depend on what a particular chat happened to remember.
Scopes: what an agent can see is what it can do
Each agent gets its own login, and the login has a scope set by a person. The rule we follow is simple: a tool the agent is not allowed to use does not appear at all. A read-only agent does not see write tools, so it cannot try them.
- Mail tools can search, read, create drafts and archive. Sending and deleting do not exist in the hub.
- Git tools can write only to the agent's own branches, named after its lane. The default branch is never written directly.
- Sharing files or inviting guests to calendar events needs an explicit extra grant.
- When an agent needs more, it files an access request through the hub. A person decides; agents never widen their own permissions.
A shared bus instead of a human courier
Agents need to talk to each other: the sales agent needs a quote from the offers agent, the website agent needs a form from the forms agent. Early on, those messages went through a person who copied text between chats. That does not scale and it makes the person the bottleneck.
Now there is a message bus, a small database table behind a hub tool. Each agent posts as its lane, reads what is addressed to it and marks it handled. Long-running agents wake up on a schedule, read only what is new and answer. A person reads a daily digest, not the bus.
The bus is also where announcements live. When an agent changes something sensitive, such as a deployment workflow, it posts the announcement first, and the hub refuses the change unless that announcement exists, comes from the same agent and names every file touched.
Code reaches production only through green CI
Several agents write code in the same repositories. The flow is the same for every one of them:
- Create a branch named after the agent's lane.
- Commit, with an expected head commit so two agents never overwrite each other silently.
- Open a pull request. The checks run: secret scanning and the repository's tests.
- Merge it yourself, but only when every check on that exact commit is green. The hub refuses a merge with missing, running or red checks, and never bypasses branch protection.
Nobody reviews every line by hand. The tests are the review, which is why every bug that reached a real user becomes a permanent test. This is the practical meaning of human in the loop for code: a person sets the rules and the checks, the machine enforces them on every change.
Caps for anything that costs money
Some tools are paid per call: image generation, translation, SEO data. Each has a monthly cap per agent and a backstop for the whole server. A tool offers a dry run that returns the estimate and the remaining budget before anything is spent. When a cap is reached, the agent stops and sends one notice; it does not loop.
Irreversible operations, such as rotating a key or deploying firmware, are protected jobs. The agent can start them, but they wait for a person to approve in the CI system before they run.
Starting smaller
You do not need a dozen agents to use these ideas. With one assistant and two systems the same rules already help:
- Put the keys behind one server instead of into the assistant's configuration.
- Start read-only and add write tools one by one, each with a clear limit.
- Log every call with who made it.
- Let code reach production only through automated checks.
The free Academy lesson on working with AI agents covers the habits that make this work day to day, and the Members' Academy lesson MCP tools, not JSON goes further into why tools beat pasted data.
Frequently asked questions
What is an MCP hub?
A single MCP server that sits in front of many internal systems and exposes them to AI agents as tools. Each tool name carries a prefix that says which system answers, and the hub checks who is calling before it forwards anything.
Why not connect each agent to each system directly?
Because then every agent holds every key. A hub keeps the credentials in one place, gives each agent its own login with a narrow scope, logs every call and can cap spending. Revoking an agent is one change instead of rotating ten keys.
How do several agents avoid stepping on each other?
Each agent works in its own lane with its own branch naming, and they coordinate on a shared message bus instead of through a person. Anything that changes code goes through a pull request that only merges when the automated checks are green.
Can an agent give itself more access?
No. An agent can request access through the hub, and the request goes to a person who decides. Agents never widen their own or each other's permissions.
Written from our own production systems by the Flowsmith editorial team, with AI assistance.
Want this running in your company?
Flowsmith designs and operates automations like this for small and mid-sized teams — with a person approving anything that leaves the building.