Show HF: A Local-First Runtime & AI Gateway for Coding Agents (Built-in MCP + Local Model Orchestration)

Hello Hugging Face community!

We wanted to showcase a project we’ve been working on to solve the “last mile” problem of local AI agentic workflows: ServBay.

With the rapid rise of coding agents (Claude Code, Cursor, and local Llama/Qwen agentic loops), AI is writing code faster than ever. However, we noticed a massive bottleneck in the local loop: AI agents are incredibly smart but have no system-level “hands.”

When a local agent writes a full-stack application, it gets stuck because it cannot install PostgreSQL, configure Nginx, bind local domain names, or handle SSL certificates on the user’s host machine. The developer ends up manually executing commands and copying configurations back and forth.

We built ServBay to act as the local runtime and infrastructure foundation that connects AI agents to the local machine securely and seamlessly.


:hammer_and_wrench: The Technical Architecture

Here is how we structured the local agent runtime:

[ Coding Agent (e.g., Claude Code, Cursor, Local Scripts) ]
    │

    ├── (via Model Context Protocol - MCP) ──> \[ ServBay MCP Server \] ──> Controls Local Stack (50+ Services, DBs, DNS, SSL)

    │

    └── (via Local Port 127.0.0.1) ──────────> \[ Local AI Gateway \]   ──> Fallback & Budget Routing (Cloud APIs <-> Local Ollama/llama.cpp)
  1. Built-in MCP Server (Model Context Protocol): We implemented an MCP server that exposes 39+ local dev-environment tools. AI agents can now programmatically:

    • Initialize and manage 50+ services (MariaDB, PostgreSQL, Redis, Node.js, PHP, etc.).
    • Bind local domains (e.g., *.servbay.host) and automatically generate SSL/HTTPS certificates.
    • Query active ports, read system/service logs, and run safe diagnostic scripts.
    • Result: The agent can spin up a fully working local application stack from scratch without human intervention.
  2. Local-First AI Gateway (Rust-based): To solve the security risks of API key exposure and budget leaks, we built a lightweight local gateway running entirely on localhost.

    • Local Wallet: API keys are encrypted and stored locally. They never leave the machine.
    • Unified Endpoint (ai.servbay.host): Routes requests to cloud providers or local runners (Ollama / llama.cpp / Apple MLX).
    • Orchestration & Fallback: Automatically switches to a backup model or local LLM if a primary cloud model rate-limits or fails.
    • Cost Control: Monitors token usage and enforces budget caps per project/folder.
  3. End-to-End Encrypted Remote Watcher: For long-running agent tasks, we built an E2E-encrypted relay architecture. Using a mobile companion app, developers can monitor their local agent execution logs and approve or reject sensitive command execution requests (e.g., file deletion) from their phone.


:locked: Why Local-First?

Most current environments rely on cloud-hosted sandboxes (like E2B or Daytona). While great for security isolation, they get expensive, require constant internet connection, and struggle to replicate complex local system environments.

By keeping the runtime, database orchestration, and AI Gateway entirely local, developers maintain absolute data sovereignty over their codebases and API keys.


:speech_balloon: Discussion & Feedback

We would love to get your thoughts on this architecture:

  1. How are you handling the environment setup for your local coding agents? Are you using containers, VMs, or running them bare-metal?
  2. What’s your strategy for API key security when testing agents locally?
  3. Local LLMs for coding: Are you successfully using local models (like DeepSeek-Coder or Qwen-2.5-Coder) via Ollama/llama.cpp for agent tasks, and what are the main hurdles you face?

We’d love to hear your feedback and run-time setups!

Hmm… For now, organizing this as far as I can tell:


I read this less as “another local model runner” and more as a local development control plane for coding agents.

That framing makes the three questions easier to answer:

  1. Containers / VMs / bare-metal: I would not choose one by ideology. I would choose by the boundary I want the agent to operate inside.
  2. API key security: I would care less about the number of supported providers and more about scoped virtual keys, revocation, budget caps, redaction, and auditability.
  3. Local LLMs for coding agents: I would separate “can write code” from “can complete an agentic tool loop.” The second depends on the model, runtime, chat template, tool-call parser, client, and task.

So my short version is:

Goal I would look first at…
Touch real local DB / DNS / SSL / web-server state ServBay-like local runtime / control plane
Reproducible team or CI-like setup Dev Containers, Docker Compose, DDEV-style setups
Reducing blast radius for autonomous actions VM / sandbox / disposable environment
API key governance Local gateway with scoped virtual keys, budgets, revocation, audit
Local LLM experiments model × runtime × parser × client × task matrix
Helping future readers evaluate the system public tool manifest + approval/audit examples + small reproducible traces

That is not a criticism of the approach. I think the interesting part is exactly that it names a layer that many coding-agent setups currently leave half-manual: local development infrastructure as something the agent can inspect and operate through a controlled interface.

1. How I would think about containers vs VMs vs bare-metal

I would frame this as a boundary decision, not as “Docker vs native” or “local vs cloud.”

Something like:

Setup Best default when… Main tradeoff
Bare-metal / local runtime You want high local fidelity: real local DBs, local DNS, local certificates, ports, web servers, GUI-managed services, existing projects The agent is closer to the host, so permission/approval/audit become more important
Dev Containers / Docker Compose / DDEV You want reproducibility, team sharing, CI-like environments, config in the repo Local OS-level things like DNS, cert stores, GUI-managed services, native SDKs, and existing DBs can be more awkward
VM / sandbox / disposable backend You want to reduce blast radius for autonomous or long-running agent actions Less local fidelity; more friction around host services, local domains, native toolchains, or nested Docker
Hybrid You want local services managed by something like ServBay, but risky execution isolated elsewhere More moving parts, but often a practical compromise

The reason I would not reduce this to “just use Docker” is that local web development often has annoying non-code state:

  • DB service lifecycle
  • web server config
  • local DNS
  • local HTTPS certificates
  • reverse proxy / tunnel config
  • port conflicts
  • language/runtime version switching
  • logs from multiple services
  • GUI or human-readable service state

ServBay’s public README already positions it as a local web development environment covering web servers, languages, databases, DNS, reverse proxies, Ollama integration, and backups: ServBay GitHub README. The current homepage also describes the MCP side as letting agents start services, install packages, create sites with domains and SSL, read logs, and query databases across local services: ServBay homepage.

So I would describe the value proposition as:

ServBay is strongest when viewed as agent-ready local web/dev infrastructure, not merely as local model serving.

For comparison, Dev Containers are excellent when the development environment should be declared and reproduced as a containerized environment. DDEV is a good reference point for Docker-based local web development with reproducible project configuration. Those are adjacent, but not identical, goals.

A useful decision tree might be:

If the main pain is… Likely direction
“The agent cannot set up my actual local DB / SSL / DNS / logs” local runtime / control plane
“My teammates cannot reproduce my environment” Dev Containers / Docker Compose / DDEV
“The agent might run risky commands” VM / sandbox / stricter approval
“The agent needs to inspect real local services but not freely mutate them” local runtime + read-only / approval-gated tools
“I need both local fidelity and safety” hybrid: local services + sandboxed agent execution
2. MCP tool surface: I would make the boundary visible

For the MCP side, I would personally look for a small public classification of the tool surface.

Not because every project must open-source every implementation detail, but because future readers need to understand what kind of local power is being handed to the agent.

A simple table like this would already help:

Tool class Examples Suggested default
Read-only service status, logs, config inspection, system diagnostics usually allow or low-friction approval
Reversible mutation start/stop service, create temporary site, install package in controlled scope allow with visible target and rollback notes
Destructive mutation delete site, drop DB, remove certificate, uninstall package explicit confirmation
Secret-bearing env vars, API keys, tokens, provider credentials strong redaction, narrow scopes, audit
Network-exposing tunnels, public URLs, reverse proxy exposure, webhook endpoints explicit approval with target and exposure summary
Host-wide DNS, hosts file, global ports, CA/cert store, system-level service changes explicit approval, audit, and ideally rollback notes

The MCP specification itself is very clear that tools can create powerful data-access and code-execution paths, and that user consent, clear authorization UI, and tool safety matter: MCP specification, Security and Trust & Safety. The MCP docs also include broader implementation guidance around security and consent: MCP security best practices.

I would keep the mental model simple:

Permissions decide what the agent may attempt.
Sandboxing decides what the process can actually touch.

That distinction is also visible in existing coding-agent tools. Claude Code has a permission model with allow/ask/deny rules and explicitly says permission enforcement is handled by Claude Code, not by the model: Claude Code permissions. Codex similarly separates sandbox mode from approval policy: Codex agent approvals and security.

For ServBay, I would not turn this into a security debate. I would just say that the most useful public artifact for this layer would be something like:

  • MCP tool manifest
  • tool class table
  • default approval policy
  • example approval prompt
  • example audit log
  • rollback matrix
  • known limitations page

For example, one trace like this would be very useful:

Field Example content
User request “Create a Laravel site with MySQL and HTTPS”
Client Claude Code / Cursor / Codex
Model cloud model or local model
MCP tools called create site, create database, issue local certificate, read logs
Arguments redacted where needed
Approvals shown certificate creation, host/DNS mutation, DB deletion, etc.
Final state site URL, DB name, services started
Rollback what can be undone and how
Audit timestamped tool calls and results

That kind of trace would help more than a large feature list, because readers could see the actual control boundary.

3. API key security: I would evaluate the gateway by governance, not provider count

The AI Gateway part is interesting because it addresses a very practical problem: coding agents, IDEs, CLIs, and local scripts all want model access, but handing raw provider keys to each tool is not ideal.

ServBay’s public description says the gateway puts Anthropic, OpenAI, Gemini, OpenRouter, and local Ollama behind virtual keys, with usage/cost tracking, fallback, and real keys encrypted locally: ServBay AI Gateway.

I would evaluate that layer with questions like:

Criterion Why it matters
Scoped virtual keys A project/tool should not automatically get access to every provider/model
Revocation A leaked or overused local key should be easy to disable
Budget caps Coding agents can loop or retry; cost boundaries should be explicit
Usage attribution It should be clear which project/tool/model spent tokens
Redaction Raw provider keys should not appear in prompts, logs, traces, or agent context
Fallback policy Automatic fallback is useful, but the rule should be visible
Model allow-list Some projects may need only local models, or only approved cloud models
Audit logs Useful for debugging and for understanding agent behavior later

This is where an AI gateway can be valuable even if someone already uses Docker, Dev Containers, or another local runtime. The gateway is a different boundary: not “where does code run?” but “who can spend model tokens, through which providers, with which keys, and under which limits?”

For context, this gateway pattern already exists elsewhere too. LiteLLM is a common open-source reference point for provider routing, OpenAI-compatible proxying, virtual keys, spend tracking, logging, and related controls. That does not make ServBay redundant; it just helps clarify the comparison. ServBay’s interesting angle seems to be the combination of gateway + local web stack + MCP operations.

4. Local LLMs: I would separate code generation from agentic tool-use

For the local LLM question, I would not ask only “does Qwen/DeepSeek/Ollama work?”

I would break it down like this:

Layer What to check
Model code quality, instruction following, tool-use training, context length
Quant / runtime Ollama, llama.cpp, vLLM, LM Studio, MLX, Docker Model Runner, etc.
Chat template whether tool schemas and previous tool calls are represented correctly
Tool-call parser JSON, XML, Hermes-style parser, Qwen parser, custom parser
Client Claude Code, Cursor, Codex, Continue, Cline, etc.
Action execution raw text vs parsed tool call vs actually executed tool action
Recovery loop failed command handling, log interpretation, retry behavior
Fallback policy when to use local model vs cloud model

A local coding model can be strong at code generation and still fail as an agent if the tool-call path is mismatched.

For example, the Qwen docs describe function calling as an application-level protocol where the application provides functions, the model chooses calls, the application executes them, and results are passed back: Qwen function calling docs. That already shows why the application/runtime/client side matters, not just the model weights.

vLLM’s tool-calling docs make the same point at the serving layer: automatic tool choice needs flags like --enable-auto-tool-choice, an appropriate --tool-call-parser, and sometimes a compatible chat template: vLLM tool calling.

There are also practical examples of the failure mode, though I would treat them only as cautionary examples, not as evidence about ServBay itself:

So for local models I would test with a matrix, not a single pass/fail answer:

Model Runtime Parser/template Client Task Result
Qwen2.5-Coder Ollama / vLLM / llama.cpp parser/template used Continue / Cline / Cursor / Codex create site, read logs, fix migration pass/fail + failure reason
Qwen3-Coder Ollama / vLLM / llama.cpp parser/template used same same pass/fail + failure reason
DeepSeek-Coder same same same same pass/fail + failure reason
Cloud fallback model provider gateway native tool calling same same pass/fail + fallback trigger

For benchmarks, BFCL is useful for general function/tool calling ability, but it does not directly test local DNS, local SSL, DB migrations, port conflicts, or local service logs. For this particular product category, small end-to-end local runtime traces may be more informative than general coding benchmark numbers.

5. Small reproducible traces that would be useful

For future readers, I think a few small, boring, reproducible traces would make the system much easier to evaluate.

I would suggest tasks like:

Test Why it is useful
Laravel/PHP + MySQL + HTTPS local site Exercises language runtime, DB, web server, local domain, local SSL
Node/Python + PostgreSQL app Exercises non-PHP stack and DB lifecycle
Port conflict Tests whether the agent can inspect local state and choose a safe fix
Failed DB migration Tests log reading, diagnosis, and recovery loop
Create/delete database with approval Shows destructive-operation boundary
Issue/remove local certificate Shows PKI/SSL boundary and rollback
Expose webhook tunnel Shows network-exposure approval
Local model vs cloud model fallback Shows when local LLM is enough and when fallback is used

A useful trace format could be:

Task:
  Create a Laravel site with MySQL and HTTPS.

Environment:
  OS:
  ServBay version:
  Client:
  Model:
  Runtime:
  Local model parser/template, if any:

Agent actions:
  1. Tool:
     Args:
     Approval required:
     Result:

  2. Tool:
     Args:
     Approval required:
     Result:

Approvals:
  - What was shown to the user?
  - Was target/resource/blast radius visible?

Final state:
  - Site URL:
  - DB:
  - Services:
  - Logs checked:

Rollback:
  - What can be undone?
  - How?

Failure notes:
  - If local model failed, did it fail at model output, parser, client execution, or tool result recovery?

This would let people compare:

  • ServBay local runtime
  • Dev Containers / Docker Compose / DDEV
  • VM / sandbox
  • cloud model
  • local Qwen/DeepSeek/Ollama
  • hybrid setups

without turning the discussion into a subjective “which tool is best?” debate.

6. The evaluation map I would use

Putting it all together, this is the evaluation map I would use:

Axis Question
Local fidelity Can the agent work with real local DBs, local DNS, local certs, ports, web servers, logs, and project runtimes?
Reproducibility Can another developer or CI environment reproduce the same setup?
Isolation What is the blast radius if the agent makes a bad call?
Approval friction Are dangerous actions stopped without making harmless actions unusably slow?
Tool clarity Are MCP tools visible and classified by risk/side effect?
Auditability Can I see what the agent did later?
Rollback Can changed local state be undone?
Secret handling Are raw provider keys kept out of agent context, logs, and traces?
Model routing Is fallback explicit and attributable?
Local LLM reliability Does the model complete the full tool loop, not just emit plausible code?

For me, the strongest version of this product category is not:

“Replace Docker”
“Replace Ollama”
“Replace LiteLLM”
“Replace a sandbox”

It is more like:

“Give coding agents a controlled, inspectable interface to the local development stack, while making the trust boundary visible.”

That feels like a real missing layer.

My main suggestion would be: keep showing the feature list, but also publish a few small evaluation artifacts:

  • a public MCP tool classification table
  • one or two end-to-end agent traces
  • example approval prompts
  • example audit logs
  • a rollback matrix
  • a local model compatibility matrix
  • a gateway key-scope / budget example

That would make the idea easier for other developers to test, compare, and adopt without needing to infer the boundary from marketing copy or screenshots.

thanks for your suggestion.