mcp-agensgraph-common
Shared core for the AgensGraph MCP servers (cypher, memory, data-modeling). It exists so the three servers don't each re-implement (and drift on) the same plumbing.
What's in it
| Module | Responsibility |
|---|---|
config |
Merge CLI args + env vars → config dicts (connection_config, transport_config, read_controls, pool_config). Standardized env var names. |
connection |
DSN building, the pool's lifetime, ensure_graph, run_query and read_page. (needs the db extra) |
safety |
quote_identifiers, which keeps the case of a label a model wrote. |
results |
A result as JSON a model can read: rows_of / mapping_rows, value_sanitize, fit_rows. |
transport |
One run_server for stdio / Streamable HTTP / SSE with CORS + TrustedHost middleware. |
Nothing is re-exported from the package root; each server imports the module it needs, which is what keeps the DB-less data-modeling server from importing psycopg to read a namespace out of the environment.
What the pool is told once
The graph to read, how long a statement may take, and how many connections there may be. All
three were per call before, and the first two were a round trip each: a read tool call is 5.00
client-to-server flushes now against 6.00. The graph has to exist before the pool opens, since
each connection selects it as it is made — ensure_graph(dsn, name) is that, on a connection
of its own.
AGENSGRAPH_POOL_MIN_SIZE and AGENSGRAPH_POOL_MAX_SIZE are how the size is found. Both ends
are given values on purpose: a pool told only the lower one is that wide at the top as well,
and a trivial read was measured waiting 7.77 s behind eighteen slow ones for it.
What a read is allowed to do
run_query(..., read_only=True) and read_page run the statement inside the driver's
read_only_transaction, so the refusal is the server's: a Cypher write, an INSERT, a
TRUNCATE and a DROP are each refused with 25006 and leave nothing behind. The block ends
by rolling back, because a transaction that could not write has nothing to commit and the one
thing it can do is SET — committed, that would belong to whoever borrows the connection
next.
One thing a read-only transaction does not stop is COPY ... TO PROGRAM, which runs a
command on the database server's host: it takes rows out rather than putting any in, so there
is no write to refuse, and reading the statement does not stop it either. What stops it is not
holding the privilege. check_role_cannot_run_programs asks once, at startup, and a server
connected as a superuser or a member of pg_execute_server_program refuses to start unless
--allow-server-programs accepts it.
Deciding by reading the statement is not done here at all. agensgraph.cypher's
writable_counters and check_single_statement are what the servers ask about text.
Install
The DB-backed servers depend on mcp-agensgraph-common[db]; the DB-less
data-modeling server depends on mcp-agensgraph-common (no psycopg).
Release files for mcp-agensgraph-common 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| mcp_agensgraph_common-0.3.0.tar.gz | 40.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mcp_agensgraph_common-0.3.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 72.0 kB
Release files / mcp_agensgraph_common-0.3.0.tar.gz
| Download URL | mcp_agensgraph_common-0.3.0.tar.gz |
|---|---|
| Size | 40.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b942da94231b0a785a6e9ca6776b21428421c7c6adfad9ee72a94c4fd8dd4acc
|
|
BLAKE2b-256 checksum How to use checksums |
bcef78e7e59d30cafc2a83a5565d2c1c25da6946bff6529d6e1382b71caf58bd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.5
|
Release files / mcp_agensgraph_common-0.3.0-py3-none-any.whl
| Download URL | mcp_agensgraph_common-0.3.0-py3-none-any.whl |
|---|---|
| Size | 31.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
38e4309df327757c9c99c8820061efad20c06d03b3e9be11d16e416e506c8c0d
|
|
BLAKE2b-256 checksum How to use checksums |
aae733b87196afb93b14006477ed1890520403cc2bbf28807a94f533d680d4d3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.5
|