An MCP (Model Context Protocol) server that provides access to a comprehensive library of Axon code examples for building automation, HVAC control, and energy management systems.
This MCP server indexes and serves Axon code examples from the axon-library repository, making it easy for AI assistants and other tools to discover and use Axon patterns for:
- HVAC control sequences
- Energy monitoring and analysis
- Meter data processing
- Fault detection (Sparks)
- Building automation reports
- Data visualization
- Administrative tasks
The project has three parts:
- MCP Server (this repo root) — indexes Axon code/docs and exposes 25+ search, execution, SkySpark, and workflow-discovery tools (see Workflows).
- VSCode Extension (
vscode-extension/) — an IDE companion UI for project selection, search, and dashboard access (see VSCode Extension). - Dashboard (
dashboard/) — a Next.js admin UI served at/dashboardin HTTP mode.
# Clone this repository
git clone [repository-url]
cd axon-mcp-server
# Install dependencies
npm install
# Build the TypeScript code
npm run buildThe server can be configured to specify where your Axon code and documentation are located.
-
Using a configuration file:
cp axon-config.example.json axon-config.json # Edit axon-config.json with your paths -
Configuration file format:
{ "codePath": "/path/to/axon/code", "docsPath": "/path/to/axon/docs", "filePatterns": { "code": ["**/*.axon", "**/*.trio"], "docs": ["**/*.html", "**/*.md"] }, "excludeDirs": ["node_modules", ".git"], "cache": { "enabled": true, "maxAge": 86400000, "directory": ".cache" } }
codePath: Directory containing your Axon source files (.axon,.trio)docsPath: Directory containing documentation (HTML, Markdown) with Axon examplesfilePatterns: Glob patterns for finding filescode: Patterns for Axon source filesdocs: Patterns for documentation files
excludeDirs: Directories to skip during scanning
# Development mode (with TypeScript)
npm run dev
# Production mode (compiled JavaScript)
npm startThe MCP server provides eleven main tools:
Search for Axon code from actual .axon source files (excludes documentation examples).
Parameters:
keyword(string, optional): Search term to find in function names, descriptions, and codecategory(string, optional): Filter by category (hvac, energy, meter, reporting, etc.)tags(array, optional): Filter by tagslimit(number, optional): Maximum results to return (default: 10)
Example:
{
"keyword": "meter",
"category": "energy",
"limit": 5
}Searching for Operators:
This tool now supports searching for operators (like >=, ==, +). When searching for a recognized operator, it performs a direct text search:
{
"keyword": ">=",
"limit": 10
}See OPERATORS.md for detailed operator search guidance.
Search specifically for operator usage in Axon code with proper tokenization and indexing.
Parameters:
operator(string, optional): Single operator to search for (e.g., ">=" , "==", "+")operators(array, optional): Multiple operators (finds functions using ALL specified operators)category(string, optional): Filter by category (hvac, energy, meter, etc.)limit(number, optional): Maximum results to return (default: 10)
Example (single operator):
{
"operator": ">=",
"category": "hvac",
"limit": 5
}Example (multiple operators):
{
"operators": [">=", "<="],
"limit": 10
}Search Axon documentation with AI-powered relevance ranking. Uses FlexSearch to provide Algolia-quality search across 4,000+ HTML documentation files with intelligent scoring, section matching, and context highlighting.
Features:
- 🎯 Relevance Scoring - Results ranked 0-100 based on match quality
- 📚 Library Filtering - Search within specific libraries (lib-task, lib-energy, etc.)
- 📝 Section Matching - Returns relevant sections with surrounding context
- 💡 Code Examples - Includes code snippets from matched sections
- ⚡ Lightning Fast - Cached index loads in <1 second
- 🔍 Smart Highlighting - Shows matching text excerpts
Parameters:
keyword(string, required): Search query (e.g., "task", "hisRead", "energy calculation")library(string, optional): Filter by library name (e.g., "lib-task", "lib-energy", "lib-his")includeContent(boolean, optional): Include full section content or summaries (default: true)maxSections(number, optional): Maximum sections per document (default: 3)limit(number, optional): Maximum documents to return (default: 10)
Example 1 - Basic search:
{
"keyword": "task"
}Example 2 - Library-specific search:
{
"keyword": "hisRead",
"library": "lib-his",
"limit": 5
}Example 3 - Detailed search:
{
"keyword": "energy calculation",
"library": "lib-energy",
"includeContent": true,
"maxSections": 3,
"limit": 10
}Response Format:
{
"count": 1,
"query": "task",
"library": "lib-task",
"results": [
{
"title": "lib task",
"library": "lib-task",
"relevanceScore": 95,
"url": "file:///path/to/docs/lib-task/doc.html",
"matchedSections": [
{
"heading": "Overview",
"content": "The task extension defines a framework...",
"codeExamples": ["future: taskRun(ioReadCsv(`io/import.csv`))"]
}
],
"highlights": ["...task extension defines a framework..."]
}
]
}Performance:
- First run: ~30-60 seconds to index 4,187 HTML files
- Subsequent runs: <1 second (loads from cache)
- Search time: <50ms for most queries
List all available categories with the count of functions in each.
Parameters: None
Returns: Categories with function counts
Retrieve a specific Axon function by ID or name.
Parameters:
identifier(string, required): Function ID or name
Example:
{
"identifier": "meterOccUsage"
}Retrieve a curated Axon pattern by ID or search keyword.
Parameters:
patternId(string, optional): Pattern ID (e.g., "energy-consumption-total")keyword(string, optional): Search keyword ifpatternIdnot provided
Example:
{
"patternId": "energy-consumption-total"
}List all available patterns or filter by category prefix.
Parameters:
category(string, optional): e.g., "energy", "hvac", "meter"
Example:
{
"category": "hvac"
}Find all places where a specific function is called in the codebase.
Note: This tool searches for function calls only (e.g., readAll(), commit()), not operators (e.g., >=, ==, +). To search for operator usage, use searchAxonExamples with the operator as a keyword.
Parameters:
functionName(string, required): Name of the function to search forincludeContext(boolean, optional): Include surrounding code context (default: true)limit(number, optional): Maximum results to return (default: 20)
Example:
{
"functionName": "commit",
"limit": 10
}For operators, use searchAxonExamples instead:
{
"tool": "searchAxonExamples",
"arguments": {
"keyword": ">=",
"limit": 5
}
}Get real-world examples of how a function is used.
Parameters:
functionName(string, required): Function namemaxExamples(number, optional): Number of examples (default: 5)sortBy(string, optional): How to sort examples ("relevance", "complexity", "file")
Example:
{
"functionName": "hisRead",
"maxExamples": 3
}Show what functions call this function and what it calls.
Parameters:
functionName(string, required): Function namedepth(number, optional): How many levels deep to traverse (default: 1)
Example:
{
"functionName": "readAll",
"depth": 2
}Get statistics about function usage in the codebase.
Parameters: None
Returns: Statistics including:
- Total functions and usages
- Unused functions
- Most used functions
- Builtin vs user-defined function counts
Search Axon code using regular expressions with context lines.
Parameters:
pattern(string, required): Regular expression patterncontextLines(number, optional): Number of context lines before/after match (default: 2)format(string, optional): Output format - "text" or "json" (default: "text")
Example:
{
"pattern": "if.*do",
"contextLines": 3,
"format": "text"
}Returns matches with context in a grep-like format:
Found 3 results.
demo/ahuOutsideDamperStuckClosed.axon
│----
│ if (mixedTemp != null) do
│ tempPeriods: ahuTempDiff(outsideTemp, mixedTemp, dates)
│----
See REGEX-SEARCH.md for detailed regex search examples.
To use this MCP server with Claude Desktop, add the following to your Claude Desktop configuration:
{
"mcpServers": {
"axon-code": {
"command": "node",
"args": ["/path/to/axon-mcp-server/dist/index.js"]
}
}
}With a custom config file:
{
"mcpServers": {
"axon-code": {
"command": "node",
"args": [
"/path/to/axon-mcp-server/dist/index.js",
"/path/to/axon-config.json"
]
}
}
}Editor plugins can copy a project's Axon functions and push one function back
through three routes under /api/ide:
| Route | Use |
|---|---|
GET /api/ide/projects |
List the projects |
GET /api/ide/projects/{instance}/{project}/functions?sync=true|false |
Export the functions (src, doc, mod, hash) |
POST /api/ide/projects/{instance}/{project}/functions/{name} |
Commit one function; 409 when it changed on the server |
Every route needs Authorization: Bearer <AXON_IDE_TOKEN>. Set
AXON_IDE_TOKEN (16 characters or more) in the server's environment. When it
is not set, the routes are off and the server logs one line that says so. The
token is always required, also when /mcp runs without auth.
Full contract: docs/api/IDE-API.md.
The MCP server uses FlexSearch to provide Algolia-quality search across your HTML documentation files. This gives you:
- ⚡ Fast Search: Sub-50ms search times for most queries
- 🎯 Relevance Ranking: Smart scoring algorithm ranks results 0-100
- 📚 Library Filtering: Search within specific libraries (lib-task, lib-energy, etc.)
- 💡 Context Awareness: Returns relevant sections with code examples
- 💾 Efficient Caching: First run indexes ~4,000 files in 30-60s, subsequent runs load in <1s
-
Initial Indexing (First Run)
- Scans all HTML files in your
docsPath - Extracts titles, sections, paragraphs, and code examples
- Builds optimized FlexSearch index with multi-field boosting
- Saves to
.cache/flexsearch-docs.jsonfor instant loading
- Scans all HTML files in your
-
Subsequent Runs
- Loads pre-built index from cache in <1 second
- Validates cache freshness (24-hour TTL by default)
- Rebuilds automatically if documentation changes
-
Search Process
- Queries across multiple fields: title (10x boost), library (5x), fullText (1x)
- Applies contextual scoring with bidirectional analysis
- Returns top results with matched sections and highlights
| Metric | Value |
|---|---|
| Documents Indexed | 4,187 HTML files |
| Index Size | ~15-25 MB (compressed) |
| Initial Build Time | 30-60 seconds |
| Cache Load Time | <1 second |
| Search Time | <50ms (avg) |
| Memory Usage | ~50-100 MB |
The FlexSearch index is automatically cached in .cache/flexsearch-docs.json:
# Clear documentation cache
rm -f .cache/flexsearch-docs.json .cache/flexsearch-metadata.json
# Clear all caches
npm run cache:clear:allCache is invalidated when:
- Documentation path changes
- Cache is older than 24 hours (configurable)
- Cache version mismatches
Slow initial indexing?
- Normal for 4,000+ files on first run
- Subsequent runs use cache (<1s)
- Disable with
"cache": { "enabled": false }in config
Search returns no results?
- Check that
docsPathis configured correctly - Verify HTML files exist in the docs directory
- Try broader search terms (e.g., "task" instead of "taskRun")
Out of memory errors?
- Reduce number of indexed files with
excludeDirsin config - Increase Node.js memory:
node --max-old-space-size=4096 dist/index.js
The MCP server also includes powerful function usage tracking capabilities that allow you to:
- Find where functions are used: Search for any function (builtin or user-defined) and see all locations where it's called
- Get real examples: Extract actual code examples showing how functions are used in practice
- Analyze call relationships: Understand which functions call others and build dependency graphs
- Identify unused code: Find functions that are defined but never used
- Learn from patterns: See the most commonly used functions and patterns
- For AI Assistants: Learn from real-world usage patterns to provide better code suggestions
- For Developers: Quickly find examples and understand function usage
- For Code Quality: Identify dead code and analyze dependencies
-
Finding how
commitis used:{ "tool": "findFunctionUsage", "arguments": { "functionName": "commit", "limit": 10 } } -
Getting examples of
hisReadusage:{ "tool": "getFunctionExamples", "arguments": { "functionName": "hisRead", "maxExamples": 5 } } -
Understanding function dependencies:
{ "tool": "getFunctionCallGraph", "arguments": { "functionName": "meterOccUsage", "depth": 2 } }
The server categorizes Axon functions into the following domains:
- HVAC: Air handling, VAV control, temperature control
- Energy: kWh consumption, demand monitoring, cost calculations
- Meter: Meter reading, validation, and analysis
- Spark Analysis: Fault detection and diagnostics
- Reporting: Email reports, summaries, dashboards
- Admin: System administration and monitoring
- Sensor: Sensor data processing and validation
- Control: Control sequences and setpoint management
- Data Analysis: Historical data analysis and trends
- Utilities: Helper functions and tools
// Search for VAV control examples
{
"tool": "searchAxonExamples",
"arguments": {
"keyword": "vav",
"category": "hvac"
}
}// Search for energy cost calculations
{
"tool": "searchAxonExamples",
"arguments": {
"keyword": "cost",
"category": "energy"
}
}// Get the siteReport function
{
"tool": "getAxonExample",
"arguments": {
"identifier": "siteReport"
}
}Beyond code examples, the server ships a library of workflow guides —
battle-tested, step-by-step playbooks for common SkySpark/Axon tasks. They live
as Markdown in workflows/ and are exposed to AI assistants as
both MCP tools and workflow:// resources.
Included guides:
| Workflow | What it covers |
|---|---|
axon-func-update |
Commit/upsert Axon functions without leaving duplicate folio records |
axon-lang-information |
Axon syntax gotchas reference (no while/ternary/elvis, unit arithmetic, do…end) |
curRule-computed-points |
Build curRule + defcomp computed curVal points with history |
spark-rule-creation |
Author FDD spark rules |
app-creation |
Build SkySpark apps/views |
recform-template-design |
Design record-form templates |
html-email-skyspark |
SkySpark-native HTML email notifications |
task-subscriber-permissions |
obsCurVals/obsSchedule tasks and the host-user permission model |
job-status-check |
Inspect job/task run status |
visualytik-mcp-authoring |
Author Visualytik dashboards (.viz/.anim artifacts, SVG, logic graphs) |
listWorkflows— list every loaded workflow with a short summary (id, title, category, tags). Cheap discovery surface.searchWorkflows— search by keyword/category/tag and semantic (vector) similarity; returns a relevance score.getWorkflowSummary— fetch the cached summary for one workflow by id.workflow://<id>resources — the full Markdown content on demand.
Enhancements:
- Auto-registration — drop a new
*.mdintoworkflows/and it's loaded live (viafs.watch); no restart needed. - AI-generated summaries — each workflow gets a concise, cached summary so discovery stays cheap on tokens.
- Vector search — workflows are embedded into a local vector index (LanceDB) for semantic
searchWorkflows. - Editable — workflow Markdown can be updated through the admin API / dashboard and persists back to disk.
A companion VSCode extension (Axon VSCode) provides an
IDE surface for the MCP server: a sidebar for project selection, quick dashboard
access, and a status bar showing the active SkySpark project and connection
state. AI assistants (Claude Code, Cline, etc.) talk to the MCP server directly;
the extension is the convenience UI around it.
Commands (Command Palette → "Axon: …"):
| Command | Description |
|---|---|
Axon: Switch Project |
Select the active SkySpark project |
Axon: Search Code Examples |
Search Axon .axon examples |
Axon: Search Documentation |
Search the FlexSearch docs index |
Axon: Open MCP Explorer |
Browse server tools/resources |
Axon: Open Dashboard |
Open the admin dashboard in a browser |
Axon: Connect to MCP Server / Check Connection Status |
Manage/inspect the connection |
Axon: Sync Functions from SkySpark |
Pull functions for offline search |
Axon: Clear Server Caches · View MCP Server Logs |
Maintenance |
Build & install (.vsix):
cd vscode-extension
npm install
npm run compile # webpack production build
npm run package # produces axon-vscode-<version>.vsix (vsce)
# then in VSCode: Extensions ▸ … ▸ "Install from VSIX…"
# or from the CLI:
code --install-extension axon-vscode-*.vsixRequires VSCode ^1.84.0 and a running Axon MCP Server (npm start from the
project root). See vscode-extension/README.md
for details.
axon-mcp-server/
├── src/
│ ├── index.ts # Main server implementation
│ ├── scanner/ # File scanning utilities
│ │ ├── fileScanner.ts # HTML & Axon file scanner
│ │ └── axonUsageScanner.ts # AxonUsage.html parser
│ ├── parser/ # Code & documentation parsing
│ │ ├── axonParser.ts # Axon code parser
│ │ ├── htmlDocParser.ts # HTML documentation parser (FlexSearch)
│ │ └── enhancedAxonParser.ts
│ ├── search/ # Search implementations
│ │ ├── searchIndex.ts # Token-based code search
│ │ ├── flexSearchIndex.ts # FlexSearch documentation index
│ │ ├── operatorIndex.ts # Operator usage index
│ │ └── functionUsageIndex.ts # Function call tracking
│ ├── types/ # TypeScript type definitions
│ │ ├── index.ts # Core types
│ │ └── documentation.ts # FlexSearch types
│ ├── cache/ # Caching system
│ │ └── cacheManager.ts # Index caching & persistence
│ └── patterns/ # Curated Axon patterns
├── .cache/ # Cached indexes
│ ├── axon-index.json # Code function index
│ ├── flexsearch-docs.json # FlexSearch documentation index
│ └── function-usage.json # Function usage index
├── dist/ # Compiled JavaScript
├── package.json
├── tsconfig.json
└── README.md
- New Categories: Add to
AxonCategoryenum insrc/types/index.ts - Better Parsing: Enhance
src/parser/axonParser.ts - New Tools: Add tool definitions in
src/index.ts
# Run tests
npm testReleases are automated with release-please using Conventional Commits:
fix: …→ patch release (x.y.z)feat: …→ minor release (x.y.0)feat!: …/BREAKING CHANGE:→ major release (x.0.0)
How it works: on every push to main, release-please opens/updates a release PR that bumps package.json and updates CHANGELOG.md. Merging that PR tags the version and publishes a GitHub Release; CI then builds the project, zips a runnable bundle (dist/, prisma/, scripts/, package.json, templates, docs), and attaches it as axon-mcp-server-vX.Y.Z.zip. See .github/workflows/.
# Download axon-mcp-server-vX.Y.Z.zip from the GitHub Releases page, then:
unzip axon-mcp-server-vX.Y.Z.zip && cd axon-mcp-server-vX.Y.Z
npm ci --omit=dev
npx prisma migrate deploy # initialize the SQLite database
cp config/skyspark.example.json config/local-skyspark.json # then edit credentials
node dist/index.js # stdio mode (or: MCP_TRANSPORT=http node dist/index.js)This project is source-available, licensed under the Project Sandstar
Source-Available License (PSSL) v1.1 — see LICENSE.
Copyright (c) 2026 Anka Labs, Inc. Licensed under the Project Sandstar Source-Available License (PSSL v1.1).
Project Sandstar integrates the Sedona Framework and Project Haystack, which are independent open-source projects.
This is not an OSI open-source license. You may study, modify, and deploy the software free of charge for Qualifying Use (where it exclusively consumes Sandstar-Origin Data). Any use that consumes non-Sandstar data — directly or via a gateway/Haystack server — requires a commercial license. See the LICENSE file for the full terms and the "Packet Test", or contact licensing@ankalabs.com.
Contributions are welcome! Please submit pull requests with:
- New Axon examples
- Improved categorization
- Better parsing algorithms
- Additional tools