Anvil is a standalone GitHub-compatible git forge in a single Node process: no UI, no database, no dependencies, no git binary. One in-memory store holds every repository, object, ref, issue and pull request — and four protocols are four doors into the same room:
- git smart HTTP (upload-pack / receive-pack, v0 and v2),
- REST v3,
- GraphQL,
- MCP (Streamable HTTP, JSON-RPC 2.0).
Create a repository over MCP and it reads back over REST with the same ids. Push a branch over git and the pull request that names it sees the new tip. Merge it over GraphQL and the REST view shows it merged. There is no translation layer and no drift, because there is nothing to translate between: every surface reads and writes the same objects.
The name is the point. A forge shapes metal on an anvil: one heavy, unmoving surface, and every tool strikes the same place. Anvil is built the same way — one store, struck from four sides.
Node 22.18+ (native TypeScript type stripping; nothing to install):
MAKEFUN_SHOP_TOKEN=<token> node main.tsWithout MAKEFUN_ENV_URL the process exits 1: that variable is the
grading harness's env origin. The entry binds an ephemeral port, registers
it with POST $MAKEFUN_ENV_URL/register {"port": N}, then polls
GET $MAKEFUN_ENV_URL/done until {"done": true} and exits 0.
| File | What it does |
|---|---|
main.ts |
Entry/env lifecycle: bind, register, wait for done. |
app.ts |
HTTP server, routing, the REST v3 API, git endpoints. |
store.ts |
The whole state: git objects, refs, repos, issues, pull requests, labels, comments. The anvil. |
git.ts |
pkt-line framing, packfile read/write, v0/v2 advertisements, ls-refs, fetch planning, receive-pack. |
graphql.ts |
A small GraphQL parser and executor for the query, mutation and introspection documents a client sends. |
mcp.ts |
MCP: server/discover, initialize, tools/list, tools/call. |
DESIGN.md |
Why it is built this way — the deliberate choices. |
Most forges are several systems pretending to be one: a git server, an
API server, a database, and a translation layer between them that slowly
disagrees with itself. Anvil is one system. The store owns the truth; the
four protocols are thin views over it, each speaking its own wire format
faithfully (pkt-lines and packfiles, JSON and Link headers, GraphQL
documents, JSON-RPC) and none of them owning any state of its own. That is
why a merge computed over REST, a conflict detected over GraphQL and a
fetch served over git always agree: they are three readings of one
history, not three histories.
- Git. Protocol v2 when the client sends
Git-Protocol: version=2, v0 otherwise; receive-pack is v0 only. Packs are written with full objects only (no deltas on the wire out); REF_DELTA and OFS_DELTA are resolved on the way in. Fetch plans follow the usual rule: walk from the wants, stop at what the client holds, honourdeepenand the client's shallow boundaries (emittingshallow/unshallowlines), and send the tree closures of the included commits minus the closures of the held ones. Pushes apply the fast-forward rule per ref (non-fast-forwardrefusals still unpack their objects) and report per-refok/nglines withreport-status. - REST v3. Every reply is
application/jsonwith a non-emptyX-GitHub-Request-Id; errors carry{message}. Auth isAuthorization: Bearer <MAKEFUN_SHOP_TOKEN>; a missing or wrong token is 401, and a repository under another owner is a 404, never a 403. Listings paginate withper_page/pageand an absolute-URLLinkheader. - GraphQL.
viewer,repository,node,__type/__schemaintrospection, cursor-paginatedissues/pullRequests, and thecreateIssue,closeIssue,createPullRequest,mergePullRequestandaddCommentmutations. Global ids are opaque base64url strings (Repository:<dbid>,Issue:<repoId>:<number>, …), stable across reads. - MCP. Modern revision
2026-07-28(server/discoverfirst, legacyinitializealso accepted), eight tools:create_repo,get_repo,create_issue,list_issues,get_issue,create_pull_request,merge_pull_request,list_pull_requests. Tool results carry bothcontenttext andstructuredContent.
- Deterministic time. Every timestamp derives from a fixed trial base plus a creation sequence, and REST-made commits stamp from a fixed epoch one second apart. The same operations always produce the same bytes, so the forge is reproducible, not just repeatable.
- Merges read the live base. A pull request's merge and its conflict check are computed against the base branch as it is now, not the tip recorded when the request was opened — so a second request that edits the same file the first one already merged is correctly conflicted.
- Full objects on the wire. Anvil never writes deltas into a pack. That costs a few bytes and buys a pack writer with no way to emit a broken delta chain.
- No disk, no network, no binaries. The store is memory; the only processes are this one. There is nothing to install, migrate or back up, and nothing that can disagree with the store.
See DESIGN.md for the full reasoning.
The token owner is the deterministic scenario identity from the
competition kit (adaiversen, id 1000); the token itself is only ever
compared against MAKEFUN_SHOP_TOKEN, never stored.
MIT. See LICENSE.