MCP server¶
gutenberg_kg.mcp_server
¶
GutenbergKG MCP Server.
Serves the consolidated corpus bundle's DocKG over the fleet's shared server
base, :mod:kg_utils.mcp, with GutenbergKG's illustration tools beside it.
Tools¶
stats, query, pack, get_node, neighbors
The fleet's five canonical tools, under the same names as every other KG
server, over bundles/gutenberg-all (books, verse and their sections).
query and pack are DocKG's own hybrid dense + BM25 search.
generate_image
Direct text-to-image on a running image server (no VLM planning).
corpus_imagine
Query the corpus — diaries first, then the books — for context, then
generate an illustration.
The image tools call an image server over HTTP -- the one
GUTENKG_IMAGE_ENDPOINT names, or the first of
image_gen.DEFAULT_IMAGE_ENDPOINTS that answers (make up starts one).
They never load a model in-process: mflux is not a dependency of this package.
Run¶
::
gutenkg mcp # stdio transport (Claude Code / Cursor) gutenkg mcp --manifest # the tool list as JSON, without opening the graph
gutenkg-mcp is the same command. --repo is the GutenbergKG checkout;
--db and --vectors default to bundles/gutenberg-all/.dockg/.
build_server(repo, db=None, vectors=None, model=None)
¶
Build the GutenbergKG MCP server, without opening the bundle's graph.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
repo
|
str | Path
|
The GutenbergKG checkout; its |
required |
db
|
str | Path | None
|
Bundle graph; |
None
|
vectors
|
str | Path | None
|
Bundle vectors; |
None
|
model
|
str | None
|
Embedding model; |
None
|
Returns:
| Type | Description |
|---|---|
KGServer
|
The server; serve it with :func: |
Source code in src/gutenberg_kg/mcp_server.py
232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 | |
corpus_imagine(query, book=None, extra_prompt=None, size='1536x1024', seed=None, steps=4)
async
¶
Search the corpus for a scene (diaries first, then the books), then illustrate it.
The matching passages are rewritten into an image prompt by the local VLM and generated on the running image server.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
query
|
str
|
What to search for, e.g. "great fire of London". |
required |
book
|
str | None
|
Optional book or author name substring to search within, e.g. "pepys". |
None
|
extra_prompt
|
str | None
|
Style or scene notes appended to the corpus text, e.g. "oil painting". |
None
|
size
|
str
|
Output size "WIDTHxHEIGHT" (default landscape 1536x1024). |
'1536x1024'
|
seed
|
int | None
|
Optional integer seed for reproducibility. |
None
|
steps
|
int
|
Inference steps — 4 (fast) to 25 (higher quality). |
4
|
Source code in src/gutenberg_kg/mcp_server.py
154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 | |
generate_image(prompt, size='1536x1024', seed=None, steps=4)
async
¶
Generate an image from a text prompt on the running image server, with no VLM planning.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
prompt
|
str
|
Text description of the image to generate. |
required |
size
|
str
|
Output size "WIDTHxHEIGHT" (default landscape 1536x1024). |
'1536x1024'
|
seed
|
int | None
|
Optional integer seed for reproducible outputs. |
None
|
steps
|
int
|
Inference steps — 4 (fast) to 25 (higher quality). |
4
|
Source code in src/gutenberg_kg/mcp_server.py
126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 | |
main(argv=None)
¶
Entry point for gutenkg-mcp: the same command as gutenkg mcp.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
argv
|
list[str] | None
|
Arguments; |
None
|
Source code in src/gutenberg_kg/mcp_server.py
271 272 273 274 275 276 277 278 | |
stats(*, ctx)
¶
Node and edge counts for the corpus bundle, in total and by kind and relation, plus its vector count.
Source code in src/gutenberg_kg/mcp_server.py
73 74 75 76 77 | |