dgraph-mcp-server
A Model Context Protocol (MCP) server implementation for Dgraph graph database, built using the [mcp-go](https://github.com/mark3labs/mcp-go) library.
Documentation
Dgraph MCP Server
A Model Context Protocol (MCP) server implementation for Dgraph graph database, built using the mcp-go library.
Overview
This project implements an MCP server that allows LLM applications to interact with a Dgraph database. It provides tools for:
- Executing DQL queries
- Performing mutations
- Altering the schema
- Retrieving the current schema
Prerequisites
- Go 1.18 or higher
- Dgraph database (running locally or remotely)
Installation
1. Clone this repository
2. Install dependencies:
go mod downloadConfiguration
The server can be configured using environment variables:
- `DGRAPH_HOST`: Dgraph host address (default: `localhost:9080`)
Usage
Running the Server
go run main.goThe server uses standard input/output for communication with LLM applications.
Available Tools
1. dgraph_query
Execute a DQL query against Dgraph.
Parameters:
- `query` (string, required): The DQL query to execute
- `variables` (object, optional): Variables for the query
Example:
{
"tool": "dgraph_query",
"params": {
"query": "{ me(func: has(name)) { name } }"
}
}2. dgraph_mutate
Execute a mutation against Dgraph.
Parameters:
- `mutation` (string, required): The RDF mutation to execute
- `commit` (boolean, optional): Whether to commit the transaction (default: true)
Example:
{
"tool": "dgraph_mutate",
"params": {
"mutation": "_:person \"John Doe\" .",
"commit": true
}
}3. dgraph_alter_schema
Alter the Dgraph schema.
Parameters:
- `schema` (string, required): The schema definition to apply
Example:
{
"tool": "dgraph_alter_schema",
"params": {
"schema": "name: string @index(exact) ."
}
}Available Resources
1. dgraph://schema
Returns the current Dgraph schema.
Integration with LLM Applications
This server can be integrated with any LLM application that supports the Model Context Protocol (MCP). The server communicates via standard input/output, making it easy to integrate with various LLM frameworks.
Example Queries
Basic Query
{
people(func: has(name)) {
name
age
friends {
name
}
}
}Adding Data
_:alice "Alice" .
_:alice "30" .
_:bob "Bob" .
_:bob "32" .
_:alice _:bob .Schema Definition
name: string @index(exact) .
age: int .
friend: [uid] .License
MIT
Frequently asked questions
What is dgraph-mcp-server?
dgraph-mcp-server is A Model Context Protocol (MCP) server implementation for Dgraph graph database, built using the [mcp-go](https://github.com/mark3labs/mcp-go) library.
How do I install dgraph-mcp-server?
Open the GitHub repository and follow its README. Most MCP servers are added to your client's MCP config, then called by your agent.
Is dgraph-mcp-server open source?
Yes — it is hosted on GitHub at https://github.com/johnymontana/dgraph-mcp-server and has 3 stars.
Related MCP tools
Convert Any OpenAPI V3 API to MCP Server Go-based implementation. Trusted by 500+ developers. Trusted by 500+ developers.
:robot: The free, Open Source alternative to OpenAI, Claude and others. Self-hosted and local-first. Drop-in replacement for OpenAI, running on consumer-gra...
MCP Toolbox for Databases is an open source MCP server for databases. Go-based implementation. Trusted by 10900+ developers.
A Go implementation of the Model Context Protocol (MCP), enabling seamless integration between LLM applications and external data sources and tools.
WhatsApp MCP server Go-based implementation. Trusted by 4900+ developers. Trusted by 4900+ developers. Trusted by 4900+ developers.
MCP server for Grafana Go-based implementation. Trusted by 1700+ developers. Trusted by 1700+ developers. Trusted by 1700+ developers.
Run your own MCP server? See who uses it and what to fix.
Measure it with TrackMCP