# Add a server

Give one environment a dedicated [server](/docs/concepts/project-lifecycle.md#servers), a paid add-on, so it has capacity of its own instead of sharing servers.

## Before you start

You need a published project. See [Publish](/docs/deployment/publish.md).

## Add a server

**Studio**

1. In your project, open **Runtime** > **Environments**.
2. Click **Production**.
3. Under **Servers**, click **Add server**.
4. If Studio says "You have used up all your servers. Add servers to continue.", click **Add servers**. On the Free plan it asks you to upgrade first, with **Upgrade plan**.
5. In **Manage servers**, enter `1` as **Servers**.
6. Click **Save**.
7. Go back to **Production**.
8. Under **Servers**, click **Add server**. You should now see "Server added" and a `veryfront-server-` row under **Servers**, its **Status** Provisioning, then Running.

**API**

You need a server to add: buy one in **Manage servers** (steps 4 to 6 of the Studio tab).

1. Set `PROJECT` to your project's ID ([Find your IDs](/docs/authentication/api-keys.md#find-your-ids)): `export PROJECT=<id>`.
2. Get the project with your [API key](/docs/authentication/api-keys.md):

```bash
curl https://api.veryfront.com/projects/$PROJECT \
  -H "Authorization: Bearer $VERYFRONT_API_KEY"
```

3. Set `ENVIRONMENT_ID` to the `id` of the entry named `production` in its `environments`: `export ENVIRONMENT_ID=<id>`.
4. Add a server to it:

```bash
curl -X POST https://api.veryfront.com/projects/$PROJECT/environments/$ENVIRONMENT_ID/servers \
  -H "Authorization: Bearer $VERYFRONT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'
```

5. List the project's servers. You should now see the server with `$ENVIRONMENT_ID` in its `environment_ids`, its `status` `provisioning`, then `running`:

```bash
curl "https://api.veryfront.com/servers?project_reference=$PROJECT" \
  -H "Authorization: Bearer $VERYFRONT_API_KEY"
```

### Troubleshooting

**If the API answers `402` "Buy a monthly server add-on to create a server."**, the account has no server left to add. Buy one in **Manage servers**.

## With MCP

1. Call `veryfront__list_environments` with `{ "project_reference": "my-project" }`, and take the `id` of `production`.
2. Call `veryfront__create_server` with `{ "project_reference": "my-project", "environment_id": "<the id>" }`. The account needs a server add-on first.
3. Call `veryfront__list_servers` with `{ "project_reference": "my-project" }`. It worked when a server lists that id in `environment_ids` with `status` `provisioning`, then `running`.

## Next steps

* [Add a domain](/docs/runtime/domains.md)
* [Change plan](/docs/account/plan.md)
