@@ -181,16 +181,6 @@ Relevant information is pulled from <https://cratedb.com/docs>, curated per
181181<br>
182182Tool names are : ` get_cratedb_documentation_index` , `fetch_cratedb_docs`
183183
184- # ## Security considerations
185-
186- **By default, the application will access the database in read-only mode.**
187-
188- We do not recommend letting LLM-based agents insert or modify data by itself.
189- As such, only `SELECT` statements are permitted and forwarded to the database.
190- All other operations will raise a `ValueError` exception, unless the
191- ` CRATEDB_MCP_PERMIT_ALL_STATEMENTS` environment variable is set to a
192- truthy value. This is **not** recommended.
193-
194184# ## Install
195185
196186The configuration snippets for AI assistants are using the `uvx` launcher
@@ -233,6 +223,23 @@ in seconds.
233223The `CRATEDB_MCP_DOCS_CACHE_TTL` environment variable (default : 3600) defines
234224the cache lifetime for documentation resources in seconds.
235225
226+ # ## Security considerations
227+
228+ If you want to prevent agents from modifying data, i.e., permit `SELECT` statements
229+ only, it is recommended to [create a read-only database user by using "GRANT DQL"].
230+ ` ` ` sql
231+ CREATE USER "read-only" WITH (password = 'YOUR_PASSWORD');
232+ GRANT DQL TO "read-only";
233+ ` ` `
234+ Then, include relevant access credentials in the cluster URL.
235+ ` ` ` shell
236+ export CRATEDB_CLUSTER_URL="https://read-only:[email protected] :4200" 237+ ` ` `
238+ The MCP Server also prohibits non-SELECT statements on the application level.
239+ All other operations will raise a `PermissionError` exception, unless the
240+ ` CRATEDB_MCP_PERMIT_ALL_STATEMENTS` environment variable is set to a
241+ truthy value.
242+
236243# ## Operate
237244
238245Start MCP server with `stdio` transport (default).
@@ -289,6 +296,7 @@ Version pinning is strongly recommended, especially if you use it as a library.
289296[CrateDB] : https://cratedb.com/database
290297[cratedb-about] : https://pypi.org/project/cratedb-about/
291298[cratedb-outline.yaml] : https://github.com/crate/about/blob/v0.0.4/src/cratedb_about/outline/cratedb-outline.yaml
299+ [create a read-only database user by using "GRANT DQL"] : https://community.cratedb.com/t/create-read-only-database-user-by-using-grant-dql/2031
292300[development documentation] : https://github.com/crate/cratedb-mcp/blob/main/DEVELOP.md
293301[example questions] : https://github.com/crate/about/blob/v0.0.4/src/cratedb_about/query/model.py#L17-L44
294302[examples folder] : https://github.com/crate/cratedb-mcp/tree/main/examples
0 commit comments