Cover image
Try Now
2025-04-01

使用[MCP-GO](https://github.com/mark.com/mark3labs/mcp-go)库构建的Dgraph Graph数据库的模型上下文协议(MCP)服务器实现。

3 years

Works with Finder

1

Github Watches

0

Github Forks

1

Github Stars

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 download

Configuration

The server can be configured using environment variables:

  • DGRAPH_HOST: Dgraph host address (default: localhost:9080)

Usage

Running the Server

go run main.go

The 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 <name> \"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 <name> "Alice" .
_:alice <age> "30" .
_:bob <name> "Bob" .
_:bob <age> "32" .
_:alice <friend> _:bob .

Schema Definition

name: string @index(exact) .
age: int .
friend: [uid] .

License

MIT

相关推荐

  • NiKole Maxwell
  • I craft unique cereal names, stories, and ridiculously cute Cereal Baby images.

  • Joshua Armstrong
  • Confidential guide on numerology and astrology, based of GG33 Public information

  • https://suefel.com
  • Latest advice and best practices for custom GPT development.

  • Alexandru Strujac
  • Efficient thumbnail creator for YouTube videos

  • Emmet Halm
  • Converts Figma frames into front-end code for various mobile frameworks.

  • lumpenspace
  • Take an adjectivised noun, and create images making it progressively more adjective!

  • Elijah Ng Shi Yi
  • Advanced software engineer GPT that excels through nailing the basics.

  • Yasir Eryilmaz
  • AI scriptwriting assistant for short, engaging video content.

  • Lists Tailwind CSS classes in monospaced font

  • https://maiplestudio.com
  • Find Exhibitors, Speakers and more

  • Daren White
  • A supportive coach for mastering all Spanish tenses.

  • apappascs
  • 发现市场上最全面,最新的MCP服务器集合。该存储库充当集中式枢纽,提供了广泛的开源和专有MCP服务器目录,并提供功能,文档链接和贡献者。

  • ShrimpingIt
  • MCP系列GPIO Expander的基于Micropython I2C的操作,源自ADAFRUIT_MCP230XX

  • jae-jae
  • MCP服务器使用剧作《无头浏览器》获取网页内容。

  • HiveNexus
  • 一个适用于中小型团队的AI聊天机器人,支持DeepSeek,Open AI,Claude和Gemini等车型。 专为中小团队设计的ai聊天应用,支持deepSeek,打开ai,claude,双子座等模型。

  • ravitemer
  • 一个功能强大的Neovim插件,用于管理MCP(模型上下文协议)服务器

  • patruff
  • Ollama和MCP服务器之间的桥梁,使本地LLMS可以使用模型上下文协议工具

    Reviews

    3 (1)
    Avatar
    user_vdW7yeJy
    2025-04-16

    "Learning about MCP by Wojciech Matuszewski is an outstanding resource for anyone looking to understand the MCP applications better. The content is clear, concise, and exceptionally well-organized, making it accessible for both beginners and advanced users. Highly recommend diving into this material to enhance your MCP expertise! Check it out at https://mcp.so/server/mcp-server-learning/WojciechMatuszewski."