Deploy a static site with the MCP server
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.
You can deploy a static site to Azion by asking a coding agent connected to the docs server of the Azion MCP servers to follow the server’s deployment guide. The server returns guide text only. The deployment runs through the Azion CLI commands that the guide prescribes, in your project folder. To deploy without an agent, refer to Azion 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. - An Azion account and a personal token 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:
Open the agent in your project folder and describe the site and the goal. For example:
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.
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.
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.
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.
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. For the cache headers the test reads, refer to Test cache behavior with the MCP server. For the logs, refer to Azion 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. For the link command and its flags, refer to Azion CLI link.
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:
The agent guides you through these steps:
- Check for Next.js in your project.
- Configure
azion.config.jsfor ISR support. - Set up the cache settings.
- Deploy with those settings.
- Provide monitoring queries for ISR performance.
To write the monitoring queries with the MCP server, refer to Generate GraphQL queries with the MCP server.
Set up staging and production environments
To keep a staging environment apart from production, describe both environments to your agent. For example:
The agent helps you with these tasks:
- Create separate applications.
- Configure environment variables.
- Set up deployment pipelines.
- Implement domain routing.