MCP Server Plexus: Multi-Tenant Python OAuth 2.1 Platform
Deploy a secure, multi-tenant MCP server with OAuth 2.1 integration for scalable, multi-user AI applications and seamless external service access.
npx -y @Super-I-Tech/mcp_plexusOverview
MCP Server Plexus is a multi-tenant Python server that implements the Model Context Protocol (MCP) with built-in OAuth 2.1 integration. It centralizes per-tenant model context management, access control, and secure delegation to external services (APIs, data stores, identity providers) so teams can build multi-user AI applications while enforcing consistent security, observability, and policy across tenants.
Plexus is designed for deployment in cloud environments or on-premises. It provides tenant isolation, OAuth 2.1-compliant authorization flows (including Authorization Code with PKCE), token introspection, and a simplified developer API for provisioning tenants and model contexts. This makes it useful when you need to expose model-aware functionality to many users and services while keeping authentication and third-party access consistent and auditable.
Features
- Multi-tenant model context management with per-tenant isolation
- OAuth 2.1-compatible flows (Authorization Code with PKCE, token refresh, introspection)
- Delegated access to external services via short-lived tokens
- Administrative APIs and CLI for tenant lifecycle management
- Built-in integration points for databases and caching (Postgres, Redis)
- Policy and scope enforcement for fine-grained permissions
- Observability hooks: request logging, metrics, and audit trails
- Docker Compose and production-ready deployment patterns
Installation / Configuration
Quick start — clone and run with Docker Compose:
Local development (Python virtual environment):
# Apply database migrations (example)
# Start the ASGI server
Important environment variables
| Variable | Purpose | Example |
|---|---|---|
| DATABASE_URL | Postgres connection string | postgres://user:pass@db:5432/mcp |
| REDIS_URL | Redis connection string for caching/locks | redis://redis:6379/0 |
| SECRET_KEY | Application secret for signing cookies/tokens | generated-secret |
| OAUTH_PROVIDER_URL | Base URL of external OAuth provider | https://auth.example.com |
| OAUTH_CLIENT_ID | Client ID for server-to-provider communication | your-client-id |
| OAUTH_CLIENT_SECRET | Client secret (use vault in production) | your-client-secret |
| ADMIN_API_KEY | Key for bootstrapping admin CLI/API calls | supersecretadminkey |
Example Docker Compose fragment
version: "3.8"
services:
mcp-plexus:
build: .
ports:
- "8000:8000"
environment:
- DATABASE_URL=postgres://mcp:mcp@db:5432/mcp
- REDIS_URL=redis://redis:6379/0
- SECRET_KEY=change_this
db:
image: postgres:15
environment:
POSTGRES_DB: mcp
POSTGRES_USER: mcp
POSTGRES_PASSWORD: mcp
redis:
image: redis:7
Available Resources
- REST API: endpoints for tenant provisioning, model context CRUD, and token introspection
- Admin UI: web interface for tenant and policy management (if enabled)
- CLI: tenant lifecycle commands (create, update, rotate-keys)
- SDK: lightweight Python client helpers for authenticating and calling the MCP API
- Monitoring hooks: Prometheus-compatible metrics and structured logs
Check the repository for API docs, OpenAPI/Swagger spec, and the admin UI assets.
Use Cases
Multi-tenant AI platform
- Problem: A company hosts multiple customer instances of an LLM-powered assistant and needs strict tenant isolation and centralized access control.
- How Plexus helps: manage per-tenant model context (prompts, safety settings, rate limits), issue short-lived tokens, and enforce scopes for model access.
Delegated third-party access
- Problem: Your AI app needs to access user data in external systems (calendars, CRMs) on behalf of the user.
- How Plexus helps: integrate with OAuth 2.1 providers to obtain delegated tokens, store minimal long-lived refresh secrets centrally, and issue short-lived credentials to downstream services to reduce blast radius.
Centralized security and auditing
- Problem: Multiple services call different model endpoints, making it hard to apply consistent policy or audit usage.
- How Plexus helps: all model requests pass through the MCP server, which enforces scopes, logs access, and exposes metrics and audit trails for compliance.
Scalable multi-user apps
- Problem: Developers want to let many users interact with AI models while dynamically assigning context and permissions.
- How Plexus helps: provision tenants with isolated model contexts, publish per-tenant keys or OAuth clients, and scale horizontally with standard database and cache backends.
Getting started tips
- Use PKCE for public clients (single-page apps, mobile).
- Store secrets in a vault in production; keep SECRET_KEY and OAUTH_CLIENT_SECRET out of source control.
- Enable TLS/HTTPS in front of the service (reverse proxy like Nginx or cloud load balancer).
- Review the OpenAPI spec included in the repo to see exact endpoints and request/response shapes before integrating.
For full reference and examples, see the GitHub repository: https://github.com/Super-I-Tech/mcp_plexus.