This guide explains how to integrate AI coding assistants with the Wheels framework for enhanced development productivity.
- Overview
- Available Endpoints
- MCP Server Setup
- Tool-Specific Integration
- Best Practices
- Troubleshooting
Wheels provides multiple integration points for AI coding assistants:
- JSON API Endpoints - RESTful endpoints serving documentation in JSON format
- MCP Server - Model Context Protocol server for deep IDE integration
- CLAUDE.md Files - Static documentation automatically loaded by Claude Code
- Project Context API - Dynamic project analysis endpoints
All endpoints require the Wheels development server to be running (wheels server start).
GET /wheels/ai
Returns comprehensive documentation optimized for AI consumption.
Parameters:
context- Filter documentation by context (all, model, controller, view, migration, routing, testing)format- Response format (json)
Example:
curl http://localhost:60000/wheels/ai?context=modelGET /wheels/ai?mode=manifest
Returns a manifest of available documentation chunks with descriptions and endpoints.
Example Response:
{
"chunks": [
{
"id": "models",
"name": "Model Documentation",
"endpoint": "/wheels/ai?mode=chunk&id=models",
"contexts": ["model", "database", "validation"]
}
]
}GET /wheels/ai?mode=project
Analyzes and returns current project structure including:
- Existing models and controllers
- Database configuration
- Migration status
- Installed plugins
- Detected conventions
GET /wheels/ai?mode=chunk&id={chunkId}
Returns specific documentation chunks for focused assistance.
Available Chunk IDs:
models- Model documentation and patternscontrollers- Controller documentation and RESTful patternsviews- View helpers and templatingmigrations- Database migration documentationrouting- URL routing and resourcestesting- Testing framework documentationcli- Command-line interface referencepatterns- Common implementation patterns
GET /wheels/ai?mode=info
Returns comprehensive system configuration including:
- Server and framework versions
- Environment settings
- CSRF and CORS configuration
- Database configuration
- Framework settings
GET /wheels/ai?mode=routes
Returns complete routing table including:
- Application routes
- Internal framework routes
- Route patterns and methods
- Named routes and RESTful resources
GET /wheels/ai?mode=migrations
Returns database migration information:
- Current migration version
- Available migrations
- Migration status (migrated/pending)
- Migration files and details
GET /wheels/ai?mode=plugins
Returns plugin ecosystem details:
- Loaded plugins and metadata
- Incompatible plugins
- Plugin dependencies
- Plugin configuration
These endpoints now support JSON format for AI consumption:
GET /wheels/info?format=json # System configuration
GET /wheels/routes?format=json # Application routes
GET /wheels/migrator?format=json # Migration status
GET /wheels/plugins?format=json # Plugin information
GET /wheels/tests/{type}?format=json # Test results (type: app|core)
These endpoints are also available for compatibility:
GET /wheels/api?format=json # Full API documentation
GET /wheels/guides?format=json # Framework guides
The Model Context Protocol (MCP) server enables deep integration with AI-powered IDEs.
-
Install Dependencies:
cd /path/to/wheels npm install @modelcontextprotocol/sdk -
Configure Your IDE:
Add to your Claude Code settings:
{ "mcpServers": { "wheels": { "command": "node", "args": ["/path/to/wheels/mcp-server.js"], "env": { "WHEELS_PROJECT_PATH": "${workspaceFolder}", "WHEELS_DEV_SERVER": "http://localhost:60000" } } } }Add to
.cursor/mcp.json:{ "servers": { "wheels": { "command": "node", "args": ["mcp-server.js"], "cwd": "/path/to/wheels" } } }Add to
.continue/config.json:{ "mcpServers": [ { "name": "wheels", "command": "node /path/to/wheels/mcp-server.js" } ] }
Once configured, the following resources are available:
wheels://api/documentation- Complete API documentationwheels://guides/all- All framework guideswheels://project/context- Current project analysiswheels://patterns/common- Common patterns and examples
The MCP server provides these tools:
Code Generation & Management:
wheels_generate- Generate models, controllers, scaffolds, migrationswheels_migrate- Run database migrationswheels_test- Execute testswheels_server- Manage development serverwheels_reload- Reload the application
Information & Analysis:
wheels_info- Get system configuration and environment detailswheels_routes- Inspect application routes and URL patternswheels_plugins- List and analyze installed pluginswheels_test_status- Check test execution results
Claude Code automatically loads CLAUDE.md files in your project root. The file includes:
- Quick start commands
- Framework architecture overview
- Common patterns and examples
- Links to live documentation endpoints
Best Practices:
- Keep dev server running for live documentation
- Use focused contexts when asking for help
- Reference specific files using
path:lineformat
-
Add Comments with Wheels Patterns:
// Wheels Model with validations and associations component extends="Model" { -
Reference Documentation in Comments:
// See: /wheels/ai?mode=chunk&id=models -
Use Consistent Naming:
- Models: Singular (User, Product)
- Controllers: Plural (Users, Products)
- Tables: Plural lowercase (users, products)
- Configure MCP server (see MCP Server Setup)
- Use
@wheelsto reference documentation - Enable "Include project context" for better suggestions
For custom integrations, use the JSON endpoints directly:
import requests
import json
# Get project context
response = requests.get('http://localhost:60000/wheels/ai?mode=project')
project = response.json()
# Get specific documentation
response = requests.get('http://localhost:60000/wheels/ai?mode=chunk&id=models')
model_docs = response.json()
# Use with your AI provider
from openai import OpenAI
client = OpenAI()
completion = client.chat.completions.create(
model="gpt-4",
messages=[
{"role": "system", "content": f"You are helping with a Wheels project: {json.dumps(project)}"},
{"role": "user", "content": "Help me create a User model"}
]
)DO:
- Start sessions by fetching project context
- Use focused documentation chunks for specific tasks
- Reference the manifest to discover available resources
DON'T:
- Load all documentation at once (wastes context)
- Ignore project-specific conventions
- Generate code without understanding existing patterns
DO:
- Use Wheels CLI generators when possible
- Follow detected naming conventions
- Test generated code immediately
DON'T:
- Create files manually when generators exist
- Ignore existing code style
- Skip validation and testing
Efficient Context Usage:
// Good - Focused request
GET /wheels/ai?context=model
// Bad - Loading everything
GET /wheels/api?format=json // Too much dataTask-Based Loading:
- Working on models? Load:
/wheels/ai?mode=chunk&id=models - Building APIs? Load:
/wheels/ai?context=controller - Writing migrations? Load:
/wheels/ai?mode=chunk&id=migrations
-
Start Development Server:
wheels server start
-
Check Project Context:
curl http://localhost:60000/wheels/ai?mode=project -
Load Relevant Documentation:
curl http://localhost:60000/wheels/ai?mode=manifest # Then load specific chunks as needed
-
Generate Code:
wheels g model User name:string,email:string
-
Test Changes:
wheels test run
Solution: Ensure dev server is running: wheels server start
Solution: Check Node.js version (>= 16) and install dependencies:
npm install @modelcontextprotocol/sdkSolution: Verify you're in a Wheels project directory with proper structure
Solution: Reload the application:
curl "http://localhost:60000/?reload=true&password=yourpassword"Enable debug output for troubleshooting:
# For endpoints
curl http://localhost:60000/wheels/ai?debug=true
# For MCP server
DEBUG=* node mcp-server.js- Check the main documentation:
/wheels/guides?format=json - Review common patterns:
/wheels/ai?mode=chunk&id=patterns - Analyze your project:
/wheels/ai?mode=project - Consult the Wheels community forums
Add custom chunks by extending the AI endpoint:
// In your app/controllers/Wheels.cfc
function ai() {
super.ai();
// Add custom chunk
if (request.wheels.params.id == "custom") {
local.customDocs = {
"patterns": getCustomPatterns(),
"helpers": getCustomHelpers()
};
writeOutput(serializeJSON(local.customDocs));
abort;
}
}For CI/CD integration, create webhooks that notify AI tools of changes:
// app/controllers/Webhooks.cfc
function aiNotify() {
local.changes = analyzeGitChanges();
local.notification = {
"event": "code_change",
"changes": local.changes,
"documentation": "/wheels/ai?mode=project"
};
// Notify AI service
http url="https://ai-service.example.com/webhook"
method="post"
body=serializeJSON(local.notification);
}For large projects, implement caching:
// Cache documentation for 5 minutes
function getCachedDocs(context) {
local.cacheKey = "ai_docs_#arguments.context#";
if (!cacheKeyExists(local.cacheKey)) {
local.docs = generateDocs(arguments.context);
cachePut(local.cacheKey, local.docs, createTimeSpan(0,0,5,0));
}
return cacheGet(local.cacheKey);
}To improve AI integration for Wheels:
- Test with different AI tools and report issues
- Contribute patterns and examples
- Suggest new documentation chunks
- Share integration configurations
Submit contributions to: https://github.com/wheels-dev/wheels
- 1.0.0 - Initial AI integration with JSON endpoints
- 1.1.0 - Added MCP server support
- 1.2.0 - Enhanced chunking and project context
- 1.3.0 - Added pattern library and examples
Last Updated: [Current Date] Wheels Version: 3.1.0+