Day 20 — Security
Org-level isolation, role hierarchies, invite flows, and audit trails — the unsexy infrastructure that makes B2B SaaS actually work.
An MCP server that manages multi-tenant authentication. Ask who has access to what, which orgs are MFA-compliant, and whether that pending invite expired. No more digging through admin panels.
Example Queries
Tools
| Tool | What It Does |
|---|---|
| org_lookup | Search organizations by name, plan, or status. Returns org details, member count, seat usage, SSO/MFA config, and current health. |
| user_permissions | Check a user's role, permissions, and access within an organization. Shows hierarchy level, granted permissions, and MFA compliance. |
| invite_status | Track invitation status across organizations — pending, accepted, expired, or revoked. Shows who invited whom and when. |
| role_hierarchy | View the full role hierarchy and permissions matrix for an org. Shows each role's level, permissions, and assigned members. |
| audit_log | Query the auth and access audit log. Filter by org, user, action type, or date range. Surfaces logins, permission changes, and security events. |
| tenant_health | Get health metrics for an org — active users, MFA adoption, seat usage, login frequency, and a security compliance score. |
Tenants
enterprise plan
business plan
starter plan
enterprise plan
business plan
starter plan
Why This Build
The moment your SaaS gets a second customer, everything breaks. Suddenly you need org-level isolation, role hierarchies that actually make sense, and an invite flow that doesn't leak data across tenants.
Most teams bolt multi-tenancy on after the fact. The schema gets messy, the permission checks get scattered across the codebase, and one day someone from Org A sees Org B's data. Nobody writes a blog post about that.
This server models six organizations across three plan tiers, with proper role hierarchies (owner → admin → manager → member → viewer), invite lifecycle tracking, MFA compliance monitoring, and a full audit trail. Ask a question about who has access to what — and get an answer backed by real permissions data, not guesswork.
Demo Data
6
Organizations
18
Users
19
Memberships
30
Roles
8
Invitations
25
Audit Events
Six orgs spanning enterprise, business, and starter tiers. One suspended org with a deactivated user. A freelancer in two orgs simultaneously. Users with MFA disabled in MFA-required orgs. Expired and revoked invitations. Fifteen granular permissions across five role levels. Edge cases that will actually show up in production.
Setup
cd day20-multi-tenant-auth
npm install && npm run seed && npm run buildThen add the config to Claude Desktop and restart.
If you're bolting on multi-tenancy after the fact or your permission model is a pile of if-statements, let's talk about doing it right.