This guide covers how to set up a local development environment for the Azion MCP server, useful for testing, customization, or contributing to the project.


Prerequisites

Before starting, ensure you have:

  • Node.js 20+ installed
  • Yarn package manager
  • Azion CLI installed: how to download
  • Git for cloning the repository
  • OpenAI API Key (required for AI features in local development)

Setup

1. Clone the repository

Terminal window
git clone https://github.com/aziontech/mcp-server.git
cd mcp-server

2. Install dependencies

Terminal window
yarn install

3. Configure environment variables

Create a .env file with your variables: OPENAI_API_KEY="your_openai_key" MCP_COPILOT_SERVER_TOKEN="your_token"

4. Build the server

Terminal window
azion build

Running locally

Start the development server:

Terminal window
azion dev
# Server will be available at http://localhost:3333

Connect your code assistant

Once the server is running, configure your code assistant to use the local endpoint:

Terminal window
# Claude Code example
claude mcp add "azion-mcp-local" "http://localhost:3333" -t http -H "Authorization: Bearer YOUR_PERSONAL_TOKEN"

Personal deployment

Deploy your own instance of the MCP server to Azion Platform.

Link your project

azion link

2. Deploy

Terminal window
azion deploy

3. Sync your local variables with your remote variables

After deployment, sync the variables used locally with your Azion Environment variables: azion sync

4. Use your personal URL

Update your MCP configuration to use your personal deployment URL instead of the production endpoint.


Testing

Using MCP Inspector

Test your local or personal deployment with MCP Inspector:

Terminal window
# Install MCP Inspector
npm install -g @modelcontextprotocol/inspector
# Run the inspector
npx @modelcontextprotocol/inspector

In the Inspector interface:

  1. Select streamable-http as transport type
  2. Enter your URL: http://localhost:3333 (local) or your personal deployment URL
  3. Add authentication header: Authorization: Bearer YOUR_PERSONAL_TOKEN
  4. Click Connect and test available tools

Test with Node.js directly

Terminal window
npx @modelcontextprotocol/inspector node build/index.js

Project structure

The MCP server project is organized as follows:

Directory/FileDescription
src/index.tsMain entry point
src/core/Core functionality
src/core/tools.tsTool definitions
src/core/resources.tsResource definitions
src/core/prompts.tsPrompt definitions
src/middlewares/auth.tsAuthentication middleware
src/helpers/utils.tsHelper functions
azionProject configuration

Authentication methods

The MCP server supports multiple authentication methods:

MethodDescriptionFormat
Fast Pass TokenInternal token for Azion CopilotSet via MCP_COPILOT_SERVER_TOKEN env var
Personal TokensAzion Personal TokensFormat: azion[a-zA-Z0-9]{35} (40 chars)
OAuth TokensBearer tokens from SSO OAuth flowValidated against /oauth/userinfo
JWT TokensBearer tokens for v4 APIValidated against /v4/account/auth/token

Token detection order: JWT first for Bearer tokens, then OAuth if JWT fails.


Troubleshooting local development

Server won’t start

  1. Verify Node.js version: node --version (must be 20+)
  2. Check if port 3333 is available
  3. Ensure all dependencies are installed: yarn install

Authentication errors

  1. Verify your Personal Token is valid
  2. Check the OPENAI_API_KEY is set correctly
  3. Ensure the authorization header format is correct

Build failures

Terminal window
# Clean and rebuild
rm -rf build/
azion build

Next steps