Skip to content
Contextely
Academy6 min readBy The Contextely Team

Self Hosted MCP Governance: What It Actually Costs

What self hosted mcp governance actually requires to run: the real environment variables, the one genuine dependency, and what breaks without it.

A data centre corridor lined with server cabinets, representing what self hosted mcp governance actually runs on

Photo: Brett Sayles on Pexels

Key takeaways

The honest answer to what self hosted mcp governance actually costs is almost never a licence fee. It is three environment variables, one dependency with no shortcut around it, and a small amount of operational discipline that is easy to skip on day one and expensive to have skipped later.

The three things you must supply

A self-hosted deployment of a permissioned MCP layer, running via Docker Compose against Postgres, needs exactly three required inputs before it will do anything useful:

export OPENROUTER_API_KEY=sk-or-...
export CONTEXTELY_SELF_HOSTED=1
export CONTEXTELY_ENCRYPTION_KEY=$(openssl rand -base64 32)
docker compose up --build

Compose brings up Postgres 17 alongside the application container. The schema is applied once against that database, and from there the entitlement and freshness engines running on your own hardware are the same code as any hosted equivalent, not a stripped-down version of it.

What does self hosting an mcp gateway actually cost, in real terms?

Compute for a Postgres instance and a single application container, whatever your LLM provider charges per condensation call, and the discipline described below around the encryption key. There is no per-seat licence fee for internal use, and no feature gating between a self-hosted deployment and a hosted one running the same version.

What breaks if you skip a piece

Missing input What actually happens
The self-hosted flag left unset Every workspace silently resolves to the smallest default plan: one source, three members, five hundred retrievals a month, even though nothing else is technically stopping you
No encryption key rotation plan Losing the key makes every stored source configuration unreadable; there is a rewrap path, but only if you kept the old key somewhere
No auth provider configured for the dashboard The web dashboard reports itself unconfigured and fails every session check closed, meaning it lets nobody in rather than letting everyone in; the API and MCP surfaces are entirely unaffected
Skipping the LLM key entirely Ingest and refresh fail outright rather than degrading to a lower-quality summary, which is the correct failure mode but a surprising one if you expected a graceful fallback

Table 1: what is actually optional in a self-hosted deployment, and the specific failure each omission produces.

"Server-side only, so there is no browser-reachable database."
from a self-hosting configuration note on required inputs, describing why the Postgres connection string is never exposed to a client

That property is not incidental. A permissioned layer whose entitlement checks could theoretically be bypassed by talking to the database directly from a browser is not actually enforcing anything; keeping the connection server-side only is part of what makes the governance claim hold up rather than a convenience.

The one deliberately optional piece: the dashboard

The web dashboard signs people in through a managed auth provider, which self-hosting against your own Postgres leaves unconfigured unless you explicitly point it at one. Rather than failing open, an unconfigured dashboard reports itself unconfigured and fails every session check closed. Nobody gets in, which is the safe direction for that failure to go. The REST API and the MCP server authenticate with API keys directly and are entirely unaffected by whether the dashboard is wired up, which for a deployment that exists mainly to serve agents rather than humans clicking through a UI is usually the only surface that matters day to day.

Is self hosted mcp governance actually cheaper than a hosted plan?

It depends what you are comparing. For a team already running Postgres and comfortable operating a Docker container, the marginal infrastructure cost is small, and the LLM condensation cost scales with how much content you actually ingest rather than with seats. What it is not cheaper than is the engineering time spent keeping the encryption key safe, watching for a Postgres version bump, and being the one who gets paged if the container falls over. That is a real cost, just not a licensing one, and it is worth weighing honestly rather than assuming "self-hosted" automatically means "free."

The operational baseline you are actually signing up for

None of this is exotic infrastructure. A Docker Compose file bringing up an application container alongside a database is one of the most common deployment shapes there is, and a PostgreSQL instance at version 14 or newer is a well-understood piece of infrastructure most engineering teams already run something on. The point of naming both explicitly is that self hosted mcp governance is not asking you to operate anything unfamiliar. It is asking you to operate a small, ordinary web application and a database, and to take the encryption key seriously, which is a much smaller ask than "run your own vector database cluster" or "manage a temporal knowledge graph," the kind of infrastructure some competing memory systems assume you are willing to take on.

That matters for the honest cost comparison. A team already comfortable running Postgres in production is not adding a meaningfully new category of operational risk by adding one more application container next to it. A team with no existing database operations experience is taking on real, if modest, new responsibility, and should weigh that against a hosted alternative rather than assume self-hosting is free because there is no invoice.

What actually leaves your network

On a correctly configured deployment, exactly one category of data leaves your infrastructure: the content of a record being condensed, sent to whichever model endpoint the LLM key routes to. Retrieval, scoring, entitlement checks and freshness bookkeeping are all local computation against your own Postgres instance and involve no outbound call at all. Re-fetches from a stale source go to your own systems of record, not through any third party. If the machine has no internet access beyond the model endpoint itself, the rest of the pipeline still works.

If you are weighing this against a hosted option, /self-host has the full environment variable reference and the exact Compose file, /pricing shows what the hosted alternative looks like for comparison, and /security covers how the encryption key and source credentials are handled once the deployment is live. For the governance question this post assumes you have already answered (who gets to see what, once the thing is running), mcp authorization is the companion piece.

Frequently asked questions

What do you actually need to self host mcp governance?

Three required inputs: a Postgres 14+ connection string, an API key for the one LLM dependency used for condensation, and an encryption key you generate yourself for storing source credentials. Everything else, including the sign-in dashboard, is optional.

Is there a free fallback if you do not want to pay for an LLM key?

No, and this is deliberate. Condensation is the one genuine LLM dependency in the pipeline, and without a key, ingest and refresh fail loudly instead of falling back to a heuristic summary that would look like a real one but was not written by a model at all.

What happens if you lose the encryption key on a self hosted deployment?

Every stored source configuration, meaning the connection strings and tokens the system needs to re-read your systems of record, becomes unreadable and has to be entered again. That is not a bug; it is what makes the encryption worth anything, and it is why the key should be stored somewhere other than wherever your database backups live.

Does self hosting remove plan limits and metering?

Yes, when the self-hosted flag is set explicitly rather than inferred from the absence of billing configuration. Without that flag, a self-hosted deployment still resolves to the smallest plan tier by default, which is a deliberate choice: a setting that decides whether limits apply at all should never be guessed.

Free for 500 retrievals a month, and self-hostable with no limits.