MCP Fantom
Fantom Documentation, Semantic Code Search, and SkySpark Migration
Teach your AI assistant Fantom -- and hand it the keys to your SkySpark 4.0 migration.
MCP Fantom indexes Fantom documentation from fantom.org, your local .fan pods, and Haxall workflows into a single searchable surface. It runs semantic code search across thousands of types and methods, analyzes call graphs with community detection, and -- uniquely -- automates the SkySpark 3.x to 4.0 migration: rewriting using statements, converting Axon strings, generating Xeto files, validating with the Fantom compiler, and taking a Git backup tag on the way in.
If the migration breaks, roll back with one tool call. The whole journey is diffable, reversible, and narrated.
Why It Exists
SkySpark 4.0 changed the extension format. Hand-migrating a real-world extension or connector is a slog of using rewrites, Axon-string conversions, and brand-new Xeto library files -- with a compiler that bites back the moment you miss a line. MCP Fantom turns that work into an assistant-driven workflow that knows the rules, runs the checks, and can undo itself.
Who It's For
- Extension authors migrating SkySpark 3.x pods to 4.0
- Haxall integrators building connectors, functions, and apps in Fantom
- AI-assisted developers who need accurate Fantom context, not hallucinated syntax
Migration Cockpit
Migrate SkySpark 3 to 4 without the hand-cramps
One tool rewrites your extension. Another commits it. A third rolls it back. Every change is diffable, the compiler verifies, Git keeps the safety net.
fan compile. Rollback available via rollbackMigration until commitMigration is called.
Lazy Indexing
The server answers before the index finishes
Most search servers block the client for 30 to 60 seconds on first boot while they index. MCP Fantom boots in under a second. Tools respond immediately -- FlexSearch warms up first, local pods next, embeddings after. The assistant never waits.
Queries degrade transparently. If embeddings are not ready, semantic tools fall back to keyword search. The assistant gets an answer with a note about fidelity, not a timeout.
Code Intelligence
Semantic understanding, not just text match
semanticCodeSearch and findSimilarCode embed your Fantom code into a vector space. Ask for "functions that normalize units" and get results that share structure, not keywords.
Graphology with Louvain clustering finds the natural communities in your codebase -- which types hang together, which ones do not. getCodeImpact traces how a change propagates. getCallers and getCallees round out the call-graph surface.
Migration Safety
Every migration is one undo away
migrateSkySpark4x creates a Git tag before it writes a single byte. If anything fails -- compiler error, validation mismatch, your intuition -- rollbackMigration restores the repo to the exact state before the run.
commitMigration is deliberate. Nothing is merged into your working history until you accept the output. Until then, the migration lives on a branch, with a backup tag, ready to discard.
using rewrites + Axon conversion + Xeto generation.migrateSkySpark4x was called.Guided Workflows
Beyond tools -- readable guides
MCP resources are markdown documents the assistant can read on demand. MCP Fantom ships four: a pod scaffolder, a fanr publishing guide, a Haxall extension walkthrough, and a fant unit-testing primer.
When a developer asks "how do I start?", the assistant pulls the right resource, summarizes, and proceeds. Every workflow is versioned alongside the server.
- ✓ Step-by-step markdown
- ✓ Discoverable via
resources/list - ✓ Versioned with the server
- ✓ Easy to add more
Tech Stack
Architecture
Capabilities
- 20+ MCP tools -- across documentation search, semantic code search, call-graph analysis, code generation, and migration automation
- Lazy indexing -- the server boots in seconds and responds immediately; indexing happens in the background and tools degrade gracefully while it runs
- Semantic search -- LanceDB plus HuggingFace Transformers embeddings for "find similar code" and cross-modal queries
- Call graph + community detection -- Graphology and Louvain surface natural clusters in large Fantom codebases
- SkySpark 4.x migration -- automated rewrite of
usingstatements, Axon strings, and Xeto file generation (lib.trio,funcs.xeto,lib.xeto), compiler validation, Git backup tag - Rollback -- restore from the auto-created Git tag if migration output fails checks
- 4 workflow resources --
create-pod,use-fanr,haxall-basics,unit-testing - Dual transport -- stdio and HTTP with OAuth
Tool Surface (Partial)
searchFantomDocs, getFantomType, listFantomPods, refreshIndex, searchFantomCode, getFantomFunction, generateFantomCode, validateFantomCode, migrateSkySpark4x, commitMigration, rollbackMigration, semanticCodeSearch, findSimilarCode, getCallers, getCallees, getCodeImpact, plus project and instance management.
Requirements
- Node.js 18+
- Local Fantom and Haxall toolchain for migration compiler validation
- Git repository for migration backups
Interested in this project?
Explore the source code, contribute, or get in touch.