Spicedb
FreeNot checkedModel Context Protocol (MCP) server for SpiceDB. Connects LLMs to SpiceDB to explore and interact with permissions systems with natural language. Generated (mos
About
Model Context Protocol (MCP) server for SpiceDB. Connects LLMs to SpiceDB to explore and interact with permissions systems with natural language. Generated (mostly) by Claude 3.7 Sonnet.
README
[!CAUTION] This is an experimental MCP server. This is only intended for educational purposes so use at your own risk.
A Model Context Protocol (MCP) server that connects to SpiceDB via its HTTP API for permission management. This server enables LLMs like Claude to interact with your SpiceDB instance to query, manage, and understand your permission system.
Features
[!NOTE] Everything in this repo was almost entirely created by Claude 3.5 Sonnet. Any quirks, unusual patterns, or potential errors are direct artifacts of LLM-based generation.
Resources:
- Schema retrieval with associated object definition resources
- Relationship queries with interactive relationship resources
- Object definitions with detailed type information
Tools:
- Read schema with object definition resources
- Read relationships with relationship resources
- Check permissions with detailed authorization traces and explanations
- Look up resources by subject with permission context
- Look up subjects by resource with permission details
- Write relationships with validation
Prerequisites
- Node.js 16+
- SpiceDB instance
- SpiceDB API key
Installation
Clone this repository:
git clone https://github.com/authzed/spicedb-mcp-server.git cd spicedb-mcp-serverInstall dependencies:
npm install # or yarn installConfigure your environment:
Create a
.envfile with your SpiceDB connection details:# SpiceDB HTTP API endpoint (the default port for HTTP API is typically 8443) SPICEDB_ENDPOINT=http://localhost:8443 # or for TLS: https://spicedb.example.com SPICEDB_API_KEY=your-api-key-here SPICEDB_USE_TLS=falseBuild the server:
npm run build # or yarn build
Usage
Running Directly
Run the server from the command line:
node build/index.js
# or
npm start
# or
yarn start
Integrating with Claude for Desktop
Edit your Claude for Desktop configuration file:
macOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonWindows:
%APPDATA%\Claude\claude_desktop_config.jsonAdd the SpiceDB MCP server to the
mcpServerssection:
{
"mcpServers": {
"spicedb": {
"command": "node",
"args": [
"/path/to/spicedb-mcp-server/build/index.js"
],
"env": {
"SPICEDB_ENDPOINT": "http://localhost:8443",
"SPICEDB_API_KEY": "your-api-key-here",
"SPICEDB_USE_TLS": "false"
}
}
}
}
Restart Claude for Desktop
View logs for Claude Desktop and SpiceDB MCP
macOS:
/Users/<your username>/Library/Logs/Claude/mcp-server-spicedb.logand/Users/<your username>/Library/Logs/Claude/mcp.log
Examples
[!NOTE] A SpiceDB instance with a schema and relationship data should be running with the flag
--http-enabled
Example Commands for Claude
Check a permission:
"Does user:alice have the permission view on document:report1?"
Find all resources a subject can access:
"What documents can user:bob read?"
Find all subjects that can access a resource:
"Who has edit permission on project:website?"
Analyze schema:
"Can you explain the permission system schema?"
Setup test scenarios
"Setup the following scenario by writing the appropriate relationships: there is a new role "auditor" and user jared has that role"
Preview compliance operations
"The project pied_piper is now deprecated. Find all users who have some form of access to it and create a comprehensive list of users and their access"
API Reference
Resources
spicedb://schema- Get the current schema, returns both schema text and object definition resourcesspicedb://relationships/{resourceType?}/{resourceId?}/{relation?}/{subjectType?}/{subjectId?}/{subjectRelation?}- Query relationships with optional filtersspicedb://definition/{objectType}- Get detailed definition for a specific object type
Tools
read-schema- Retrieves the current schema with object definition resourcesread-relationships- Queries relationships based on filter parameters, returns both text output and relationship resourcescheck-permission- Checks if a subject has a specific permission on a resource with debug tracing and explanations of the authorization decisionlookup-resources- Finds resources where a subject has a specific permission, optimized for array response formatslookup-subjects- Finds subjects with a specific permission on a resource, optimized for array response formatswrite-relationship- Creates, updates, or deletes a relationship with validation
Prompts
lookup-resources-for-subject- Finds resources a subject can accesslookup-subjects-for-resource- Finds subjects that can access a resourceexplain-permission-check- Explains a permission check resultanalyze-schema- Analyzes the current permission schema
Relationship Format
Relationships in SpiceDB are formatted as:
resourceType:resourceId#relation@subjectType:subjectId[#subjectRelation]
This format combines:
- Resource:
resourceType:resourceId(the object being accessed) - Relation:
#relation(the relationship type) - Subject:
subjectType:subjectId(the actor accessing the resource) - Optional subject relation:
#subjectRelation(for computed subjects)
Examples:
document:report#viewer@user:alice- User alice is a viewer of the report documentproject:website#admin@group:engineering#member- Members of the engineering group are admins of the website projectresource:promserver#viewer@usergroup:engineering#member- Members of the engineering user group are viewers of the promserver resource
MCP Connection Lifecycle
The SpiceDB MCP server implements the full Model Context Protocol connection lifecycle:
Initialization Request: When a client connects, it sends an
initializerequest containing:- Protocol version
- Client information (name, version)
- Client capabilities
Server Response: The server responds with:
- Protocol version
- Server information (name, version)
- Server capabilities (resources, tools, prompts, etc.)
Initialization Confirmation: The client sends an
initializednotification to confirm the connection.Message Exchange: Normal operation begins with the exchange of requests and responses.
Termination: When the client disconnects, the server cleans up resources.
The server logs details about this lifecycle to stderr, which you can observe when running the server directly.
Server Capabilities
This server provides the following capabilities:
- Resources: Exposes schema, relationships, and definitions as readable and navigable resources
- Tools: Provides tools for interacting with SpiceDB with rich responses including resources
- Prompts: Offers template prompts for common permission-related tasks and analysis
- Debug Tracing: Includes detailed authorization decision traces and explanations
- Response Formats: Support for both legacy and array-based SpiceDB API response formats
- Logging: Provides structured logging for troubleshooting and monitoring
Install Spicedb in Claude Desktop, Claude Code & Cursor
unyly install spicedbInstalls into Claude Desktop, Claude Code, Cursor & VS Code — handles npx, uvx and build-from-source repos for you.
First time? Get the CLI: curl -fsSL https://unyly.org/install | sh
Or configure manually
Run in your terminal:
claude mcp add spicedb -- npx -y github:samkim/spicedb-mcp-serverStep-by-step: how to install Spicedb
FAQ
Is Spicedb MCP free?
Yes, Spicedb MCP is free — one-click install via Unyly at no cost.
Does Spicedb need an API key?
No, Spicedb runs without API keys or environment variables.
Is Spicedb hosted or self-hosted?
Self-hosted: the server runs locally on your machine via the install command above.
How do I install Spicedb in Claude Desktop, Claude Code or Cursor?
Open Spicedb on unyly.org, pick your client tab (Claude Desktop, Claude Code, Cursor) and press Install — the config is generated automatically, no JSON editing.
Related MCPs
Fetch
Web content fetching and conversion for efficient LLM usage.
AWS KB Retrieval
Retrieval from AWS Knowledge Base using Bedrock Agent Runtime.
by modelcontextprotocolSpring AI MCP Server
Provides auto-configuration for setting up an MCP server in Spring Boot applications.
llm-analysis-assistant
A very streamlined mcp client that supports calling and monitoring stdio/sse/streamableHttp, and can also view request responses through the /logs page. It also
by xuzexin-hzMCP-Agent
A simple, composable framework to build agents using Model Context Protocol by [LastMile AI](https://www.lastmileai.dev)
by lastmile-aiSpring AI MCP Client
Provides auto-configuration for MCP client functionality in Spring Boot applications.
mcp.natoma.ai
A Hosted MCP Platform to discover, install, manage and deploy MCP servers by [Natoma Labs](https://www.natoma.ai)
MCPHub
Website to list high quality MCP servers and reviews by real users. Also provide online chatbot for popular LLM models with MCP server support.
MCP Servers Rating and User Reviews
Website to rate MCP servers, write authentic user reviews, and [search engine for agent & mcp](http://www.deepnlp.org/search/agent)
mkinf
An Open Source registry of hosted MCP Servers to accelerate AI agent workflows.
Compare Spicedb with
Not sure what to pick?
Find your stack in 60 seconds
Author?
Embed badge for your README
Browse similar
All ai MCPs
