Get the FREE Ultimate OpenClaw Setup Guide →

dgraph

A Model Context Protocol (MCP) server implementation for Dgraph graph database, built using the [mcp-go](https://github.com/mark3labs/mcp-go) library.

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio johnymontana-dgraph-mcp-server go run main.go \
  --env DGRAPH_HOST="Dgraph host address (default: localhost:9080)"

How to use

This MCP server provides a bridge between large language model workflows and a Dgraph graph database. It exposes tools that let you run DQL queries, apply mutations, and manage the Dgraph schema. The server communicates over standard input/output to integrate with LLM frameworks that support the MCP protocol. To use it, start the server (for example with go run main.go) with DGRAPH_HOST set to your Dgraph endpoint, then send MCP-style tool invocations to perform queries, mutations, or schema changes. The available tools ensure you can fetch data, mutate the graph, alter the schema, and retrieve the current schema as needed by your LLM-driven workflows.

How to install

Prerequisites:

  • Go 1.18 or higher
  • Dgraph database (local or remote)

Installation steps:

  1. Clone the repository:
git clone https://github.com/johnymontana-dgraph-mcp-server.git
cd johnymontana-dgraph-mcp-server
  1. Install dependencies and build/run:
# Since this project uses Go modules, fetch dependencies and run the server:
go mod download
go run main.go
  1. Configure the Dgraph host via environment variable when launching the server:
DGRAPH_HOST=localhost:9080 go run main.go

Additional notes

Tips and common issues:

  • Ensure Dgraph is reachable at the DGRAPH_HOST address (default localhost:9080).
  • If you modify the Dgraph connection, restart the server to pick up the new host.
  • The server uses standard input/output for MCP communication; ensure your LLM framework is configured to send and receive MCP messages accordingly.
  • If you encounter schema-related errors, verify the schema syntax you pass through dgraph_alter_schema and that it conforms to Dgraph expectations.
  • The Dgraph tools (dgraph_query, dgraph_mutate, dgraph_alter_schema) expect parameters in the MCP tool format described in the README.

Related MCP Servers

Sponsor this space

Reach thousands of developers