Skip to content

Add query-first wiki MCP server#216

Merged
EthanThatOneKid merged 5 commits into
mainfrom
feat/wiki-mcp
Jul 13, 2026
Merged

Add query-first wiki MCP server#216
EthanThatOneKid merged 5 commits into
mainfrom
feat/wiki-mcp

Conversation

@EthanThatOneKid

@EthanThatOneKid EthanThatOneKid commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • add a read-only wiki mcp stdio server backed by the existing Wiki graph query path
  • expose query_sparql, describe_wiki, and lightweight wiki:// resources
  • include observed class/predicate vocabulary in describe_wiki so agents can write grounded SPARQL
  • add a minimal TypeScript wiki.mcp() spawn helper and docs

Addressing m13v comment

Credit to @m13v for calling out the real adoption risk in the issue thread:

the read-only, query-first scope is the right call. the thing that decides whether agents actually use this is describe_wiki, not query_sparql. the recurring failure mode with SPARQL over MCP is the model inventing a predicate that isn't in the graph, getting an empty result set, and reading it as "no data" rather than "bad query". namespaces alone don't prevent that, a handful of real class and predicate names would. so "should describe_wiki stay purely factual" is quietly the load-bearing open question in this issue, not the transport one.

This PR attacks that failure mode by making describe_wiki more than config plus namespaces while still keeping it factual/read-only:

  • describe_wiki includes an observed vocabulary block from the current graph.
  • Classes are counted from real rdf:type triples.
  • Predicates are counted from actual graph triples.
  • Entries include full iri, compact curie when namespace bindings support it, and usage count.
  • The vocabulary is generated from the same inferred graph used by default query_sparql, so it reflects what agents actually query.
  • The docs call this out explicitly as the load-bearing context that prevents invented predicates from being misread as missing data.

That keeps the MCP surface query-first without leaving agents to guess the graph schema from namespaces alone.

Verification

  • uv run ruff check .
  • uv run pytest
  • npm run test:npm
  • uv run wiki -c docs/wiki.yml fmt --check docs/wiki/Wiki_Subcommand_mcp.md docs/wiki/Wiki_CLI.md
  • uv run wiki -c docs/wiki.yml lint --strict
  • uv run wiki -c docs/wiki.yml check --strict
  • uv run wiki -c docs/wiki.yml render --check

@EthanThatOneKid EthanThatOneKid merged commit 5483c5d into main Jul 13, 2026
2 checks passed
@EthanThatOneKid EthanThatOneKid deleted the feat/wiki-mcp branch July 13, 2026 06:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant