Skip to main content

Architecture Overview

STOA Platform is designed as a cloud-native, multi-tenant gateway platform built for both traditional APIs and AI agents.

High-Level Architecture

flowchart TB
subgraph Users["👥 Users"]
Dev["🧑‍💻 Developers"]
Admin["👨‍💼 Platform Admins"]
AI["🤖 AI Agents"]
end

subgraph STOA["🏛️ STOA Platform"]
Portal["📱 Developer Portal"]
Console["🖥️ Admin Console"]
API["⚙️ Control Plane API"]
Gateway["🚀 MCP Gateway"]
end

subgraph Security["🔐 Security"]
KC["Keycloak"]
Vault["HashiCorp Vault"]
end

subgraph Data["💾 Data"]
PG["PostgreSQL"]
Redis["Redis"]
end

subgraph MCP["🔧 MCP Servers"]
Tools["Enterprise Tools"]
end

Users --> Portal & Console
Portal & Console --> API
API --> Gateway
Gateway --> Tools
API --> PG & Redis
API & Gateway --> KC
API --> Vault

Core Components

Control Plane API

The central management API built with Python and FastAPI.

AspectDetails
LanguagePython 3.12+
FrameworkFastAPI (async)
DatabasePostgreSQL + SQLAlchemy
CacheRedis
AuthKeycloak (OIDC)

Responsibilities:

  • Subscription management
  • Tenant provisioning
  • Tool catalog
  • Usage tracking
  • Policy enforcement

MCP Gateway

High-performance proxy for MCP tool invocations built with Rust.

AspectDetails
LanguageRust
RuntimeTokio (async)
HTTPHyper
ProtocolMCP (Model Context Protocol)

Responsibilities:

  • Request routing
  • Authentication validation
  • Rate limiting
  • Metrics collection
  • MCP protocol handling

Portal UI

Self-service developer portal built with React and TypeScript.

Features:

  • API/Tool catalog browsing
  • Subscription management
  • API key generation
  • Usage dashboards
  • Documentation access

Console UI

Admin management console built with React and TypeScript.

Features:

  • Tenant management
  • User administration
  • Policy configuration
  • System monitoring
  • Audit logs

Security Layer

Keycloak

Identity and access management providing:

  • OIDC/OAuth2 authentication
  • SSO (Single Sign-On)
  • RBAC (Role-Based Access Control)
  • Multi-factor authentication
  • User federation

HashiCorp Vault

Secrets management for:

  • API key encryption
  • Database credentials
  • TLS certificates
  • Service tokens

Data Layer

PostgreSQL

Primary database storing:

  • Subscriptions
  • Tenants
  • Users
  • Tool definitions
  • Audit logs

Redis

In-memory data store for:

  • Session management
  • Rate limiting counters
  • Response caching
  • Real-time metrics

Observability Stack

ComponentPurpose
PrometheusMetrics collection
GrafanaDashboards & visualization
LokiLog aggregation
AlertmanagerAlert routing

Request Flow

sequenceDiagram
participant AI as AI Agent
participant GW as MCP Gateway
participant API as Control Plane
participant MCP as MCP Server

AI->>GW: Tool Invocation (API Key)
GW->>GW: Validate API Key
GW->>API: Check Subscription
API-->>GW: ✅ Authorized
GW->>MCP: Forward Request
MCP-->>GW: Response
GW-->>AI: Tool Response
  1. AI Agent sends a tool invocation request with an API key
  2. MCP Gateway validates the API key against Keycloak
  3. Gateway checks subscription status with Control Plane API
  4. Control Plane verifies the subscription is active
  5. Gateway forwards the request to the appropriate MCP Server
  6. MCP Server executes the tool and returns the response
  7. Gateway returns the response to the AI Agent

Deployment

STOA Platform runs on Kubernetes and can be deployed using:

Kubernetes Namespace

All components run in the stoa-system namespace:

kubectl get pods -n stoa-system

Ingress Endpoints

ServiceURL Pattern
Portalportal.<domain>
Consoleconsole.<domain>
APIapi.<domain>
Gatewaygateway.<domain>
Authauth.<domain>

Technology Stack Summary

LayerTechnology
GatewayRust, Tokio, Hyper
APIPython, FastAPI
FrontendReact, TypeScript, Tailwind
DatabasePostgreSQL
CacheRedis
AuthKeycloak
SecretsHashiCorp Vault
ObservabilityPrometheus, Grafana, Loki
InfrastructureKubernetes, Helm, Terraform

Next Steps