A Model Context Protocol (MCP) server for TypeDB, enabling AI assistants and other MCP clients to interact with TypeDB databases through a standardized interface.
This MCP server provides tools and resources for:
- Executing TypeQL queries and analyzing query plans
- Managing database transactions
- Exploring graph structures and concepts
- Accessing schema information
- Schema Access: Retrieve complete database schemas as TypeQL
- Query Execution: Run and analyze TypeQL queries
- Transaction Management: Open, commit, and close transactions
- Graph Exploration: Navigate concepts, attributes, and relations
- Python 3.9+
- TypeDB Server (running locally or remotely)
- TypeDB database
- Clone the repository:
git clone https://github.com/vaticle/typedb-mcp.git
cd typedb-mcp- Install dependencies:
pip install -r requirements.txt- Configure environment variables (see Configuration section)
Set the following environment variables. You can either:
- Create a
.envfile from.env.exampleand fill in your values - Export them in your shell
- Pass them when running the server
Required variables:
TYPEDB_HOST: TypeDB server host (default:localhost)TYPEDB_PORT: TypeDB server port (default:1729)TYPEDB_DATABASE: Database name to connect to
Optional variables (only if TypeDB server has authentication enabled):
TYPEDB_USERNAME: Username for authenticationTYPEDB_PASSWORD: Password for authentication
- Copy the example environment file:
cp .env.example .env- Edit
.envwith your TypeDB connection details:
# Edit .env file
TYPEDB_HOST=localhost
TYPEDB_PORT=1729
TYPEDB_DATABASE=my_database
# Add credentials if needed:
# TYPEDB_USERNAME=admin
# TYPEDB_PASSWORD=passwordpython -m typedb_mcp.serverdocker run \
-e TYPEDB_HOST=localhost \
-e TYPEDB_PORT=1729 \
-e TYPEDB_DATABASE=my_database \
-e TYPEDB_USERNAME=admin \
-e TYPEDB_PASSWORD=password \
typedb-mcptypedb-mcp/
├── typedb_mcp/ # Main package
│ ├── server.py # MCP server implementation
│ ├── tools/ # MCP tools
│ ├── resources/ # MCP resources
│ └── utils/ # Utility functions
├── tests/ # Test suite
├── PLAN.md # Implementation plan
└── README.md # This file
pytest tests/run_query: Execute a TypeQL queryanalyze_query: Analyze a query without executingopen_transaction: Open a new transactioncommit_transaction: Commit a write transactionclose_transaction: Close a transactiontransaction_run_query: Execute query in transaction contexttransaction_run_analyze: Analyze query in transaction context
get_concept_with_attribute: Find concepts by attribute valueget_attributes_by_concept: Get all attributes of a conceptget_relations_of_concept: Find relations where a concept participatesget_players_of_relation: Get all players in a relation
schema: Complete database schemaschema_functions: All defined functionsschema_types: All type definitions
Contributions are welcome! Please see our contributing guidelines (coming soon).
[License TBD]