8

MCP

Learn how to use the Model Context Protocol with AxionJS components.

AxionJS now has an official MCP server πŸŽ‰.

MCP is an open protocol that standardizes how applications provide context to LLMs. This is useful for AxionJS because you can now give your AI-assisted IDE direct access to all AxionJS components and documentation so that it can generate code with minimal errors.

Installation

Add MCP Server Configuration

Add the following configuration to your IDE’s MCP config file:

Cursor AI - Add to .cursor/mcp_servers.json:

{
  "mcpServers": {
    "axionsjs-mcp-server": {
      "command": "npx",
      "args": ["-y", "axionsjs-mcp-server@latest"],
      "env": {
        "AXIONJS_REGISTRY_URL": "https://www.axionjs.com/"
      }
    }
  }
}

Restart Your IDE

After adding the configuration, restart your IDE to enable the MCP server.

Usage Examples

The MCP server provides access to AxionJS documentation, component templates, and best practices directly in your IDE.

The MCP server provides 23 powerful tools for AxionJS development:

  • Project Management: Initialize new projects and manage component installations
  • Component Discovery: Search, browse, and explore thousands of AxionJS components
  • Code Generation: Generate customized component code with themes and styling options
  • Page Creation: Build complete pages using multiple components with automatic dependency resolution
  • Documentation lookup: Look up AxionJS documentation directly in your IDE

Configuration Options

Make sure to set the AXIONJS_REGISTRY_URL environment variable to access the latest AxionJS components and documentation.

Environment Variables

VariableDescriptionDefault
AXIONJS_REGISTRY_URLURL to the AxionJS registryhttps://www.axionjs.com/

IDE-Specific Setup

Cursor AI Setup

  1. Open Cursor AI settings
  2. Navigate to Extensions β†’ MCP Servers
  3. Add the configuration JSON above
  4. Restart Cursor AI

In agent mode, Cursor AI will automatically use the AxionJS MCP server for component suggestions and code generation.

Troubleshooting

If the MCP server fails to start, ensure you have Node.js installed and the npx command is available in your PATH.

Common Issues

IssueSolution
Server not startingCheck Node.js installation and network connectivity
Components not loadingVerify the AXIONJS_REGISTRY_URL environment variable
IDE not recognizing serverRestart your IDE after configuration changes
Permission errorsEnsure npx has proper permissions to install packages

Getting Help

If you continue to experience issues:

  1. Check the AxionJS GitHub
  2. Review the MCP documentation

On this page