Skip to main content
Glama
OpenFGA MCP Server

OpenFGA MCP Server

by Gyeom

OpenFGA MCP Server

OpenFGA를 위한 Model Context Protocol (MCP) 서버입니다. Claude Code에서 OpenFGA 권한 관리 작업을 수행할 수 있습니다.

기능

  • 스토어 관리: 스토어 목록 조회

  • 모델 관리: Authorization Model 조회/배포

  • 튜플 관리: 권한 관계(튜플) CRUD

  • 권한 체크: Check, ListObjects, Expand

Related MCP server: Okta MCP Server

설치

npm install
npm run build

환경 설정

방법 1: JSON 환경변수 (권장)

export OPENFGA_ENVIRONMENTS='{
  "prod": {
    "url": "https://openfga.example.com",
    "defaultStoreId": "01ABC..."
  },
  "staging": {
    "url": "https://openfga-staging.example.com"
  }
}'

방법 2: 개별 환경변수

# 각 환경별로 설정
export OPENFGA_PROD_URL="https://openfga.example.com"
export OPENFGA_PROD_STORE_ID="01ABC..."

export OPENFGA_STAGING_URL="https://openfga-staging.example.com"

방법 3: 로컬 전용

# 기본값: http://localhost:8080
export OPENFGA_LOCAL_URL="http://localhost:8080"
export OPENFGA_LOCAL_STORE_ID="01XYZ..."

Claude Code 설정

프로젝트별 설정 (.claude/settings.json)

{
  "mcpServers": {
    "openfga": {
      "type": "stdio",
      "command": "node",
      "args": ["/path/to/openfga-mcp/dist/index.js"]
    }
  },
  "env": {
    "OPENFGA_ENVIRONMENTS": "{\"prod\":{\"url\":\"https://openfga.example.com\",\"defaultStoreId\":\"01ABC...\"}}"
  }
}

글로벌 설정 (~/.claude.json)

{
  "mcpServers": {
    "openfga": {
      "type": "stdio",
      "command": "node",
      "args": ["/path/to/openfga-mcp/dist/index.js"],
      "env": {
        "OPENFGA_ENVIRONMENTS": "{\"prod\":{\"url\":\"https://openfga.example.com\"}}"
      }
    }
  }
}

사용 가능한 도구

도구

설명

openfga_store_list

스토어 목록 조회

openfga_model_read

Authorization Model 조회

openfga_model_write

Authorization Model 배포 (DSL 파일/문자열)

openfga_tuple_read

튜플 조회 (필터 지원)

openfga_tuple_write

단일 튜플 생성

openfga_tuple_batch_write

여러 튜플 일괄 생성

openfga_tuple_delete

튜플 삭제

openfga_check

권한 체크

openfga_list_objects

접근 가능한 오브젝트 목록

openfga_expand

권한 트리 확장

openfga_model_write

DSL 파일을 OpenFGA에 배포합니다.

요구사항: fga CLI 설치 필요 (설치 가이드)

# macOS
brew install openfga/tap/fga

# 기타
go install github.com/openfga/cli/cmd/fga@latest

사용 예시

# 모델 조회
openfga_model_read(env: "prod")

# 모델 배포
openfga_model_write(env: "prod", filePath: "/path/to/model.fga")

# 권한 체크
openfga_check(env: "prod", user: "user:alice", relation: "can_view", object: "document:1")

# 튜플 생성
openfga_tuple_write(env: "prod", user: "user:alice", relation: "viewer", object: "document:1")

# 튜플 배치 생성
openfga_tuple_batch_write(env: "prod", tuples: [
  {user: "user:alice", relation: "viewer", object: "document:1"},
  {user: "user:bob", relation: "editor", object: "document:1"}
])

자연어로도 요청 가능:

prod 환경에서 user:alice가 document:1을 can_view 할 수 있는지 확인해줘

Hooks 연동 (선택)

모델 배포 후 설정 파일 자동 업데이트 등의 프로젝트별 작업이 필요하면 Claude Code Hook을 사용하세요:

{
  "hooks": {
    "PostToolUse": [{
      "matcher": "mcp__openfga__openfga_model_write",
      "hooks": [{
        "type": "command",
        "command": "./scripts/post-model-deploy.sh"
      }]
    }]
  }
}

Hook 스크립트는 stdin으로 JSON을 받습니다:

{
  "tool_name": "mcp__openfga__openfga_model_write",
  "tool_output": "모델 배포 완료!\nAuthorization Model ID: 01ABC...\nEnvironment: prod"
}

개발

# 소스 수정 후 빌드
npm run build

# 개발 모드 (watch)
npm run dev

라이선스

MIT

Available Tools

10 tools
openfga_checkC

OpenFGA 권한 체크 - 사용자가 특정 권한을 가지는지 확인

Inputs: env (required), user (required), relation (required), object (required), +1 more.

openfga_expandB

OpenFGA 권한 트리 확장 - 특정 오브젝트의 권한 관계 트리 조회

Inputs: env (required), relation (required), object (required), storeId.

openfga_list_objectsC

OpenFGA 오브젝트 목록 조회 - 사용자가 접근 가능한 오브젝트 목록

Inputs: env (required), user (required), relation (required), type (required), +1 more.

openfga_model_readC

OpenFGA Authorization Model 조회

Inputs: env (required), storeId.

openfga_model_writeC

OpenFGA Authorization Model 배포 - DSL 파일 경로 또는 DSL 문자열로 모델 배포

Inputs: env (required), storeId, filePath, dsl.

openfga_store_listC

OpenFGA 스토어 목록 조회

Inputs: env (required).

openfga_tuple_batch_writeC

OpenFGA 튜플 배치 생성 (여러 개 한번에)

Inputs: env (required), tuples (required), storeId.

openfga_tuple_deleteC

OpenFGA 튜플(권한 관계) 삭제

Inputs: env (required), user (required), relation (required), object (required), +1 more.

openfga_tuple_readC

OpenFGA 튜플(권한 관계) 조회

Inputs: env (required), storeId, user, relation, +1 more.

openfga_tuple_writeC

OpenFGA 튜플(권한 관계) 생성

Inputs: env (required), user (required), relation (required), object (required), +1 more.

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A3.5/5.0

    Scored across 10 tools

    Disambiguation5/5

    Each tool has a clearly distinct purpose targeting specific OpenFGA operations: check, expand, list_objects, model_read/write, store_list, and tuple operations (read/write/delete/batch_write). No overlap exists between tools, making selection unambiguous for an agent.

    Naming Consistency5/5

    All tools follow a consistent 'openfga_' prefix with snake_case naming, using descriptive verb_noun patterns (e.g., openfga_check, openfga_tuple_write). This uniformity makes the tool set predictable and easy to navigate.

    Tool Count5/5

    With 10 tools, this server is well-scoped for OpenFGA operations, covering core functionalities like authorization checks, model management, tuple operations, and store handling. Each tool earns its place without being overwhelming or insufficient.

    Completeness5/5

    The tool set provides complete coverage for OpenFGA's domain, including CRUD operations for tuples and models, permission checks, expansion for relationship trees, and store management. No obvious gaps exist, enabling agents to handle full authorization workflows.

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      B
      quality
      D
      maintenance
      Enables intelligent interaction with Azure resources through natural language by translating requests into safe, auditable Azure CLI commands with plan/review workflows and direct access to 8 Azure services including Storage, Cosmos DB, Key Vault, and more.
      3
      1
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables management of Okta identity platform through natural language, allowing users to perform operations on applications, groups, and users with secure API token authentication.
      23 npm
      2
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables managing users, apps, roles, authentication, and security settings through natural language, providing comprehensive access to the OneLogin API.
      205 npm
      7
      MIT