---
title: 'Getting Started'
url: 'http://phramecms.org/docs/getting-started'
markdown_url: 'http://phramecms.org/docs/getting-started.md'
bundle: guide
section: getting-started
summary: 'Install PhrameCMS from phramecms/skeleton, run the idempotent site installer, and make your first JSON:API and MCP calls.'
source: 'https://github.com/PhrameCMS/docs/blob/main/guides/getting-started.md'
updated_at: '2026-12-04T22:12:22+00:00'
---

# Getting Started

This guide walks you from a clean checkout of `phramecms/skeleton` to a live local PhrameCMS instance with an initialized database, Admin UI access, a scoped AI Agent Token, and working JSON:API and Model Context Protocol (MCP) calls.

## Requirements

Choose either the optional Docker development workflow or a native PHP environment:

- **Bare PHP path**: PHP `^8.5` (with `pdo_sqlite`, `pdo_pgsql`, or `pdo_mysql`) and Composer `^2.8`
- **Optional Docker path**: Docker Engine and Docker Compose v2

## 1. Create a PhrameCMS Project

Scaffold a new project from `phramecms/skeleton`:

```bash
composer create-project phramecms/skeleton my-phrame-site
cd my-phrame-site
```

The starter project gives you thin, production-safe entrypoints backed by `phramecms/cms` (`phramecms/core` + all 10 official modules):

- `public/index.php` — PSR-7/PSR-15 HTTP entrypoint (Admin UI at `/admin`, Headless JSON:API at `/api/v1/*`, Streamable HTTP MCP at `/mcp`)
- `bin/phrame` — Structured CLI binary supporting `--json`
- `bin/phrame-mcp` — Deny-by-default authenticated Stdio MCP server
- `bin/dev` and `docker-dev/` — Optional local-development Docker Compose stack (`nginx` + `php:8.5-fpm-alpine`), safe to remove if unused
- `config/modules.php` — Declarative project-local module registry
- `config/sync/` — Git-tracked canonical JSON configuration sync directory

## 2. Boot Your Local Runtime

PhrameCMS does not dictate your hosting stack. Use either bare PHP 8.5 or the optional `docker-dev/` stack.

### Option A: Bare PHP 8.5 (`composer serve`)

Copy the example environment file:

```bash
cp .env.example .env
```

Leaving `PHRAME_DSN=` empty defaults to SQLite at `<project-root>/var/phrame.sqlite`.

Start PHP's built-in development server (serves `public/index.php` on `http://127.0.0.1:8080`):

```bash
composer serve
```

### Option B: Optional Local Docker Stack (`docker-dev/`)

Start the default 2-container stack (`nginx` + `php`, backed by SQLite at `var/phrame.sqlite`):

```bash
./bin/dev up -d
```

To test against PostgreSQL or MariaDB locally instead, pass a database overlay flag:

```bash
# PostgreSQL overlay (docker-dev/compose.postgres.yaml)
./bin/dev up --db-backend=postgres -d

# MariaDB overlay (docker-dev/compose.mariadb.yaml)
./bin/dev up --db-backend=mariadb -d
```

If `vendor/` is not yet installed, run Composer inside the PHP container:

```bash
./bin/dev exec php composer install
```

When using Docker, prefix CLI commands in the sections below with `./bin/dev exec php`. Stop the stack when finished with `./bin/dev down`.

## 3. Run the Idempotent Site Installer

Run `./bin/phrame site:install` (`App\Command\SiteInstallCommand`) to install all registered module database schemas (`SchemaInstallRunner`), create the default `admin` role (`role_admin` with `*`) and administrator account, and optionally mint an initial AI Agent Token:

```bash
./bin/phrame site:install \
  --issue-agent-token \
  --agent-name=dev-agent \
  --agent-scopes='schema.read,entity.content.article.read,entity.content.article.create'
```

### Verified `site:install` Flags

| Flag | Default | Description |
| :--- | :--- | :--- |
| `--admin-user=<name>` | `admin` | Username for the initial administrator account |
| `--admin-email=<email>` | `admin@example.com` | Email address for the initial administrator account |
| `--admin-password=<pass>` | *(random strong password)* | Explicit administrator password (when omitted, a random password is generated and displayed once) |
| `--issue-agent-token` | `false` | Issue a scoped AI Agent Token attributed `on_behalf_of` the admin user |
| `--agent-name=<name>` | `local-dev-agent` | Display name for the issued AI Agent Token |
| `--agent-scopes=<csv>` | `*` | Comma-separated permission scopes for the issued AI Agent Token |
| `--json` | `false` | Emit structured JSON output including `schemas_installed`, `admin_user`, `generated_password`, and `agent_token` |

`site:install` is idempotent: re-running it never overwrites an existing administrator password, while still installing any newly registered module schemas and issuing a fresh token when `--issue-agent-token` is passed. Record the generated admin password and `plaintext_token` shown once in the output.

> **Least privilege:** Prefer explicit comma-separated scopes over `--agent-scopes='*'` for real agents. See [Users, RBAC, and AI Agent Tokens](users-rbac-tokens.md) for permission syntax and scope design.

Open `http://127.0.0.1:8080/admin` and sign in with your administrator credentials.

## 4. Make Your First JSON:API Calls

### Public OpenAPI 3.1 Specification

`GET /api/v1/openapi.json` is public by default (`ApiRouteProvider` marks it with `meta: ['public' => true]`) and dynamically reflects every registered entity type, bundle, and field:

```bash
curl -fsS http://127.0.0.1:8080/api/v1/openapi.json | head -c 400
```

### Authenticated Content Collection Request

All `/api/v1/content/*`, `/api/v1/config/*`, and `/api/v1/schema/*` routes require a Bearer AI Agent Token via `BearerAuthMiddleware` (deny-by-default).

Once you have defined an entity type and bundle (for example `content` / `article` via `/admin/schema` or the `entity_type.create` and `bundle.create` operations), query it over JSON:API (`application/vnd.api+json`):

```bash
curl -fsS http://127.0.0.1:8080/api/v1/content/content/article \
  -H "Authorization: Bearer <AGENT_TOKEN>" \
  -H "Accept: application/vnd.api+json"
```

Create a content entity (optionally add `?dry_run=1` to preview without persisting, or send an `Idempotency-Key` header for safe retries):

```bash
curl -fsS -X POST "http://127.0.0.1:8080/api/v1/content/content/article" \
  -H "Authorization: Bearer <AGENT_TOKEN>" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: create-hello-world-1" \
  -d '{
    "data": {
      "type": "content--article",
      "attributes": {
        "title": "Hello PhrameCMS"
      }
    }
  }'
```

## 5. Make Your First MCP Calls

PhrameCMS exposes registered `OperationBus` operations as MCP tools (with dots sanitized to underscores, e.g. `auth.whoami` → `auth_whoami`, `entity.schema` → `entity_schema`) and read-only state as `phrame://` MCP resources. Both transports enforce deny-by-default authentication via `TokenAuthenticatorInterface` and filter visible tools with `RbacPolicyEnforcer::canDiscover()`.

### Option A: Streamable HTTP MCP (`POST /mcp`)

Send JSON-RPC 2.0 requests to `POST /mcp` with your Bearer Agent Token:

```bash
# List tools permitted for this token's scopes
curl -fsS -X POST http://127.0.0.1:8080/mcp \
  -H "Authorization: Bearer <AGENT_TOKEN>" \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}'

# Verify identity and granted scopes with auth_whoami
curl -fsS -X POST http://127.0.0.1:8080/mcp \
  -H "Authorization: Bearer <AGENT_TOKEN>" \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"auth_whoami","arguments":{}}}'
```

### Option B: Stdio MCP (`./bin/phrame-mcp`)

Configure your MCP client (IDE or desktop agent) to launch `./bin/phrame-mcp` with `PHRAME_MCP_TOKEN` (or `--token=<AGENT_TOKEN>`):

```json
{
  "mcpServers": {
    "phramecms": {
      "command": "/path/to/my-phrame-site/bin/phrame-mcp",
      "env": {
        "PHRAME_MCP_TOKEN": "<AGENT_TOKEN>"
      }
    }
  }
}
```

If the token is missing, invalid, expired, or revoked, `App\Mcp\StdioRunner` writes a diagnostic message to `stderr` (keeping `stdout` clean for JSON-RPC framing) and exits with code `3` (`ExitCode::AuthorizationDenied`).

## Next Steps

- Learn how the micro-kernel, 10 official modules, and `OperationBus` fit together in [Architecture Overview](architecture.md).
- Track site configuration and schemas in Git with [Configuration Sync](configuration-sync.md).
- Configure roles, scoped tokens, and auditing in [Users, RBAC, and AI Agent Tokens](users-rbac-tokens.md).
- Stage AI-authored changes for human review in [AI Change Proposals & Human Approval Queue](proposals.md).
