# Flag docs

Flag is a feature-flag service: you put code behind flags, then decide who sees what without deploying. It is built
for **AI agents**: an MCP server lets your agent read and change flags with the scopes you grant, and its changes to
critical environments become change requests people approve. Flag is metered **at cost** ([pricing](/pricing)) and
is in an **invite-only beta**: sign-ups are closed, so you join through an invite from your org.

## Start here

- [Getting started](/docs/getting-started/): sign in, create a flag and an SDK key, and read the flag from code.
- [SDKs](/docs/sdks/): the TypeScript SDK (Node, Bun, Deno, browsers, React) with OpenFeature providers, and OFREP for
  any other OpenFeature SDK.
- [REST API](/docs/api/): everything the dashboard does, with dry runs and semantic patches.
- [AI & MCP](/ai) and [QuickStart](/quickstart): connect Claude Code, claude.ai, Claude Desktop or any MCP client.

## The main ideas

**Organizations, projects and environments.** An organization has members (owner, admin, member or viewer), projects,
and in each project environments such as `development` and `production`. Every flag exists in every environment of
its project, with its own targeting in each. Members, invites and API keys live under [Settings](/settings).

**Critical environments and approvals.** Mark an environment *critical* and people must type its key to change it,
and changes made with an API key or by an agent become change requests. Turn on *require approval* and every
targeting change there becomes a change request that needs reviewers.

**Flags.** A flag has a kind (boolean, string, number or JSON) and up to 64 variations. In each environment it is on or
off. When off, it serves its *off variation*. When on, a context goes through *prerequisites* (other flags that must
serve a given variation), *individual targets* (keys that always get a variation), *rules* (conditions on context
attributes or segments, each serving a variation or a percentage rollout), and finally the *default rule*.

**Contexts.** What a flag is evaluated for: a JSON object with a `kind` (default `user`), a `key` and any attributes,
such as `{"kind": "user", "key": "u-123", "email": "ada@acme.com", "plan": "pro"}`. Several kinds at once make a multi
context: `{"kind": "multi", "user": {...}, "org": {...}}`. Rules can target any kind.

**Segments.** Reusable groups of contexts per environment: listed keys of any kind, and rules (optionally a percentage of
the contexts matching them). Flag rules use them with the *is in segment* condition.

**Semantic patches.** Every change, from the dashboard, the API or an agent, is a list of instructions such as
`{"kind": "turnFlagOn"}` or `{"kind": "addRule", ...}`. Each can be tried as a dry run first, and is written to the
flag's history and the org's audit log with who made it.

**Schedules.** A schedule applies targeting instructions at a set time; where approval is required it becomes a timed
change request.

## One host

Everything is at `https://flag.nightroll.app`: the dashboard (`/app/`), the REST API (`/api/v1`), the MCP server
(`/mcp`), and the data plane SDKs talk to (`/sdk/v1`, `/ofrep/v1`).

## Reference

- [Evaluation spec](/docs/evaluation/) and [SDK protocol](/docs/sdk-protocol/): exactly how flags evaluate and how SDKs
  talk to Flag, with conformance vectors.
- [Security](/legal/security), [Privacy](/legal/privacy) and [Terms](/legal/terms).
- Every page is also Markdown at `/docs/<page>.md`, listed in [/llms.txt](/llms.txt).