spicedb-mcp-server
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@spicedb-mcp-serverCheck if user:alice can view document:report1"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
SpiceDB MCP Server
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
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
Related MCP server: OpenAPI MCP Server
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 startIntegrating 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
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
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/samkim/spicedb-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server