AI-Assisted TypeDB Development with Cursor and MCP

This tutorial demonstrates how to leverage the Model Context Protocol (MCP) to build a hotel booking system using TypeDB and Cursor.
Though Cursor and TypeDB CE will be used as an example, you could leverage any coding assistant such as Google Antigravity or Claude Code, as long as they support the MCP protocol. Additionally, it should work with TypeDB Cluster as well, both in Cloud-managed and self-hosted configuration.
What is TypeDB MCP server?
The TypeDB MCP Server is a bridge that allows Large Language Models (LLMs) to interact directly with a TypeDB instance. By exposing TypeDB’s schema management and TypeQL querying capabilities as tools, an AI agent (like Cursor’s “Composer” or “Chat”) can architect, query, and refactor your database in real-time based on natural language instructions.
Running the environment
You need two components running: the database engine and the MCP interface.
Run TypeDB CE locally
Make sure you have TypeDB CE installed, and when you do let’s run it with the following command:
typedb server
Run TypeDB MCP server
Next, let’s run the MCP server. It is available as a Docker image, and this is how to run and configure it to connect to the TypeDB Server that we started in the previous step:
docker run -p 8001:8001 typedb/typedb-mcp:1.0.0 \
--typedb-address http://host.docker.internal:8000

Configuring the MCP server in Cursor
Once done, let Cursor know of the existence of the MCP server by entering the appropriate configuration in the mcp.json config File. It can be accessed in Settings > Cursor Settings > Tools & MCP > Add Custom MCP:
{
"mcpServers": {
"typedb-mcp": {
"url": "http://localhost:8001/mcp"
}
}
}
Once configured, you should see a new entry in the list of installed MCP servers, like so:

Start developing
We will model a simple hotel booking system consisting of user, room, and booking. Instead of writing the queries directly, we’ll use english instead and let Cursor translate it into TypeQL for us!
Step 1: Check environment
First, let’s try to list existing databases in your TypeDB instance just as a sanity check.

You should get back the response with the list of existing databases in your server, if any. If you get a connection error, it might indicate that either TypeDB CE or TypeDB MCP Server instance were not setup correctly.

Step 2: Create the database
Once we’ve done the sanity check. Let’s actually start the development of our database. We’ll ask the LLM to create a new database called booking.

Pay attention to the response and verify if the database has been created correctly:

Step 3: Define initial schema
Once we have the database, let’s proceed to define the schema.

It is possible that the LLM agent require a few attempts until it figures out the right syntax, and it’s very important to verify the output for correctness:

Step 4: Refactor booking entity to relation
On second thought, the booking concept is something that we define to capture the act of booking a room by the user. Hence, it should be modeled as relation instead of entity. Let’s ask our LLM agent to update the schema for us:

And verify the output to see if it did the refactor as intended:

Conclusion
There we go! We now have a fully working schema that captures the requirements for our hotel booking app—all without ever having to write a single line of TypeQL manually.
Tips and common LLM issues
Important: Risk in data modification capability
While the TypeDB MCP Server enables powerful data interaction, please note that there’s the risk of incorrect data modification. Hence, only use it only with TypeDB server that contains no important/sensitive data.
In the future, this will be remedied after we’ve implemented an appropriate verification workflow (where a user can verify the change before the agent commits it.
LLM understanding of TypeQL
LLMs occasionally struggle with exact TypeQL syntax. When this issue hits you, it’s useful to provide some links to the relevant page in the TypeDB docs into the prompt to give the LLM agent some context.
Cursor – MCP connection issue
Additionally, we found that Cursor would sometimes lose connection to the MCP server, especially after the latter was restarted. However restarting the IDE would make the problem go away.



