Site icon R-bloggers

TKCat meets LLMs: an MCP server for well-documented knowledge resources

[This article was first published on Patrice Godard, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

< section id="documentation-was-always-the-point" class="level2" data-number="1">

1 Documentation was always the point

TKCat (Tailored Knowledge Catalog) is built on a simple idea: a knowledge resource is more than a set of tables. In TKCat, each resource is a modeled database (MDB) that contains:

This documentation was designed from the start to be machine-ready, and it turns out to be exactly what a large language model (LLM) needs in order to work with the data correctly.

< section id="what-is-mcp" class="level2" data-number="2">

2 What is MCP

The Model Context Protocol (MCP), introduced by Anthropic, is an open standard that allows AI assistants to securely connect to external data sources, tools, and workflows. Think of it as a universal adapter for AI: instead of writing custom integrations for every combination of LLM and database, MCP provides a standardized client-server architecture.

In this setup, an MCP client (such as Claude Desktop, Claude Code, or Posit Assistant) communicates with an MCP server using a common protocol over local or remote connections. The server exposes a defined set of “tools” and resources that the assistant can discover and invoke dynamically based on the user’s natural language request.

For TKCat, MCP is a natural fit. Rather than forcing developers to build bespoke chat interfaces or write brittle custom prompts for every catalog, TKCat 1.3.0 exposes its modeled databases directly through a standard MCP server. Any MCP-compatible assistant instantly gains the structured vocabulary, relationship maps, and security guardrails it needs to navigate, query, and synthesize your knowledge resources safely.

< section id="whats-new-in-tkcat-1.3.0" class="level2" data-number="3">

3 What’s new in TKCat 1.3.0

TKCat 1.3.0 includes a read-only MCP server. With it, AI assistants such as Claude Code, Claude Desktop, Posit Assistant or any other MCP client can explore and query the MDBs of a chTKCat instance (TKCat on ClickHouse).

The server comes in two forms:

The assistant has a small set of tools that match how a careful analyst works with an unfamiliar resource:

Step Tools
Find relevant resources list_mdbs, search_tkcat
Understand them describe_mdb, describe_tables, list_collections
Look at the data preview_table
Answer the question query_mdb (ClickHouse SQL), get_matrix_values
< section id="why-documented-databases-make-a-difference" class="level2" data-number="4">

4 Why documented databases make a difference

Ask an LLM a question about a database it has never seen and it will guess: it may infer table meanings from their names, assume joins and get the semantics of a column wrong. With TKCat, the assistant doesn’t need to guess:

A typical exchange looks like this:

User: Which drugs target genes associated with the phenotypes of this disease?

Assistant: searches the catalog → reads the descriptions of the phenotype, variant and drug MDBs → checks the collections that link them → previews a few records → runs a cross-MDB SQL query → returns the answer, with the queries it ran and the resources it used.

The better the documentation, the better the answers. The effort put into documenting a resource once now pays off every time someone asks a question about it, in plain language.

< section id="built-for-shared-governed-environments" class="level2" data-number="5">

5 Built for shared, governed environments

Knowledge resources often have different access rules, and they are hosted by an organization rather than on a personal laptop. The MCP server was designed with this in mind:

Remote MCP server architecture

As with any AI service, only expose MDBs whose content can be shared with the assistant under your organization’s policies.

< section id="getting-started" class="level2" data-number="6">

6 Getting started

The best place to start is the new TKCat End-to-End vignette. It covers the whole process:

  1. setting up a ClickHouse instance for TKCat,
  2. preparing example MDBs (HPO, ClinVar, ChEMBL),
  3. pushing them to ClickHouse and querying them from R,
  4. deploying the MCP server (local and remote, with systemd and nginx),
  5. configuring MCP clients (Claude Code, Claude Desktop, Posit Assistant).

For reference details on the server, its tools and its parameters, see the MCP server vignette.

For a complete introduction to TKCat, refer to the main vignette.

Feedback and issues are welcome on GitHub.

To leave a comment for the author, please follow the link and comment on their blog: Patrice Godard.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
Exit mobile version