This repository contains the sample code for the blog posts
- RBAC in Practice. It demonstrates how to implement Role-Based Access Control (RBAC) using Logto in a full-stack application.
- Empower your business: Connect AI tools to your existing service with access control. Learn how to empower your business by securely connecting AI tools to your existing services using Personal Access Tokens and Model Context Protocol (MCP).
The project consists of three main parts:
backend/
: A Node.js API server with RBAC implementationfrontend/
: A React application demonstrating role-based UI and access controlmcp-server/
: A Node.js program used for Model Context Protocol (MCP)
-
Navigate to the backend directory:
cd backend
-
Install dependencies:
npm install
-
Set up environment variables:
cp .env.example .env
Update the .env
file with your Logto configuration values (issuer URL, JWKS URL, and API resource identifier from your Logto console).
- Start the development server:
npm run dev
-
Navigate to the frontend directory:
cd frontend
-
Install dependencies:
npm install
-
Set up environment variables:
cp .env.example .env
Update the .env
file with your configuration values.
- Start the development server:
npm run dev
The application will be available at http://localhost:5173
(frontend) and the API at http://localhost:3000
(backend).
Refer to MCP Server Quickstart to setup for Claude Desktop for testing.