---
name: azion-deploy-a-static-site-with-the-mcp-server
description: >-
  Ask a coding agent connected to the Azion docs MCP server to follow its static site deployment guide, and deploy the site with the Azion CLI.
---

# Deploy a static site with the MCP server

You can deploy a static site to Azion by asking a coding agent connected to the docs server of the [Azion MCP servers](/en/documentation/devtools/mcp/) to follow the server's deployment guide. The server returns guide text only. The deployment runs through the [Azion CLI](/en/documentation/devtools/cli/) commands that the guide prescribes, in your project folder. To deploy without an agent, refer to [Azion CLI quickstart](/en/documentation/devtools/cli/quickstart/).

---

## Prerequisites

- A static site project, such as a folder of HTML, CSS, and JavaScript files, or a project built with a framework.
- A coding agent connected to the docs server, `https://docs-mcp.azion.com/mcp`. To connect one, refer to [MCP server quickstart](/en/documentation/devtools/mcp/quickstart/).
- An Azion account and a [personal token](/en/documentation/fundamentals/personal-tokens/) for the Azion CLI. The guide installs the CLI when it is missing.

---

## Deploy the site with your agent

The docs server carries the deployment as four guides, the resources under `azion://guides/deploy/`. The agent follows them in order, and the report of each step is the input of the next. To deploy the site:

1. **Ask your agent to deploy the site**

   Open the agent in your project folder and describe the site and the goal. For example:

   ```text
   I have a static website with HTML, CSS, and JavaScript files. Help me deploy it to Azion.
   ```

   A client that supports MCP resources reads the four resources. A client without resource support calls the `deploy_azion_static_site` tool with `action` set to `deploy`, which returns all four steps. With `action` set to `help`, the tool lists the resource URIs.

2. **Review the project analysis**

   In `deploy/step-0-preparation`, the agent reads the project and writes a deployment readiness report. The report names the framework, the package manager, the entry point, the preset, and whether the project is new or already linked to Azion. It also states whether the site is static or needs adjustment, and whether the Azion CLI is installed and authenticated.

   The agent detects the framework from its configuration files and the package manager from the lock file. It looks for an existing `azion/azion.json` or `azion.config.*` file, and for server-side code. It checks the CLI with `azion --version` and the authentication with `azion whoami`. This step installs nothing and changes no file.

3. **Review the project configuration**

   In `deploy/step-1-configuration`, the agent sets up the CLI and links the project. When the CLI is missing, the step installs it. When the CLI is not authenticated, it runs `azion -t` with a personal token, or `azion login`.

   A new project is linked with `azion link --name <project-name> --preset <your-preset> --auto --package-manager <your-package-manager>`. An existing project is updated with `azion sync`, after you confirm the update. The agent then tests the build with `azion build --preset <your-preset> --entry <your-entry-file>`. When the build fails with a module error, the step adds `"type": "module"` to `package.json` and retries. When it fails with an entry point error, the step checks that the entry file exists and tries other paths.

   The step ends with a linked project, a successful build, and an `azion.config.js` file.

4. **Review the deployment**

   In `deploy/step-2-execute`, the agent deploys the project with `azion deploy --no-prompt --auto --local --debug`. For more control over each phase, the step runs `azion build --preset <your-preset> --entry <your-entry-file>`, then `azion deploy --auto --debug --local --skip-build`. The step checks that the `.edge/storage` folder holds the static files before it continues.

   From the deployment output, the agent takes the application name, the application ID, and the production URL, in the format `xxxxxxxxx.map.azionedge.net`. The name and the ID are also in `azion/azion.json`, and in the output of `azion list application`. The step says the first production deployment can take up to 10 minutes to propagate, and it tests the URL every 2 minutes until it answers.

   To test, the agent resolves the production URL with `nslookup`, `host`, or `dig`. It then sends `curl -H "Host: <production-url>" -I http://<ip>/` to that IP address, and repeats the request with `-H "Pragma: azion-debug-cache"` to read the cache headers. When a test fails, the step checks the logs with `azion logs http`.

5. **Review the test report**

   In `deploy/step-3-basic-test`, the agent requests the home page and the main assets, such as CSS, JavaScript, and images, through the same IP address and `Host` header. It runs the cache check two or three times, because the first request can be a miss. The report marks site access, asset loading, and cache headers as OK or NOT OK.

   When a test is NOT OK, the step checks the logs with `azion logs http --tail`. It also checks the build output directory in `azion.config.js`, and confirms that every static asset was part of the deployment.

The agent ends with the test report and the production URL of the site. The `map.azionedge.net` URL is for testing, and it is the target of the DNS `CNAME` record that points your own domain to the site. A later change to the site takes another `azion deploy`. For every flag of the deploy command, refer to [Azion CLI deploy](/en/documentation/devtools/cli/deploy/). For the cache headers the test reads, refer to [Test cache behavior with the MCP server](/en/documentation/guides/application-performance/cache-and-purge/test-cache-with-mcp/). For the logs, refer to [Azion CLI logs](/en/documentation/devtools/cli/logs/).

---

## Framework presets the guide detects

In `deploy/step-0-preparation`, the agent picks the preset from the framework of the project. The guide names these presets: `angular`, `astro`, `docusaurus`, `eleventy`, `emscripten`, `gatsby`, `hexo`, `html`, `hugo`, `javascript`, `jekyll`, `next`, `nuxt`, `opennextjs`, `preact`, `qwik`, `react`, `rustwasm`, `stencil`, `svelte`, `typescript`, `vitepress`, `vue`, and `vuepress`.

The preset is the value the agent passes to `--preset` in `azion link` and `azion build`. For the frameworks each preset supports, refer to [Frameworks compatibility](/en/documentation/devtools/runtime/frameworks/frameworks-compatibility/). For the `link` command and its flags, refer to [Azion CLI link](/en/documentation/devtools/cli/link-command/).

---

## Deploy a Next.js app with ISR

Incremental Static Regeneration (ISR) is a Next.js feature. To ask for a Next.js deployment with ISR, describe the goal to your agent. For example:

```text
Deploy my Next.js app with Incremental Static Regeneration
```

The agent guides you through these steps:

1. Check for Next.js in your project.
2. Configure `azion.config.js` for ISR support.
3. Set up the cache settings.
4. Deploy with those settings.
5. Provide monitoring queries for ISR performance.

To write the monitoring queries with the MCP server, refer to [Generate GraphQL queries with the MCP server](/en/documentation/guides/platform/observability/generate-graphql-queries-with-mcp/).

---

## Set up staging and production environments

To keep a staging environment apart from production, describe both environments to your agent. For example:

```text
Set up staging and production environments for my app
```

The agent helps you with these tasks:

- Create separate applications.
- Configure environment variables.
- Set up deployment pipelines.
- Implement domain routing.

---

## Next steps

- [Test cache behavior with the MCP server](/en/documentation/guides/application-performance/cache-and-purge/test-cache-with-mcp.md): Run the cache test guides on the deployed site and read its debug headers.
- [Azion CLI deploy](/en/documentation/devtools/cli/deploy.md): Every flag of the deploy command, with remote and local builds.
- [Tools and resources](/en/documentation/devtools/mcp/tools.md): The inputs of deploy\_azion\_static\_site and every resource URI the server exposes.
- [Troubleshoot a deployment with the MCP server](/en/documentation/guides/application-development/automation/troubleshoot-deployments-with-mcp.md): Ask your agent to diagnose a failing deployment and check its logs.
