A simpler Gramps MCP Server for chatbots

Hello explorers and developers,

If you have been following the discussions around Chatbots and MCP servers to talk to your family tree, here is another experiment in that category:

If you have an environment where you can pip install packages and you have a Python environment that has access to the gramps source code and your trees, then you could try this out.

pip install gramps-ez-mcp

This will install a complete MCP server ready to run (no docker, no need for gramps-web-api, etc).

You will need an API key set from an LLM vender (like Anthropic, or OpenAI), and a method of using an MCP server (such as an AI coding environment, like Cursor). Here is a simple one:

pip install ez-mcp-toolbox

Then create a ez-config.json file, like:

{
  "model": "openai/gpt-4o-mini",
  "model_parameters": {
    "temperature": 0.0
  },
  "mcp_servers": [
    {
      "name": "gramps-ez-mcp",
      "description": "Gramps EZ MCP server for genealogy chats",
      "command": "gramps-ez-mcp",
      "args": ["Gramps Example"]
    }
  ]
}

changing ā€œGramps Exampleā€ to the name of one of your Gramps family trees.

A quick way to get a list of names is:

gramps -l

At that point, you are ready to talk to your family tree:

I’m thinking that using MCP is going to be simpler for Gramps as it can use a server installed at the OS level, rather than requiring a stack to be packaged with Gramps.

Let me know what you think if you try this out.

5 Likes

Could it be extended to leverage the user’s custom_filters.xml file, assuming that the ā€œnameā€ and/or ā€œcommentā€ attribute of each custom filter contained enough useful detail (whatever that might mean)?

I think so. I didn’t spend too much time on the actual ā€œtoolsā€ (aka Python functions) but it should be able to use filters (built-in and custom). I just have to figure out an interface that would allow the LLM to be able to specify the filter, and necessary arguments.

Next step would be to use the libchatfuncs from:

That would speed up the access for larger trees.

I’ll see about a custom filter API. That would be very nice, especially as we start to make these use the new filter optimization abilities.

A colleague of mine installed your MCP agent together with a webtrees MCP agent. Now it is possible to chat with Gramps and webtrees and compare data in trees in both systems. The next step will be to install a FamilySearch MCP agent. Finally it should be possible to ask the AI: ā€œCheck FamilySearch for information about that person in my tree. Add new information to my tree and show me any difference in the data for that person.ā€

3 Likes

You can see, that it is far from being perfect. But it is already now helpful. There is irrelevant information for example that the XREF is different. The Gramps API requires an additional step to resolve links like Events or family members and some other details. But that can be trained or optimized in the API.

1 Like

Amazing! Some of the differences could be mitigated through a system prompt, like:

You can ignore differences around missing or different XREF. ...

Do you know what your friend is using as chat system, LLM framework, and model? I’m looking into a system that anyone could upload their Gramps tree and use it with a gramps MCP.

Google Gemini is used. The framework is based on n8n.

1 Like

I’m not sure when I’d be ready to let it make updates for me :slight_smile: but that could certainly be a huge time-saver if it is accurate. But it would be nice to let it have read access at the same time that I am using the Gramps GUI. I realize it would have to be sensitive to any changes I might be making; for example, if it is caching results, it would have to clear them.

1 Like

At least in webtrees it is easy to add links to diagrams into the chat. So you can visualize information. I don’t know if that is possible in Gramps desktop, because it isnā€˜t a web application. But it should be possible to do the same thing using Gramps Web.

1 Like

We can make diagrams in gramps-ez-mcp (or any MCP) as it can do more than what the gramps core does. Can you provide some example diagrams?

1 Like