Skip to main content
Glama
aaguiarz

OpenFGA Modeling MCP Server

by aaguiarz

OpenFGA Modeling MCP Server

A specialized MCP (Model Context Protocol) server that provides expert-level OpenFGA authorization modeling guidance. Get instant access to comprehensive OpenFGA knowledge directly in VS Code.

You can see it in action in this YouTube video.

πŸš€ Quick Start

No installation required! Connect directly to our hosted server:

1. Pre-requisites

  • Enable Copilot in Visual Studio Code.

  • Install the Visual Studio Code OpenFGA Extension. This will help Copilot validate its output by just monitoring the warnings emitted by the editor.

  • Install the OpenFGA CLI. It will let the Agent run tests, verify the output, and fix them if needed.

    brew install openfga/tap/fga
  • Enable Agent mode in Copilot. We had better results with Claude Sonnet 4 than with any other LLM.

2. Configure Your MCP Client

VS Code MCP Extensions

Add this configuration to your VS Code MCP settings, or run the 'MCP Add Server' command and use the https://mcp.openfga.dev/mcp URL:

{
  "mcpServers": {
    "openfga-mcp": {
      "url": "https://mcp.openfga.dev/mcp",
      "type": "http",
      "description": "OpenFGA Authorization Model Context Provider"
    }
  }
}

3. Start Using

Some possible prompts:

"Create an authorization model for a document management system"
"Create an authorization model for <Company Name>"
"Create an authorization model for <Website>"
"Add support for custom roles"
"Add support for temporary access at the document level"
"Split the model in modular models"

The server automatically provides expert context - no @mcp calls needed!

Related MCP server: Microsoft Style Guide MCP Server

🎯 Key Features

  • 🚨 OpenFGA Expert Context: Mandatory guidance for all authorization modeling questions

  • πŸ” Intelligent Detection: Automatically recognizes 31+ OpenFGA-specific patterns

  • πŸ“š Expert Knowledge: 600+ lines of comprehensive OpenFGA modeling documentation

  • πŸ”§ VS Code Native: Seamless GitHub Copilot integration

MCP Server Hosting

Test Connection

# Health check
curl https://mcp.openfga.dev/health

# MCP endpoint test
curl -H "Accept: text/event-stream" \
     https://mcp.openfga.dev/mcp

Automatic OpenFGA Detection

The server automatically triggers expert context for queries containing:

Core OpenFGA Terms

  • openfga, zanzibar, rebac, fga

  • authorization model, auth model, access control

  • relationship tuple, user relation object

  • permission check, can user, access check

Authorization Concepts

  • rbac, abac, permission, role based

  • attribute based, fine grained access control

  • relationship based access control

Technical Implementation

  • openfga dsl, openfga schema, openfga relations

  • openfga types, authorization tuple

�️ Available Tools

1. get_context_for_query

Analyzes queries and returns relevant OpenFGA context.

Parameters:

  • query (string): The query to analyze for OpenFGA patterns

Example queries:

  • "Create an authorization model for a document management system"

  • "Add support for customer roles at the organization level"

  • "Split the model in modules"

  • "Add support for temporal access for documents"

2. list_available_contexts

Lists all available OpenFGA context prompts and their trigger patterns.

πŸ“š Supported Context Areas

  1. Authorization Model Design - Complete guidance for creating OpenFGA models, DSL syntax, and type definitions

  2. Relationship Modeling - Expert patterns for defining user-object relationships and permissions

  3. Zanzibar Concepts - Deep understanding of Google's Zanzibar paper and ReBAC principles

  4. Testing & Validation - Best practices for testing authorization models and relationship tuples

πŸ—οΈ Local Development (Optional)

If you want to run locally or contribute:

# Clone and setup
git clone https://github.com/aaguiarz/openfga-modeling-mcp.git
cd openfga-modeling-mcp
npm install
npm run build

# Development mode
npm run dev

# Enable debug logging
LOG_LEVEL=DEBUG npm run dev

Local VS Code Configuration

{
  "mcpServers": {
    "openfga-context": {
      "command": "node",
      "args": ["dist/index.js"],
      "cwd": "/absolute/path/to/openfga-modeling-mcp"
    }
  }
}

πŸ”¬ Technical Details

  • Framework: Model Context Protocol (MCP) SDK

  • Language: TypeScript with ES2022 target

  • Transport: HTTP for production, STDIO for local development

  • Pattern Engine: Custom rule-based OpenFGA query matching

  • Logging: Structured logging with performance metrics

Project Structure

openfga-modeling-mcp/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ index.ts              # Main MCP server implementation
β”‚   β”œβ”€β”€ prompt-matcher.ts     # OpenFGA pattern matching engine
β”‚   └── logger.ts             # Comprehensive logging system
β”œβ”€β”€ prompts/
β”‚   └── authorization-model.md # OpenFGA expert guidance (600+ lines)
β”œβ”€β”€ dist/                     # Compiled JavaScript output
└── package.json              # Project dependencies and scripts

πŸ“„ License

MIT License - see LICENSE file for details

πŸ”— Related Resources


🚨 Note: This MCP server is exclusively designed for OpenFGA authorization modeling workflows and automatically provides expert guidance for all OpenFGA, Zanzibar, and ReBAC development questions.

Available Tools

2 tools
get_context_for_queryB

Get relevant context prompt based on a query

ParametersJSON Schema
NameRequiredDescriptionDefault
queryYesThe query to find context for

TDQS

B3.1/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided. Description only states the basic function without disclosing any behavioral traits such as behavior on empty results, timeout, destructive potential, or output format. For a tool with no annotations, this is insufficient.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Single sentence with no unnecessary content. Could be slightly more informative without losing conciseness, but currently efficient.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given one parameter, no output schema, no annotations, and a sibling tool, the description is minimal. It lacks details on return format, error cases, or relationship to 'list_available_contexts'. Incomplete for practical use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so baseline is 3. The description adds no additional meaning beyond the schema's param description. Parameter is adequately documented by schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

Description clearly states action ('Get') and resource ('relevant context prompt'), and implies query-based filtering. However, it does not explicitly distinguish from sibling 'list_available_contexts', though the query parameter suggests a targeted retrieval.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Implies usage when a query is available and context is needed, but provides no explicit guidance on when not to use or how it differs from 'list_available_contexts'. No alternatives or prerequisites mentioned.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

list_available_contextsA

List all available context prompts and their descriptions

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

A3.5/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided, so description carries full burden. It implies a read-only operation ('list'), but does not explicitly state safety traits. Adequate for a simple list tool, but lacks explicit behavioral detail.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Single concise sentence with no extraneous information. Perfectly front-loaded and efficient.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's simplicity (no parameters, no output schema), the description is complete. However, it does not mention the sibling tool or any additional context about the prompts.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

No parameters exist, and schema coverage is 100%. Description adds value by specifying what is returned (descriptions). Baseline for zero-param tool is 4.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

Description clearly states the verb (list), resource (context prompts), and output (descriptions). It is specific enough for a tool with one sibling, but does not explicitly distinguish from get_context_for_query.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this tool versus the sibling get_context_for_query. No context on prerequisites or scenarios.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 2 tool updatesv1.0.0
    • First observedget_context_for_query
    • First observedlist_available_contexts

TDQS

B3.4/5.0

Scored across 2 tools

Disambiguation5/5

Both tools have clearly distinct purposes: listing all contexts vs. getting a specific context based on a query. No overlap.

Naming Consistency5/5

Both tools follow a consistent verb_noun pattern with underscores (list_available_contexts, get_context_for_query).

Tool Count3/5

Two tools is on the low side but acceptable for a focused server that only needs to retrieve context prompts. It doesn't feel too sparse given the narrow domain.

Completeness2/5

The server only provides read operations (list and get). Missing create, update, delete operations for context prompts, which are likely needed for full lifecycle management.

Maintenance

ActivityInactive
ResponsivenessNo issues

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • F
    license
    Not graded
    quality
    D
    maintenance
    A professional MCP server for analyzing content against the official Microsoft Writing Style Guide, enabling style, grammar, terminology, and accessibility checks via AI tools like VS Code and GitHub Copilot.
    1
    -
  • A
    license
    Not graded
    quality
    D
    maintenance
    An MCP server that equips AI assistants with specialized, opinionated development playbooks for building microservices, frontends, databases, and DevOps pipelines. It integrates with clients like VS Code Copilot, Claude Desktop, and Cursor to provide battle-tested expertise.
    79
    MIT
  • A
    license
    Not graded
    quality
    A
    maintenance
    A production-ready MCP server that enables AI assistants to intelligently understand, analyze, edit, navigate, and review software projects with multi-workspace support, Git integration, and semantic search.
    1
    MIT