Skip to main content

HAPI MCP Architecture

API-first, OpenAPI-powered Model Context Protocol

The HAPI MCP Architecture simplifies AI integration by leveraging existing APIs and OpenAPI specifications to create MCP tools. This contract-first approach eliminates the need for custom MCP server implementations, enabling seamless interaction between AI agents and backend systems.

runMCPHAPI EcosystemThe Happiness StackFrom the Internet(Or on-premise)api.run.mcp.com.airunMCPhttps://run.mcp.com.ailinkedin.run.mcp.com.aistrava.run.mcp.com.aiinstagram.run.mcp.com.aivalorant.run.mcp.com.aikubernetes.run.mcp.com.aichatMCPhttps://chat.mcp.com.ai AI Inference LLMsLocal or CloudDeployHTTPSManageStart 🟢Stop 🛑Health check 🩺Config Process Container or Pod 🎛️ HAPI CPControl Plane🧩 HAPIletProcess Manager😁 HAPIServer🔒 Security⚡ Routing Engine🚦 Traffic Management🔗 Integration & Extensibility📊 ObservabilityYour MCP ServersPowered by HAPI Server zero-code 🚢 kubernetesTo the InternetAPI Services (providers)LinkedIn🧑🏽‍💼 LinkedInStrava🏃🏽‍♂️ Strava......📷 InstagramInstagramValorant🥷🏽 Valorant🖥️ Bare Metal / VMYour K8s ClusterSwagger/OASInject Swagger Spec with zero-code

Key Components

1. HAPI Server

  • Purpose: Converts OpenAPI specs into MCP tools dynamically.
  • How it works: Reads the OpenAPI file and generates MCP contracts, exposing API operations as tools.
  • Example: A GET /users endpoint with operationId: getUsers becomes an MCP tool named getUsers.

2. runMCP

  • Purpose: Acts as the control plane dashboard for managing multiple Headless API (HAPI) MCP servers.
  • How it works: Comunicates with HAPI CP to manage the lifecycle of MCP servers and their tools. See this as the kubectl for MCP servers.
  • Example: Aggregates tools from various HAPI Server instances and routes AI agent requests to the appropriate backend.

3. HAPI Control Plane (HAPI CP)

  • Purpose: Provides the centralized management interface for the MCP servers.
  • How it works: Communicates with HAPI Server instances to manage their lifecycle and tool availability. This also includes the ability to create the routing rules for incoming requests. See this as the kube-apiserver for MCP servers.
  • Example: Allows you to add, remove, or update MCP servers and their tools dynamically.

4. chatMCP

  • Purpose: Provides an interactive interface for AI agents to invoke MCP tools.
  • How it works: Acts as the client layer, enabling users or AI agents to call tools via a unified interface.
  • Example: An AI agent uses chatMCP to call the getUsers tool and retrieve user data.

How It Works

  1. Generate MCP Tools: HAPI Server reads your OpenAPI spec and generates MCP tools automatically.
  2. Manage MCP Servers: runMCP orchestrates multiple HAPI Server instances, ensuring scalability and reliability.
  3. Invoke Tools: AI agents use chatMCP to discover and call tools, which are routed through runMCP to the appropriate backend.
runMCP FlowArchitecture SequenceProviderMCP Server ProviderConsumerchatMCP UserrunMCP PortalHAPI CPDNSMCP ServerMCP ToolsBackend APIchatMCPOAS1. Provides Swagger(OAS v3) fileAPI2. Forward OASto control plane🎛️3. Deploy MCP Serverwith OAS configuration4. Configure DNSfor traffic routing🌐😁 HAPIServer5. Load MCP Toolsbased on OAS🛠️6. Connect toBackend APIs7. Consumer accesseschatMCP8. Connect to MCP Tools9. Multi-agent collaborationA1A2A310. Consumer interaction with agentsContinuous managementLifecycle managementrunMCP

Benefits of the Architecture

  • No Custom MCP Servers: Existing APIs become MCP-ready by exposing their OpenAPI specs.
  • Scalability: Easily manage multiple MCP servers with runMCP.
  • Simplicity: Focus on publishing contracts, not writing new server logic.
  • Interoperability: MCP tools integrate seamlessly with AI agents, enabling dynamic workflows.
  1. Orchestration: runMCP manages the tools and routes requests.

Example Workflow

  1. Input: A user provides an OpenAPI spec to HAPI Server.This architecture ensures that your existing APIs are AI-ready without additional development overhead. By focusing on contracts, the HAPI MCP stack enables faster integration, better scalability, and a seamless user experience.
  2. Tool Generation: HAPI Server converts API operations into MCP tools.

This architecture ensures that your existing APIs are AI-ready without additional development overhead. By focusing on contracts, the HAPI MCP stack enables faster integration, better scalability, and a seamless user experience.