cd /news/ai-agents/ai-agent-access-control-read-only-se… · home › topics › ai-agents › article
[ARTICLE · art-176513] src=manticoresearch.com ↗ pub= topic=ai-agents verified=true sentiment=· neutral

AI Agent Access Control: Read-Only Search with Manticore

A reproducible lab published by Manticore Search shows that connecting the official Manticore MCP server (commit c835b5c, package version 0.1.2) to a database account granted only `read` on the `agent_docs` table blocks tested INSERT, UPDATE, DELETE, DROP and TRUNCATE requests and denies access to the `private_docs` table, while the same read grant still exposes other tenants' rows within `agent_docs`. The lab runs on Manticore 29.9.0 with FastMCP 4.1.4 and the `manticoresearch` 11.2.0 client, tests reads and attempted writes through both MCP and direct HTTP, and repeats the checks after a restart, ending with "PASS: reads allowed; mutations denied; data and schema unchanged." The result matters because it separates three access-control layers — an MCP query guard that does not enforce read-only SQL, a database grant that does not isolate tenants, and an agent host's tool allowlist that does not change database permissions — and shows the database grant alone leaves cross-tenant rows visible.

recommendation

Give the MCP server a database user with a single `read` grant on the needed table, then test reads and attempted writes over both MCP and direct HTTP and re-check after restart; add row-level tenant filtering, since the grant alone exposed other tenants' rows.

more in playbook: Securing agents and AI tools
read9 min views6 publishedNov 19, 2026
AI Agent Access Control: Read-Only Search with Manticore
Image: Manticoresearch (auto-discovered)

An agent answering questions from documentation needs search access, not permission to edit data. This example connects the official Manticore MCP server with a database account that can read one table, then tests what that account can and cannot do.

We run reads and attempted writes through MCP and direct HTTP, compare the data and schema before and after, and repeat the checks after a restart. The read grant also exposes other tenants' rows in the same table.

A small test client sends the MCP requests. You don't need a live LLM or model credentials to reproduce the results.

The Access Boundary #

If you've followed our MCP introduction or authentication guide , this lab shows how to use them together with a restricted account.

The lab uses two tables:

  • agent_docs : three documentation records, one belonging to a second tenant.
  • private_docs : an internal runbook that the agent cannot read.

The MCP server connects with a user that has one grant:

CREATE USER 'agent_docs' IDENTIFIED BY 'DemoReader05!';
GRANT read ON 'agent_docs' TO 'agent_docs';

The administrator creates the tables and the read-only user. Only the restricted credentials reach the MCP process; the password shown here is for this disposable lab. Manticore's authentication and authorization reference explains its action and target permissions.

AI agent access control here has three layers worth keeping separate:

Control What It Does Limit
MCP query guard Blocks the tested INSERT, UPDATE, DELETE, DROP and TRUNCATE requests Does not enforce read-only SQL
Database grant Allows reads on agent_docs ; denies the tested writes and access toprivate_docs Does not isolate tenants within agent_docs
Tool selection in an agent host Limits which tools the agent sees Does not change database permissions

This lab tests the MCP guard and the database grant, not the agent host's tool allowlist.

A Reproducible Lab #

Download the runnable example . It contains Compose files, the unmodified official MCP source and license, pinned Python packages, a protocol test client (check.py), and checksums.

The example uses Manticore 29.9.0 , pinned to this image digest:

manticoresearch/manticore:29.9.0@sha256:461b419739a2bbbffb4be0b32db26c41d7b435bf7fd1fce95b414ca5ccbb3775

The engine reported 29.9.0 58e88d5ab@26091108. We used official MCP commit c835b5c (package version 0.1.2), FastMCP 4.1.4, and manticoresearch 11.2.0. Retest if you upgrade any of them.

The tested platform is Linux amd64. You'll also need Docker Engine with Compose v2, Bash, Python 3, uv , tar, and sha256sum. The first run may download an image, Python 3.12, and packages. No embedding model or API key is needed.

The Compose project is manticore-article05. The runner checks for existing project resources and a free port. The database binds to 127.0.0.1:39508 and has a one-CPU, 1-GiB limit; Python and downloads use additional host resources. Run only one copy at a time.

Download the archive and its checksum file , then run:

sha256sum -c agent-read-only-search.tar.gz.sha256
mkdir agent-search-lab
tar -xzf agent-read-only-search.tar.gz -C agent-search-lab
cd agent-search-lab
sha256sum -c SHA256SUMS
./run.sh > run.log 2>&1
tail -1 run.log

The last line should be:

PASS: reads allowed; mutations denied; data and schema unchanged

We verified the archive from a fresh extraction and a new database volume. The runner refuses to reuse a lab volume. The checksums cover downloaded files, not external package repositories.

Retrieval Through the Official MCP Server #

The runner sets auth = 1 and starts a standalone RT node. It bootstraps the administrator as the container's manticore OS user so the daemon can read its private auth store. The administrator then loads the fixtures and creates the restricted user.

Next, the MCP process starts over stdio with:

MANTICORE_HOST=127.0.0.1
MANTICORE_PORT=39508
MANTICORE_USER=agent_docs
MANTICORE_PASSWORD=DemoReader05!
MANTICORE_ALLOW_WRITE_ACCESS=false
MANTICORE_ALLOW_DROP=false
MANTICORE_MCP_TRANSPORT=stdio

In your agent host, launch mcp-manticore with these settings. Stdio does not open an MCP listening port. Remote MCP connections need separate transport and authentication controls; HTTP/SSE transport is not tested here.

The tools/list response contains five tools:

run_query
list_tables
describe_table
list_documentation
get_documentation

This version calls the SQL tool run_query, not the execute_query name used in our introductory post. The tests use the database tools, not the documentation tools.

Start by listing tables, inspecting a schema, and running a query. Here, list_tables showed agent_docs but not private_docs. describe_table returned the agent_docs schema and denied access to private_docs. It builds DESCRIBE <table_name> without going through the run_query guard, so database permissions matter here too.

We also tried crafted table names outside check.py, with the MCP write flags both on and off. Names such as agent_docs; DROP TABLE agent_docs and private_docs; DESCRIBE agent_docs produced P01: syntax error (HTTP 500), without changing the database. An unterminated comment in agent_docs /* ; DROP TABLE agent_docs was treated as DESCRIBE agent_docs; private_docs alone returned 403. The syntax errors came from Manticore's parser, not from MCP name validation: describe_table does not validate that argument.

Here is the retrieval request:

{
  "jsonrpc": "2.0",
  "id": 3,
  "method": "tools/call",
  "params": {
    "name": "run_query",
    "arguments": {
      "query": "SELECT id,title,body FROM agent_docs WHERE MATCH('retry') AND tenant_id=1 LIMIT 3"
    }
  }
}

The response contained record 1, titled Timeouts, with this body:

Set a request timeout and retry transient failures.

The test checks the embedded SQL response for exactly that record. In this fixture, retry does not also match retries. This is a retrieval example, not a relevance benchmark.

Watch the response format: this MCP version wraps SQL data in columns/ rows. Its outer total is 1 for the response envelope, not necessarily the number of matching documents. The raw response is in results.jsonl; read the embedded SQL data for the actual matches.

Mutation Tests That Reach the Database #

An MCP error alone doesn't tell you whether the guard or the database stopped a write. The runner tries three paths:

  1. Default MCP, with both write flags false .
  2. A new MCP process with both flags true , still usingagent_docs .
  3. Direct HTTP SQL with the same restricted credentials, bypassing MCP.

Each path tries these statements:

INSERT INTO agent_docs(id,title,body,tenant_id) VALUES (99,'bad','bad',1);
UPDATE agent_docs SET tenant_id=99 WHERE id=1;
DELETE FROM agent_docs WHERE id=1;
CREATE TABLE forbidden_table(body text);
ALTER TABLE agent_docs ADD COLUMN injected integer;
DROP TABLE agent_docs;
TRUNCATE TABLE agent_docs;
CREATE USER 'intruder' IDENTIFIED BY 'demo';

The table shows which layer blocked each request. DB 403 means Manticore denied it. A dash means that combination was not tested:

Request Default MCP Flags On HTTP
INSERT, UPDATE, DELETE Guard rejects DB 403 DB 403
DROP, TRUNCATE Guard rejects DB 403 DB 403
CREATE TABLE, ALTER TABLE DB 403 DB 403 DB 403
CREATE USER DB 403 DB 403 DB 403
SELECT from private_docs DB 403 — DB 403
Request without credentials — — HTTP 401

For example, the write-enabled MCP call returned isError: true and this database response (headers omitted):

(403)
Reason: Forbidden
HTTP response body: {"error":"Permission denied for user 'agent_docs'"}

The MCP guard is not complete SQL authorization. We proved this with a separate administrator-only control: with both write flags false, run_query successfully executed CREATE TABLE guard_probe(body text). An independent administrator query confirmed the table, which we then removed. The pinned guard code blocks some mutation patterns, not every schema operation.

The guard can also reject harmless reads. In a separate check outside check.py, the restricted MCP account got a write-operation error for SELECT id,title FROM agent_docs WHERE MATCH('update'), for a MATCH('"delete from"') search, and for a query containing /* update */. None writes data, but the guard scans the whole SQL text for mutation words. The database grant is what prevents writes when the guard misses them.

Never give an agent administrator credentials and rely on MCP write flags alone. The normal MCP process uses the restricted account; the same CREATE TABLE request was denied under that account.

Verification Beyond Error Messages #

Before and after the attempted writes, a separate administrator connection compares:

  • the full table list;
  • the agent_docs schema;
  • every field in both tables, ordered by ID;
  • the user list.

Nothing changed: record 99, the injected column, forbidden table, and intruder user were absent, and the original data remained intact. The temporary administrator-only test table was removed too.

After restarting Manticore with the data volume intact, the snapshots still matched, direct writes were still denied, and MCP retrieval and denial checks passed again. This verifies the standalone setup, not a distributed cluster; see the authentication rollout checklist for that.

Read-Only Access Still Exposes Data #

The retrieval query uses tenant_id=1, but the agent controls the SQL. Remove that filter:

SELECT id,tenant_id,title FROM agent_docs ORDER BY id ASC;

The query returns tenant two's record. The read grant covers the whole table, and a prompt saying 'only query tenant one' cannot change that.

If the agent must not see another tenant's rows, don't give it arbitrary SQL access to a shared table. Use a separate table with a narrow grant, or an application-owned tool that takes tenant identity from trusted caller context and fixes the query scope. Both approaches need isolation tests. This example implements neither row-level authorization nor such an adapter; the private_docs test checks only the separate-table boundary.

Read-only access still leaves other AI agent security risks:

  • Resource use: costly reads can consume CPU or return large amounts of permitted data. The example has a query limit and container resource caps, but no per-agent rate limit or load test.
  • Host privileges: an agent with Docker access, the administrator password, or database-volume access can bypass these restrictions. Keep all three out of its runtime.
  • Untrusted content: a document may contain instructions that steer an agent toward other tools or disclosing readable data. Database permissions do not stop prompt injection.

This lab uses HTTP on loopback. For networked deployments, protect credentials in transit and control access to the MCP server. The lab password is not meant for production.

Cleanup #

Check results.jsonl, run.log, and mcp-*.log for the requests and responses, then remove the lab's containers, network, data volume, and auth store:

./cleanup.sh

Images, Python caches, the virtual environment, and logs remain. Unpack the archive again for a clean rerun.

The official MCP server could read the documentation, and Manticore denied all eight tested mutations under the restricted account. The lesson is in the boundary: MCP's guard helps, but the database grant stops writes. And a read grant on a shared table still exposes other tenants' rows.

── more in #ai-agents 4 stories · sorted by recency
── more on @manticore search 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/ai-agent-access-cont…] indexed:0 read:9min 2026-11-19 · —