Skip to main content
RoutMe
All posts
Engineering5 min read

Connect your systems without glue code: MCP, APIs, databases

How RoutMe reaches your data without glue code: MCP servers, your own APIs and read-only database views. What each is, when to use it and how to keep it safe.

JJ

Jesbin James

Engineering

RoutMe reaches your data through three routes: an MCP server that exposes your systems as named tools, your own API called with an HTTP step, or a read-only database role behind a tool. All three keep the model away from raw credentials, and all three can be set up so the agent can look things up but cannot change them.

This is the part of a DIY stack that usually becomes glue code: a function here to fetch an order, a node there to reshape it, a hand-rolled check that the model did not ask for someone else's record. Doing it with a clear contract replaces most of that. This post explains each route, how to choose, and what keeps it safe.

Route 1: MCP, the Model Context Protocol

MCP is an open standard for giving AI models tools. A server publishes a list of tools, each with a name, a description and a typed input, and the agent calls them by name. In RoutMe you add a connection with the server URL and an optional bearer token, press Test connection, and the dashboard performs the handshake and reports the server's name, version and tools. If it cannot connect, the message says why.

RoutMe uses the Streamable HTTP transport, where each call is a JSON-RPC request and response. A tool in the chat widget is offered only if the server marks it read-only with the standard readOnlyHint annotation, and a tool without it is left out. That is enforced on the tools themselves, not by asking the model to behave.

Route 2: Your own API

If a REST API already enforces your business rules and authorisation, calling it is often the safest option. There are two ways in. A small MCP server can wrap the endpoints you need, so the agent sees tools rather than URLs. Or a flow's HTTP call step posts JSON to your service, which contains the logic and returns a result that later steps can use. The step signs the request if you set a secret and fails if your service does not answer in ten seconds, which is a good reason to keep lookups quick.

The call is a POST with a body of the app, the conversation and the triggering event data, so your endpoint can be a thin adapter. For deeper guidance read how to connect your REST API to an AI agent and MCP vs REST API vs RAG for support.

Route 3: A read-only database

When there is no API, a database can be the source. The safe version has a dedicated role with SELECT on views, not tables, rows scoped to the verified customer, fixed parameterised queries behind named tools, and time and size limits. The model should never write SQL freely, and the role, not a parser, is the real boundary. The full checklist is in how to connect a database to an AI agent safely.

Choosing between them

  • An API exists and is good: wrap it with MCP tools, or call it from your own service.
  • No API, data in a database: a read-only role and a small tool in front of fixed queries.
  • Several systems: one MCP server per system, or one that fronts them, so each tool has one job.
  • Content rather than records: knowledge sources for documents and policies, tools for live data. See RAG vs tools.

Making read-only real

Read-only is not a setting on the model, it is a property of what the credential can do. A token with read scopes cannot write, whatever a prompt says. That is why the order is: create the narrow credential first, then build the tool, then attach it. See read-only is a property of credentials and what read-only AI means.

A setup you can follow

  1. 1Decide the three or four questions customers ask most.
  2. 2For each, name one tool and the minimum fields it returns.
  3. 3Create the read-only credential for it and store it in a secret manager.
  4. 4Write the tool, mark it read-only and test it outside RoutMe.
  5. 5Add the connection in RoutMe, press Test connection and check the tool list.
  6. 6Attach it to the agent step, choosing the widget or flow that should see it.
  7. 7Ask each question in a test chat and read the run to see which tools were called.

What you still own

RoutMe does not replace your systems of record, and it does not offer a native connector for every app. The tool is the contract between your system and the agent, and its quality sets the ceiling on answers. If a record is wrong in the source, the reply is wrong. Prompt injection and read-only tools explains why narrow tools are also your best defence against text that tries to steer the agent.

If you are moving from n8n, the matching steps are in the migration guide. For a store, see the Shopify page. Data handling is on the security page, plans are on the pricing page, and a demo shows a live connection. All three migration routes are on Move to RoutMe.

Example: an orders tool

Suppose customers ask about orders. The tool is called get order status. Its input is an order number, and the customer's verified identity comes from the session in your code, not from anything the model writes. It returns a status, the item names, the carrier and a tracking reference, and nothing about cost price or payment. It carries the read-only annotation. Behind it sits a token that can read orders and cannot write them. If the order does not belong to the verified customer, the tool returns nothing, and the agent says it could not find it.

Four properties make that safe: a narrow credential, a narrow tool, identity applied in code and minimal output. None of them depends on the model behaving, which is the point. When people say glue code, what they often mean is the pile of checks that grew around a tool that had none of those properties. Starting with them replaces the pile.

  • Migration
  • MCP
  • Integrations
  • Security
JJ

Jesbin James

Engineering

Writes about integrations, agent tooling, and the parts of the WhatsApp Cloud API that only show up in production.

Frequently asked questions

What is MCP in one sentence?

MCP, the Model Context Protocol, is an open standard for exposing tools to AI models, so an agent can call things like look up an order through one consistent interface. See what MCP is.

Do I need to write an MCP server?

Often a small one, yes, wrapping the few reads you need. RoutMe speaks MCP over Streamable HTTP. Turning a REST or OpenAPI description into tools with one import is not available yet, and we do not give a date.

Can the agent change my data?

Not unless you build that on purpose. The chat widget offers only tools that declare themselves read-only. In flows, an agent step can call every tool on the servers you attach, so attach servers whose tools you are happy for it to use.

Does RoutMe copy my database?

The pattern is a live lookup at the moment of need rather than a copy held by RoutMe.

See it on your own data

Connect a system, drop an agent node into a flow, and watch it answer from what is actually true in your systems right now.