# title: Lunar.dev Gateway Documentation # description: Concise llms.txt for Lunar.dev covering the AI Gateway and MCPX. It lists major features, key developer docs and quick start steps. # tags: lunar, ai-gateway, mcp-gateway, documentation, quick-start ## Lunar.dev Overview - **Unified gateway** – Consolidate calls to LLMs, APIs and MCP tools in a single gatewayhttps://www.lunar.dev/#:~:text=Enterprise%20AI%20Agent%20Gateway. - **Observability and governance** – Production‑grade infrastructure provides visibility into API and model calls, with limits and priorities to control consumptionhttps://www.lunar.dev/#:~:text=Production%E2%80%91Grade%20Infrastructure%20for%20AI%20%26,API%20Workloads. - **Enterprise scale** – Handle surges with minimal latency; benchmarks show about 4 ms overhead at the 99th percentilehttps://docs.lunar.dev/latency-footprint/#:~:text=Latency%20Footprint and up to ~84 k requests per secondhttps://docs.lunar.dev/capacity-benchmark/#:~:text=Capacity%20Benchmark. Links: - Main site: [lunar.dev](https://www.lunar.dev/) – description of the unified enterprise gateway. - AI Gateway product: [AI Gateway](https://www.lunar.dev/product/ai-gateway) – granular control for AI‑generated traffichttps://www.lunar.dev/product/ai-gateway#:~:text=Granular%20Control%20for%20AI%20Traffic%2C,Built%20for%20Production. - MCP Gateway product: [MCP Gateway](https://www.lunar.dev/product/mcp) – unify and govern MCP servershttps://www.lunar.dev/product/mcp#:~:text=Unlock%20Safe%20and%20Scalable%20MCP,Adoption. ## AI Gateway ### Core Features - **Observability** – View token usage, cost, latency and errors for each LLM callhttps://www.lunar.dev/product/ai-gateway#:~:text=Full%20Observability%20Into%20AI%20powered,workflows. - **Rate limiting & priority queues** – Enforce quotas per user or agent, prioritizing critical requestshttps://www.lunar.dev/product/ai-gateway#:~:text=Granular%20Controls%20for%20LLM%20Workloads. - **Data sanitation & model routing** – Remove sensitive data, route calls across providers and transform prompts/payloadshttps://www.lunar.dev/product/ai-gateway#:~:text=traffic%20cdn.prod.website,agent%2C%20error%20rates%2C%20or%20model. - **Smart routing & fallback** – Cluster‑aware load balancing and fallback flowshttps://www.lunar.dev/product/ai-gateway#:~:text=Smart%20routing%20and%20fallback%20for,resilient%20AI%20operations. - **Security controls** – Protect against unbounded consumption, excessive agency, prompt injection and data disclosurehttps://www.lunar.dev/product/ai-gateway#:~:text=Secure%20Your%20GenAI%20Stack%20with,Real%20Enforcement. ### Docs & Guides - **Quick Start** – [Quick Start Guide](https://docs.lunar.dev/quick-start-guide/) explains installation, routing traffic and monitoringhttps://docs.lunar.dev/quick-start-guide/#:~:text=%E2%9A%A1%EF%B8%8F%20Quick%20Start%20Guide. - **Quota strategies** – [Quota Strategies](https://docs.lunar.dev/api-gateway/quotas/quota-strategies/) describes fixed window, concurrent and custom counter strategieshttps://docs.lunar.dev/api-gateway/quotas/quota-strategies/#:~:text=%EF%B8%8F%20Fixed%20Window%20Strategy%20The,control%20over%20API%20traffic%2C%20enabling; includes YAML exampleshttps://docs.lunar.dev/api-gateway/quotas/quota-strategies/#:~:text=Example%3A%20Combining%20Strategies%20with%20Internal,Limits. - **Flows** – [Flows Hub](https://docs.lunar.dev/flows-hub/) lists client‑side limiting, priority queue, endpoint access control, custom metrics, HAR collector, async queue, data sanitation, fallback, LLM routing, retry, transform and cachinghttps://docs.lunar.dev/flows-hub/. - **Performance** – [Latency Footprint](https://docs.lunar.dev/latency-footprint/) shows the gateway adds about 4 ms overhead at the 99th percentilehttps://docs.lunar.dev/latency-footprint/#:~:text=Latency%20Footprint; [Capacity Benchmark](https://docs.lunar.dev/capacity-benchmark/) details requests per second for various concurrency levelshttps://docs.lunar.dev/capacity-benchmark/#:~:text=Capacity%20Benchmark. ## MCPX Gateway ### Core Features - **Unified access** – Expose a single gateway for all local and remote MCP servers with service discoveryhttps://www.lunar.dev/product/mcp#:~:text=Unlock%20Safe%20and%20Scalable%20MCP,Adoption. - **Authentication & access control** – Support API keys, OAuth and role‑based profileshttps://www.lunar.dev/product/mcp#:~:text=%2A%20,Grained%20Access%20Controls. - **Policy enforcement** – Govern tool behavior, insert approval flows and prevent collisionshttps://www.lunar.dev/product/mcp#:~:text=%2A%20,Tool%20Behavior%20at%20the%20Gateway. - **Visibility & telemetry** – Real‑time metrics, audit logs and advanced telemetryhttps://www.lunar.dev/product/mcp#:~:text=%2A%20,Teams%20and%20Agents. - **Tool customization & ACLs** – Create custom tools with fixed inputs or rewritten descriptionshttps://docs.lunar.dev/mcpx/tool_customization/#:~:text=Tool%20Customization%20lets%20you%20create,are%20called%20by%20AI%20agents; group tools and assign permissions via `x-lunar-consumer-tag`https://docs.lunar.dev/mcpx/access_control_list/#:~:text=MCPX%20lets%20you%20control%20tool,consumer%20is%20making%20the%20request. - **OAuth integration** – One‑click authentication for remote servers with automatic token managementhttps://docs.lunar.dev/mcpx/oauth/#:~:text=OAuth%20Authentication%20in%20MCPX. ### Quick Start (Docker) - Ensure Docker is installed and running (`docker version`)https://docs.lunar.dev/mcpx/get_started/#:~:text=Before%20You%20Start. - Create a `config` directory containing `app.yaml` and `mcp.json`https://docs.lunar.dev/mcpx/get_started/#:~:text=Create%20configuration%20file. - Run MCPX: ```bash docker run --rm --pull always --privileged \ -v ./config:/lunar/packages/mcpx-server/config \ -p 9000:9000 -p 5173:5173 -p 9001:9001 -p 3000:3000 \ --name mcpx us-central1-docker.pkg.dev/prj-common-442813/mcpx/mcpx:latest ``` This command launches MCPX; `--privileged` is required for Dockerized MCP servershttps://docs.lunar.dev/mcpx/get_started/#:~:text=Run%20Docker%20command. - Access the control plane at `http://localhost:5173/`https://docs.lunar.dev/mcpx/get_started/#:~:text=Go%20to%20MCPX%20Control%20Plane. - Add servers via the control plane and connect clients by setting the `x-lunar-consumer-tag` headerhttps://docs.lunar.dev/mcpx/get_started/#:~:text=Connect%20your%20Server. ### Docs & Guides - **Connect MCP servers** – [Connecting your MCP Servers](https://docs.lunar.dev/mcpx/connecting_your_servers/) links to STDIO, local and remote server guideshttps://docs.lunar.dev/mcpx/connecting_your_servers/#:~:text=Connecting%20your%20MCP%20Servers. - **Connect clients** – [Connecting your Client](https://docs.lunar.dev/mcpx/connecting_your_clients/) covers Claude, Cursor, your own client and the demo clienthttps://docs.lunar.dev/mcpx/connecting_your_clients/#:~:text=Connecting%20your%20Client. - **Tool customization** – [Tool Customization](https://docs.lunar.dev/mcpx/tool_customization/) shows how to create child tools with fixed parameters or rewritten descriptionshttps://docs.lunar.dev/mcpx/tool_customization/#:~:text=Tool%20Customization%20lets%20you%20create,are%20called%20by%20AI%20agents. - **Access control list** – [ACL](https://docs.lunar.dev/mcpx/access_control_list/) explains grouping tools and defining permissions using consumer tagshttps://docs.lunar.dev/mcpx/access_control_list/#:~:text=MCPX%20lets%20you%20control%20tool,consumer%20is%20making%20the%20request. - **OAuth & Static OAuth** – [OAuth](https://docs.lunar.dev/mcpx/oauth/) describes one‑click authentication and token managementhttps://docs.lunar.dev/mcpx/oauth/#:~:text=OAuth%20Authentication%20in%20MCPX. - **Lunar Gateway integration** – [Lunar Gateway Integration](https://docs.lunar.dev/mcpx/lunar_gateway_integration/) shows how to connect MCPX to the AI Gateway and provides Docker examples for hosted/self‑hosted setupshttps://docs.lunar.dev/mcpx/lunar_gateway_integration/#:~:text=Lunar%20Gateway%20Integration. ## Best Practices - Match quota strategies to your provider’s rate limits; choose fixed window for steady traffic and concurrent for high concurrencyhttps://docs.lunar.dev/api-gateway/quotas/quota-strategies/#:~:text=%EF%B8%8F%20Fixed%20Window%20Strategy%20The,within%20a%20fixed%20time%20window. - Use flows (retry, fallback, LLM routing) to handle failures and optimize routinghttps://docs.lunar.dev/flows-hub/#:~:text=addresses%20are%20not%20passed%20downstream,30%2031%20%EF%B8%8F%20Retry%20The. - Deploy separate gateways for dev, staging and production. - Monitor latency and throughput via the control plane and Prometheus metricshttps://docs.lunar.dev/capacity-benchmark/#:~:text=Capacity%20Benchmark. - Secure deployments using ACLs, OAuth and role‑based profileshttps://www.lunar.dev/product/mcp#:~:text=%2A%20,Grained%20Access%20Controlshttps://docs.lunar.dev/mcpx/access_control_list/#:~:text=MCPX%20lets%20you%20control%20tool,consumer%20is%20making%20the%20request. - Integrate MCPX with the AI Gateway to unify LLM and tool governancehttps://docs.lunar.dev/mcpx/lunar_gateway_integration/#:~:text=Once%20your%20Lunar%20Gateway%20is,dev%20Control%20Plane.