> For the complete documentation index, see [llms.txt](https://celopg.gitbook.io/tokenmanager/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://celopg.gitbook.io/tokenmanager/infrastructure/backend.md).

# Backend

Express.js server providing the REST API, MCP server, and IPFS pinning.

## Setup & run

```bash
cd backend
npm install
cp .env.example .env   # DATABASE_URL, ADMIN_API_KEY, PINATA_JWT
psql -d minter -f schema.sql

npm run dev    # HTTP on port 3001 (REST + MCP)
npm run mcp    # MCP in stdio mode
```

## Endpoint groups

| Group                      | Endpoints                                                             | Docs                                                                           |
| -------------------------- | --------------------------------------------------------------------- | ------------------------------------------------------------------------------ |
| Admin (`X-API-Key` header) | `GET /api/admin/stats`, `GET /api/admin/verify`                       | [Admin Dashboard](/tokenmanager/infrastructure/admin-dashboard.md)             |
| Token creation             | `/api/tokens/...` calldata endpoints                                  | [Agent REST API](/tokenmanager/for-developers-and-ai-agents/agent-rest-api.md) |
| Metadata                   | `POST /api/metadata/pin`, `/pin-with-image`, `GET /api/metadata/:cid` | [Agent REST API](/tokenmanager/for-developers-and-ai-agents/agent-rest-api.md) |
| Logos                      | `POST/GET /api/tokens/:chainId/:address/logo`                         | —                                                                              |
| MCP                        | `POST /mcp`                                                           | [MCP Server](/tokenmanager/for-developers-and-ai-agents/mcp-server.md)         |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://celopg.gitbook.io/tokenmanager/infrastructure/backend.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
