Stardog MCP Server: Semantic AI Knowledge Graph
Deliver trusted, contextual answers for humans and agents with your enterprise knowledge graph using Stardog's MCP server and Semantic AI platform.
npx -y @stardog-union/stardog-cloud-mcpOverview
The Stardog MCP Server implements a Model Context Protocol (MCP) adapter that connects large language models and agent frameworks to your Stardog knowledge graph and Semantic AI platform. It exposes a concise, machine-readable set of tools and contextual data so LLMs and agents can discover available capabilities, request provenance-rich context, and execute graph-backed operations safely and consistently.
This server is useful when you need trustworthy, contextual answers that combine LLM reasoning with authoritative enterprise knowledge: it centralizes context assembly (semantic search, SPARQL, metadata), provides standardized tool descriptions for agents, and returns responses with provenance and routing information so downstream systems and humans can validate results.
Features
- Implements MCP-style tool and context discovery for LLMs and agents
- Bridges LLMs with Stardog knowledge graphs (SPARQL, reasoning, metadata)
- Semantic retrieval and vector/embedding integration for contextual search
- Standardized tool descriptions and capabilities (name, inputs, outputs, permissions)
- Provenance, source citations, and metadata included in responses
- Configurable via environment variables and Docker for easy deployment
- REST endpoints for registering tools, requesting context, and health checks
- Logging, basic auth / token support and pluggable adapter points for custom auth
Installation / Configuration
Prerequisites: Docker and Docker Compose or a JVM (if building from source). Example steps use Docker.
Clone the repository and run with Docker:
Or use docker-compose (example compose snippet):
version: "3.7"
services:
mcp:
image: stardog-mcp:latest
ports:
- "8080:8080"
environment:
- STARDOG_URL=https://stardog.example.com
- STARDOG_USER=admin
- STARDOG_PASSWORD=secret
- MCP_PORT=8080
Common environment variables
| Variable | Description | Example |
|---|---|---|
| STARDOG_URL | Base URL for Stardog server | https://stardog.example.com |
| STARDOG_USER | Stardog username | admin |
| STARDOG_PASSWORD | Stardog password | secret |
| MCP_PORT | Port the MCP server listens on | 8080 |
| LOG_LEVEL | Logging verbosity (debug/info/warn/error) | info |
| JWT_SECRET | Secret for signing tokens (optional) | abc123 |
After starting, confirm health:
# Expect JSON status response
Available Resources
The server exposes REST endpoints that agents and developer tools use to discover capabilities and request context. Typical endpoints include:
- GET /mcp/tools — list registered tools (name, description, schema)
- POST /mcp/tools — register or update a tool
- POST /mcp/context — request assembled context for a query or tool invocation
- GET /health — basic health check
Example: register a tool (curl)
Example: request context (curl)
Responses typically include contextual documents, vector-scores, endpoint hints, and source citations to support trustworthy LLM output.
Use Cases
- Conversational enterprise assistant: Combine LLM generation with Stardog-backed facts (employee records, product ontologies). The agent queries /mcp/tools and /mcp/context to assemble reliable evidence before answering.
- Retrieval-Augmented Generation (RAG) with provenance: Use semantic retrieval to collect top-N knowledge graph nodes and passages, attach citations, and feed the assembled context to an LLM for an auditable answer.
- Automated workflows and agents: Expose graph operations (SPARQL queries, updates, reasoning calls) as MCP tools so agents can plan and execute multi-step tasks (data validation, remediation) with policy checks.
- Compliance and audit trails: Every context assembly and tool invocation returns metadata and sources, which you can log or store for later audits and traceability.
Getting Started Tips
- Start by registering a minimal set of tools for read-only operations (SPARQL query tool, semantic search tool).
- Configure selective permissions and limit write tools in production environments.
- Use small context sizes initially and tune retrieval parameters (maxContext, similarity thresholds) based on retrieval quality.
- Integrate with your existing authentication (JWT, OAuth) via the server’s adapter hooks to enforce enterprise access controls.
For developers new to the project, review the repository’s example requests and adapter templates to add custom tools or modify context assembly strategies. The MCP server is intended as a lightweight, extensible bridge between LLM-based agents and Stardog-powered knowledge.