RAG and MCP: how to give document access to an artificial intelligence agent
Published on 2026-11-16 by ArduBot
How to combine an MCP server with a RAG API to query documentation with permissions, citations, and differentiated tools.
You have an agent that can execute tools, but when asked about a policy or manual it answers from memory. The MCP protocol connects AI applications with external capabilities; RAG serves to retrieve relevant information from your documents. Together they can form a knowledge layer, provided we separate reading, authorization, and actions.
What each component solves
Model Context Protocol (MCP) standardizes communication between an AI application and servers that offer tools and other resources. RAG is an architecture for retrieving relevant fragments and using them as context for a response. They are not competitors or equivalents. An MCP server can expose a tool that queries a RAG API; alternatively, a client can call the API directly without MCP.
Example: an operations assistant receives “what procedure do we follow before restarting the service?”. It does not need restart permissions to answer: it first consults the documentation. If someone then requests the restart, that corresponds to another tool with independent authorization.
Recommended design
Cliente de IA
-> servidor MCP: buscar_documentacion
-> servicio RAG: aplicar permisos y recuperar fragmentos
-> respuesta con fuentes
-> LLM: redactar, citar o abstenerse The MCP server describes the tool and its input schema. The backend retrieves the context after verifying the requester's identity. The documentation returned is untrusted data, not an instruction that can override the agent's rules.
An illustrative tool could be called buscar_documentacion and accept pregunta, coleccion and limite. Avoid allowing the model to pass arbitrary company identifiers: identity and authorized scopes are calculated on the server.
Tools, resources and prompts: choose without exaggerating
A search tool allows dynamic queries. A resource can expose identifiable and selectable information; its support depends on the client. A prompt is an interaction template, not an access control. If you need search with filters, using an explicit tool usually simplifies observability.
Do not connect the same MCP user to all business document bases just because the assistant is “internal”. Design permissions by company, project and document type.
Errors the agent must handle
A semantically similar result may belong to an old version. A source may include malicious text such as “ignore previous instructions”. A question may have zero evidence. In all three cases, the agent must know how to abstain or show warnings, and authorization must remain the responsibility of the service.
For auditing, record request identifier, identity, database consulted, source retrieved and result. Avoid storing full confidential content in logs.
Test with a business case
Prepare three collections: public documentation, private manuals for team A, and documentation for team B. Ask with an agent authorized for A, then try to obtain an exclusive phrase from B. The correct result is that B never reaches the model. Then verify that an authorized query returns the correct page and that a withdrawn document no longer appears.
Where ArduMaker can fit in: its infrastructure and MCP tools can be part of this architecture. We are evaluating a future API-queryable RAG service; it must not be confused with an already available function. If you need to connect your sources to agents, describe the scenario at ArduMaker.
References: MCP Specification · RAG at Microsoft · MCP at ArduMaker.