Back to blog
6 min readGateco Team

MCP server security starts with what the agent can retrieve

The short answer. Most MCP server security advice is about tools: which ones a user may call, which need approval, how the client authenticates. For an MCP server that searches company documents, there's a question underneath all of that: whose permissions does the retrieval run with? An MCP server usually reaches your search or vector store with one credential, and that credential can read far more than any single person. Unless each result is checked against the person the agent is working for, the agent sees more than the person asking. Similarity search finds what is relevant. It doesn't decide who is entitled to see it.

Why MCP makes the retrieval question easy to miss

MCP made it simple to give an agent a "search the docs" tool. That simplicity hides three things.

  1. Authentication isn't authorization. OAuth on the MCP connection tells the server who connected. It doesn't decide which documents in the index that person may read. That decision has to be made somewhere, per document, and the protocol leaves it to you.
  2. The server holds the data credential. The MCP server calls the vector store or search service as an application. If it passes results straight through, every user gets the application's view of the data.
  3. The agent writes the query. You can't review search terms in advance, and a shared server sees requests from many people. You can't secure the queries, so you secure what comes back, for the person each request is for.

MCP security risks at the retrieval layer

  • Reading as the server's service account. Results reflect what the MCP server's credential can see, not what the user can see. It's the most common failure, and it happens by design, not by attack.
  • Stopping at the server. The user's identity is checked when they connect, then dropped before the query reaches the data. The user's permissions need to reach the point where documents are selected, not stop at the MCP server.
  • Filtering after the fact. Trimming results after they're in the agent's context, or filtering the final answer, is too late. Once a chunk is in context it can shape the answer and the agent's next step.
  • Shared servers mixing users. One central MCP server, a shared cache or shared memory can carry one person's results into another person's session.
  • Side channels. Scores, result counts and titles can reveal that a document exists, even when its text is withheld.
  • No record afterwards. When something goes wrong, nobody can say which documents the server returned, for whom, and what it withheld.

Two questions, two layers

  1. May this user (or agent) use this MCP server and this tool? That's MCP authentication and tool-level authorization, handled by your identity provider, MCP gateway or agent platform.
  2. Which documents may come back from this retrieval, for the person it's for? That's decided at retrieval, per document, every time.

Being allowed to call a search tool is not an entitlement to every document behind it. Both checks are needed, and they belong to different layers. MCP authorization for retrieval means the second one.

What to test before you trust an MCP retrieval server

TestWhat a good answer looks like
Two users, same query, different accessDifferent results. The less-privileged user gets nothing they couldn't open in the source system.
Where does the user's identity come from?Named on every retrieval (by id or email). Prefer a host that asserts it, or verified tokens so the server refuses a call whose token names a different user, not free text a model can invent.
What happens when the permission check fails?Nothing is returned. An error returns nothing, not everything.
Do the permissions match the source systems?They come from the sources and your identity provider, not a list someone maintains by hand.
Revoke access mid-sessionGrant, retrieve, revoke, retrieve again. The second retrieval should be denied.
Can you show afterwards what was returned and withheld?A record per retrieval: who it was for, what was allowed, what was denied.

Where Gateco fits

Gateco's MCP server exposes permission-aware retrieval as a tool, gateco_retrieve, and it runs on a key scoped to retrieval only. In gateco-mcp the user is a tool argument, not a server setting: every retrieval names a principal, by id or by email, and Gateco authorizes for that user, never for the agent or the key it holds. By default the host asserts who that user is. An organization that turns on verified tokens requires the user's own identity token on every call, and Gateco refuses a call whose token names a different user.

Gateco checks every candidate the index returns against the requesting user's permissions and withholds what is denied, before anything reaches the agent or the model. Denied content never reaches the agent: the tool returns only what the user is allowed to see, plus a count and reason for what was withheld. It's the same deny-by-default check, on the same twelve vector and search backends, with the same per-decision record as Gateco's SDK and API. The permissions are the ones your organization already defines: groups and attributes from your identity provider, policies you write against them, and access lists imported from Google Drive, SharePoint, Confluence and Notion (Notion at workspace level).

Setup: Gateco MCP server docs. Also: MCP server for Claude Desktop.

What Gateco does not cover. Gateco doesn't decide which MCP servers or tools a user or agent may call, or which actions an agent may take; that belongs to your identity provider, MCP gateway and agent platform. It doesn't authenticate MCP clients. It can't take back content already returned to an agent; it decides the next retrieval. And it doesn't detect instructions hidden in documents a user is allowed to read.

Common questions

What is MCP server security?

The controls around a Model Context Protocol server: who may connect, which tools they may call, what those tools may do, and, for servers that retrieve company data, which documents may come back for the person a request is for.

Isn't OAuth on the MCP server enough?

OAuth tells the server who connected. It doesn't decide which documents in your index that person may read. That decision has to happen at retrieval, per document.

Can't the MCP server just filter results before returning them?

It can, if it has each user's permissions from the source systems and checks every result before it leaves. That's the layer this post is about. The hard parts are keeping those permissions in line with the sources, refilling results when denials leave them short, and keeping a record of every decision.

Where does this fit in the OWASP Top 10 for Agentic Applications?

Closest is the retrieval side of ASI03:2026, Identity and Privilege Abuse: an agent reading with access the person behind the task doesn't have, or no longer has. The rest of ASI03, such as scoped agent credentials, delegation between agents and approval for privileged actions, belongs to your agent and identity platforms.

If your MCP or agent pilot is heading into a security review, the twelve questions we'd want answered first go further on retrieval.

If you have an AI pilot waiting for security sign-off, start free.

Sources


Ready to secure your AI retrieval?

Start with the free tier: 1,000 retrievals/month, no credit card required.