OpenFGA-MCP模型上下文协议服务器
一个实验性的模型上下文协议服务器,使大型语言模型能够读取、搜索和操作OpenFGA授权存储,从而为代理人工智能和自然语言交互解锁细粒度的访问控制。
MCP 服务配置
复制以下 JSON 到 OPClaw 或其他 MCP 客户端的配置文件中即可使用
{
"mcpServers": {
"openfga-mcp": {
"args": [
"openfga-mcp@latest"
],
"command": "uvx"
}
}
}
该服务需要配置环境变量:OPENFGA_API_URL、OPENFGA_STORE_ID
服务介绍
OpenFGA MCP 服务器
一个实验性的 模型上下文协议 (MCP) 服务器,使大型语言模型 (LLMs) 能够读取、搜索和操作 OpenFGA 存储。为代理型 AI 解锁授权,并为人类提供细粒度的 氛围编码✨。
需求
- Python 3.12+
- 一个 OpenFGA 服务器
功能
工具
存储管理
create_store: 创建一个新的存储。(create-store)list_stores: 列出所有存储。(list-stores)get_store: 获取存储详情。(get-store)delete_store: 删除一个存储。(delete-store)get_store_id_by_name: 根据名称获取存储 ID。
授权模型管理
write_authorization_model: 写入授权模型。(write-authorization-model)read_authorization_models: 列出所有授权模型。(read-authorization-models)get_authorization_model: 获取特定版本的授权模型详情。(get-authorization-model)
关系元组管理
write_relation_tuples: 写入关系元组。(write-relation-tuples)read_relation_tuples: 读取关系元组。(read-relation-tuples)
关系查询
check: 检查用户是否与某个对象有关系。(check)list_objects: 列出用户具有某种关系的对象。(list-objects)list_users: 列出对给定对象具有特定关系的所有用户。(list-users)
资源
提示
使用
我们建议使用 UVX 运行服务器:
uvx openfga-mcp@latest
通过 Smithery 安装
要通过 Smithery 自动安装适用于 Claude Desktop 的 OpenFGA MCP 服务器:
npx -y @smithery/cli install @evansims/openfga-mcp --client claude
配置
服务器接受以下参数:
--openfga_url: 您的 OpenFGA 服务器的 URL--openfga_store: MCP 服务器将使用的 OpenFGA 存储 ID--openfga_model: MCP 服务器将使用的 OpenFGA 授权模型 ID
对于 API 令牌认证:
--openfga_token: 用于您的 OpenFGA 服务器的 API 令牌
对于客户端凭证认证:
--openfga_client_id: 用于您的 OpenFGA 服务器的客户端 ID--openfga_client_secret: 用于您的 OpenFGA 服务器的客户端密钥--openfga_api_issuer: 用于您的 OpenFGA 服务器的 API 发行者--openfga_api_audience: 用于您的 OpenFGA 服务器的 API 受众
例如:
uvx openfga-mcp@latest \
--openfga_url="http://127.0.0.1:8080" \
--openfga_store="your-store-id" \
--openfga_model="your-model-id"
与 Claude 桌面版一起使用
要配置 Claude 以使用该服务器,请在您的 Claude 配置中添加以下内容:
{
"mcpServers": {
"openfga-mcp": {
"command": "uvx",
"args": ["openfga-mcp@latest"]
}
}
}
- 您可能需要指定
uvx可执行文件的完整路径。使用which uvx来查找它。 - 更新配置后,您必须重启 Claude。
与 Raycast 一起使用
与 Cursor 一起使用
与 Windsurf 一起使用
开发
要设置您的开发环境,请运行:
make setup
要运行开发服务器:
make run \
--openfga_url="http://127.0.0.1:8080" \
--openfga_store="your-store-id" \
--openfga_model="your-model-id"
要运行带有 MCP Inspector 的开发服务器:
make dev
许可证
Apache 2.0