OpenFGA Modeling MCP Server

OpenFGA Modeling MCP Server

A specialized MCP server that provides expert-level OpenFGA authorization modeling guidance, enabling users to create and manage authorization models for ReBAC systems directly from VS Code.

Category
访问服务器

README

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!

🎯 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

  • Production URL: https://mcp.openfga.dev
  • MCP Endpoint: https://omcp.openfga.dev/mcp
  • Health Check: https://mcp.openfga.dev/health
  • Protocol: MCP Streamable HTTP (2025-03-26)

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.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选