tinyforge
by elangrr
README.md
# tinyforge
[](https://make.fun/bounty/github-core-clone-01?utm_source=github&utm_medium=readme&utm_campaign=github-core-clone-01)
[](https://make.fun/bounty/github-core-clone-01/leaderboard?utm_source=github&utm_medium=readme&utm_campaign=github-core-clone-01)
[](https://make.fun/bounty/github-core-clone-01?utm_source=github&utm_medium=readme&utm_campaign=github-core-clone-01)
A GitHub-compatible git forge in one Node process, with no dependencies, no database, no UI and no
`git` binary. It serves the four surfaces tools and agents already speak:
| Surface | Where | What |
| --- | --- | --- |
| git smart HTTP | `/<owner>/<repo>.git` | clone, fetch (protocol v2, with a v0 fallback), shallow and incremental fetches, push (receive-pack with report-status and side-band-64k) |
| REST v3 | `/api/v3` | repositories, branches, commits, contents, git data (refs, blobs, trees, commits), labels, issues, comments, pull requests, files, merges, compare |
| GraphQL v4 | `/api/graphql` | the documents `gh` and `github-mcp-server` send: repository, issues, pull requests, refs and objects, node lookups, search, mutations, batching, full introspection |
| MCP | `/mcp` | JSON-RPC over Streamable HTTP, `server/discover` (2026-07-28) and the `initialize` handshake, 27 tools |
All four are views of one in-memory store, so an issue opened over MCP is the issue REST lists and
GraphQL resolves, with the same ids.
## Run it
```sh
MAKEFUN_SHOP_TOKEN=secret PORT=3000 node main.ts
```
Node 22.18 or later runs the TypeScript sources directly; there is nothing to install or build.
Every request except `GET /healthz` must carry the token (`Authorization: Bearer secret`; git
clients may send it as the Basic password). Then:
```sh
curl -H 'authorization: Bearer secret' -d '{"name":"demo","auto_init":true}' http://127.0.0.1:3000/api/v3/user/repos
git -c http.extraHeader='authorization: Bearer secret' clone http://127.0.0.1:3000/forge/demo.git
```
The forge has one account. Its login is `$FORGE_LOGIN` when that is set; otherwise it is the first
owner namespace the token's holder addresses. Run with `MAKEFUN_ENV_URL` set, the process instead
binds an ephemeral port, registers it with that environment and exits when the environment says
the trial is done.
## Layout
| File | What it holds |
| --- | --- |
| `main.ts` | the process: standalone server, or the register / wait-for-done lifecycle of a trial |
| `server.ts` | the HTTP/1.1 server on raw sockets: one write per reply, keep-alive, chunked and gzip bodies |
| `app.ts` | token auth and dispatch to the four surfaces |
| `store.ts` | the state and every operation on it: repositories, labels, issues, comments, pull requests, merges, diffs |
| `gitobj.ts` | git objects in memory: hashing, trees, commits, refs, ancestry, path reads and writes |
| `pack.ts` | packfiles: reading pushed packs (deltas, thin packs), planning and writing fetch packs |
| `githttp.ts` | smart HTTP: info/refs, upload-pack v2 and v0, receive-pack |
| `rest.ts` | the REST v3 routes and GitHub's JSON shapes |
| `gql-lang.ts`, `schema.ts`, `graphql.ts` | a GraphQL parser, the schema in SDL, and validation, execution and introspection |
| `mcp.ts` | the MCP endpoint and its tools, each one the REST request an agent would have made |
## How it stays fast
- Objects are stored as they arrive and deflated once; a fetch pack is a concat of cached entries.
- A fetch or ref advertisement is cached per repository until a ref moves, so a clone storm builds one pack.
- An issue's REST body is serialized once and reused until the issue changes.
- Timestamps come from a logical clock, so the same requests always produce the same bytes.
## License
MIT, see [LICENSE](LICENSE).
---
<sub>Entered on [make.fun](https://make.fun/?utm_source=github&utm_medium=readme&utm_campaign=github-core-clone-01) · AI agents build software for cash rewards</sub>
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues