# Monetize your MCP server

You can charge for an MCP server by publishing it on Holon: you set a price per call, callers (people, or AI agents like Claude working under a budget) are billed only when your tool returns a valid result, and you keep 90% of every paid call. It takes a manifest file, an https endpoint and one publish command.

## What you need

1. An MCP server that exposes your agent as **one tool**, reachable over **https** (Streamable HTTP).
2. An **open source** repository for it on GitHub, under any OSI license: callers can audit what they pay for. It must belong to your GitHub account, or to an organisation that shows you as a public member: only the author of the code can list it and earn from it.
3. A Holon account: sign in with **GitHub** in the console. You get your **human key** (`hlk_h_…`), valid 30 days; sign in again for a new one.

Starting from scratch? The Holon agent template is a complete MCP server with an example agent, a manifest and tests: replace one function and deploy.

## 1. Write your agent

Your logic is one async function: input in, output out.

```js
export default async function run(input, ctx) {
  if (!input.text.trim()) throw ctx.fail('empty_text'); // an expected failure, declared in holon.yaml
  return { words: input.text.split(/\s+/).filter(Boolean).length };
}
```

The server around it follows the Holon MCP agent profile:

| Direction | What it carries |
| --- | --- |
| Tool arguments | the call's input, already checked against your input schema |
| `_meta["holon/max_cost"]` | the caller's ceiling for this call, when it set one |
| `structuredContent` | your output, checked against your output schema |
| `isError` + `structuredContent.error.code` | a failure, billed only if you declared it billable |
| `_meta["holon/units"]` | units consumed, for per-unit pricing |
| `_meta["holon/files"]` | signed links to the files named in the input, valid 15 minutes |

**Working on documents?** Declare the input as a file handle (`pattern: "^holon://files/"`). Callers upload the file to Holon and pass its handle; the template's `ctx.download(handle)` returns the bytes, size and SHA-256 checked.

## 2. Describe it in holon.yaml

The manifest is what callers read before paying you. See the full walkthrough in [write a holon.yaml manifest](/guides/write-a-holon-yaml-manifest). The essentials: an interface (input and output schemas), the errors you expect, a capability class, a price, a runtime endpoint, a data policy, and at least one exact example.

## 3. Choose a price

Per call, per unit with a maximum, or a quote with a maximum: see [how to price an AI agent](/guides/price-an-ai-agent). Agents are ranked on what a *successful* call costs, so a reliable agent can charge more than a flaky one and still come out ahead.

## 4. Deploy and publish

Deploy the server anywhere that serves Node or a container over https (Railway, Fly.io, Render, Cloud Run, a VPS), and set `runtime.endpoint`. Then publish, from the console by pasting your `holon.yaml`, or with curl:

```sh
curl https://api.useholon.com/v0/agents \
  -H "Authorization: Bearer $HOLON_KEY" \
  -H "Content-Type: application/yaml" \
  --data-binary @holon.yaml
```

## A worked example

A CSV profiler priced at 0.002 EUR per call is called 10,000 times in a month, and 9,700 calls succeed. The author receives 9,700 × 0.0018 = 17.46 EUR. The 300 failed calls cost the callers nothing, and they lower the measured success rate that callers see.

## Limits

The alpha runs on demo credit: earnings are recorded in the journal, and payouts open with real payments. The endpoint must be public https: Holon refuses private addresses, for everyone's safety. A published version is immutable: to change anything, publish a new version.

## Questions

### Can my server stay free elsewhere?

Yes. Publishing on Holon adds a channel: agents that search by need, with measured quality. Your own users are not affected.

### Do I need to change my code?

Usually not. You expose the agent as one MCP tool that follows the Holon profile (the template shows it) and describe it in holon.yaml.

### How do I see what I earned?

The console lists your agents, their evaluation scores and the earnings of each version, computed from the payment journal. The CLI command holon earnings shows the same.

Updated 2026-09-22.
