Advanced Topics
MCP & AI Setup
MCP & AI Integration Setup
Set up Model Context Protocol (MCP) to work with AI assistants like Claude in your Stellify projects.
Repository
stellify-mcp - MCP server for Stellify platform integration
What is MCP?
Model Context Protocol (MCP) is a standardized way for AI assistants to interact with external systems. The Stellify MCP server allows AI assistants to:
- Read your Stellify project code
- Understand your application structure
- Create and modify files
- Execute code and see results
- Help with debugging and development
Supported AI Assistants
- Claude Desktop - Anthropic's desktop app
- Claude Code (CLI) - Command-line interface
- Any MCP-compatible client
Prerequisites
System Requirements
- Node.js 18+ or Python 3.10+
- Claude Desktop app or Claude Code CLI
- Stellify account with API access
- Active Stellify project
Generate API Token
- Log into Stellify
- Navigate to Settings → API Tokens
- Click Generate New Token
- Name it: "MCP Integration"
- Copy the token (you won't see it again)
Installation
Option 1: Node.js Installation
npm install -g @stellify/mcp-server
Or use npx (no installation):
npx @stellify/mcp-server
Option 2: Python Installation
pip install stellify-mcp
Option 3: From Source
git clone https://github.com/Stellify-Software-Ltd/stellify-mcp.git
cd stellify-mcp
npm install
npm run build
npm link
Configuration
For Claude Desktop
Edit Claude Desktop config file:
macOS:
~/Library/Application Support/Claude/claude_desktop_config.json
Windows:
%APPDATA%\Claude\claude_desktop_config.json
Linux:
~/.config/Claude/claude_desktop_config.json
Add Stellify MCP server:
{
"mcpServers": {
"stellify": {
"command": "node",
"args": [
"/path/to/stellify-mcp/build/index.js"
],
"env": {
"STELLIFY_API_TOKEN": "your_api_token_here",
"STELLIFY_PROJECT_ID": "your_project_uuid_here",
"STELLIFY_API_URL": "https://api.stellisoft.com"
}
}
}
}
Or if installed globally:
{
"mcpServers": {
"stellify": {
"command": "stellify-mcp",
"env": {
"STELLIFY_API_TOKEN": "your_api_token_here",
"STELLIFY_PROJECT_ID": "your_project_uuid_here"
}
}
}
}
For Claude Code (CLI)
Create ~/.claude/mcp_config.json:
{
"mcpServers": {
"stellify": {
"command": "stellify-mcp",
"env": {
"STELLIFY_API_TOKEN": "your_api_token_here",
"STELLIFY_PROJECT_ID": "your_project_uuid_here"
}
}
}
}
Environment Variables
Alternatively, use environment variables:
export STELLIFY_API_TOKEN="your_token"
export STELLIFY_PROJECT_ID="your_project_id"
export STELLIFY_API_URL="https://api.stellisoft.com" # Optional
Then simplified config:
{
"mcpServers": {
"stellify": {
"command": "stellify-mcp"
}
}
}
Verifying Setup
Test Connection
stellify-mcp --test
Output should show:
✓ Connected to Stellify API
✓ Project found: My Stellify App
✓ MCP server ready
In Claude Desktop
- Restart Claude Desktop
- Start a new conversation
- Type: "What files are in my Stellify project?"
- Claude should list your project files
If Claude responds with actual file names, MCP is working!
Using AI with Stellify
Basic Interactions
View Project Structure
You: Show me the structure of my Stellify project
Claude: Your project has the following structure:
- Controllers:
- UserController (5 methods)
- PostController (7 methods)
- Models:
- User
- Post
- Comment
- Routes: 15 defined routes
Read Code
You: Show me the UserController index method
Claude: Here's the index method from UserController:
public function index()
{
$users = User::all();
return view('users.index', ['users' => $users]);
}
Explain Code
You: What does the store method in PostController do?
Claude: The store method creates a new post. It:
1. Validates the request data (title, body required)
2. Associates the post with the authenticated user
3. Saves to the database
4. Redirects to the post view
Code Generation
Create New Controller
You: Create a CommentController with CRUD methods
Claude: I'll create a CommentController with standard CRUD operations...
[Claude creates the controller in Stellify with:
- index() - List all comments
- store() - Create new comment
- update() - Update comment
- destroy() - Delete comment]
Created CommentController in your Stellify project.
Generate Model
You: Create a Comment model with relationships to User and Post
Claude: I'll create a Comment model with those relationships...
[Claude creates model with:
- belongsTo(User)
- belongsTo(Post)
- fillable fields
- validation rules]
Created Comment model in your project.
Add Method to Existing Controller
You: Add a search method to UserController that filters by name
Claude: I'll add a search method...
public function search(Request $request)
{
$query = $request->input('query');
$users = User::where('name', 'LIKE', "%{$query}%")->get();
return view('users.index', ['users' => $users]);
}
Method added to UserController.
Debugging
Find Errors
You: My UserController store method isn't working. Can you help?
Claude: Let me check the store method...
I see the issue. You're calling User::create() but haven't defined $fillable on the User model. This causes a mass assignment exception.
Fix: Add this to User model:
protected $fillable = ['name', 'email', 'password'];
Review Code Quality
You: Review my UserController for best practices
Claude: I've reviewed UserController. Here are some suggestions:
1. Add validation in store method
2. Use Form Requests for complex validation
3. Add try-catch for database operations
4. Use route model binding in show/update/destroy
5. Consider adding pagination to index method
Would you like me to implement any of these?
Refactoring
Improve Code
You: Refactor UserController to use repository pattern
Claude: I'll refactor to use repository pattern...
[Claude:
1. Creates UserRepository
2. Updates controller to use repository
3. Adds dependency injection
4. Updates methods]
Refactored UserController to use UserRepository.
Add Features
You: Add email verification to the User model
Claude: I'll add email verification functionality...
[Claude:
1. Adds email verification fields to model
2. Creates verification method
3. Adds route for verification
4. Creates controller method]
Email verification added to User model and routes.
MCP Tools Available
The Stellify MCP server provides these tools to Claude:
File Operations
list_files- List all files in projectread_file- Read specific file contentcreate_file- Create new file (controller, model, etc.)update_file- Modify existing filedelete_file- Remove file
Code Operations
list_methods- List methods in a fileread_method- Get specific method codecreate_method- Add new method to fileupdate_method- Modify existing methodexecute_method- Run method and see output
Project Operations
get_routes- List all routescreate_route- Add new routeget_models- List all modelsget_project_structure- Get full project structure
Element Operations (UI)
list_elements- List UI elementscreate_element- Add new UI elementupdate_element- Modify UI element
Advanced Configuration
Multiple Projects
Connect to multiple Stellify projects:
{
"mcpServers": {
"stellify-prod": {
"command": "stellify-mcp",
"env": {
"STELLIFY_API_TOKEN": "prod_token",
"STELLIFY_PROJECT_ID": "prod_project_id"
}
},
"stellify-dev": {
"command": "stellify-mcp",
"env": {
"STELLIFY_API_TOKEN": "dev_token",
"STELLIFY_PROJECT_ID": "dev_project_id"
}
}
}
}
In Claude:
You: Using stellify-dev, show me the UserController
Custom API URL
For self-hosted Stellify:
{
"env": {
"STELLIFY_API_URL": "https://stellify.yourcompany.com/api"
}
}
Read-Only Mode
Prevent AI from making changes:
{
"env": {
"STELLIFY_READ_ONLY": "true"
}
}
Debug Mode
Enable verbose logging:
{
"env": {
"STELLIFY_DEBUG": "true",
"STELLIFY_LOG_FILE": "/tmp/stellify-mcp.log"
}
}
Workflows with AI
Workflow 1: Rapid Prototyping
- Describe feature: "Build a blog post system with comments"
- Claude creates:
- Post and Comment models
- Controllers with CRUD
- Routes
- Basic views
- Refine: "Add user authentication to posts"
- Test: Run methods in Stellify
- Deploy: Export and deploy
Workflow 2: Code Review
- Request review: "Review my entire project for security issues"
- Claude analyzes all controllers and models
- Provides feedback with specific issues
- Suggests fixes and implements if approved
- Verify: Test changes in Stellify
Workflow 3: Documentation Generation
- Request docs: "Generate README for this project"
- Claude reads all files and routes
- Creates documentation with:
- API endpoints
- Model relationships
- Setup instructions
- Export: Save documentation to project
Workflow 4: Test Writing
- Request tests: "Write tests for UserController"
- Claude creates test file with:
- Unit tests for all methods
- Mock data setup
- Assertions
- Run tests: Execute in test environment
- Fix issues: Claude helps debug failures
Troubleshooting
MCP Server Not Starting
Error: Cannot connect to Stellify API
- Check API token is correct
- Verify internet connection
- Check API URL (if custom)
Error: Project not found
- Verify project ID is correct
- Ensure project exists in your account
- Check token has access to project
Claude Can't See Project
Restart Claude Desktop:
- Quit Claude Desktop completely
- Restart the application
- MCP servers load on startup
Check Configuration:
stellify-mcp --validate-config
Permission Errors
Error: Insufficient permissions
- Regenerate API token with full access
- Check token hasn't expired
- Verify project membership
Rate Limiting
If hitting rate limits:
- Reduce request frequency
- Use caching where possible
- Contact support for limit increase
Security Best Practices
API Token Security
- Never commit tokens - Keep out of version control
- Use environment variables - Don't hardcode
- Rotate regularly - Generate new tokens periodically
- Limit scope - Use read-only when possible
Access Control
- Project-specific tokens - Don't use account-wide tokens
- Revoke unused tokens - Clean up old tokens
- Monitor usage - Check API logs for suspicious activity
Review AI Changes
- Always review - Don't blindly accept AI suggestions
- Test thoroughly - Run tests after AI modifications
- Version control - Commit changes with descriptive messages
- Rollback plan - Know how to revert if needed
Best Practices
Effective Prompts
Good Prompts:
- "Create a UserController with standard CRUD methods"
- "Add validation to the store method in PostController"
- "Refactor CommentController to use repository pattern"
Avoid:
- "Make it better" (too vague)
- "Fix everything" (too broad)
- "Do something with users" (unclear)
Iterative Development
- Start small - Build one feature at a time
- Test frequently - Verify each change works
- Iterate - Refine based on results
- Document - Keep track of changes
Collaborative AI
- Be specific - Provide context and requirements
- Ask questions - Claude can explain anything
- Request options - Ask for multiple approaches
- Learn - Use AI as a teaching tool
Examples
Example 1: Complete CRUD
You: Create a complete CRUD system for managing tasks
- Task model with title, description, due_date, completed
- TaskController with all CRUD methods
- Routes for the controller
- Add validation
Claude: [Creates everything and responds]
Created Task model with fields: title, description, due_date, completed
Created TaskController with methods: index, create, store, show, edit, update, destroy
Added routes to routes/web.php
Added validation rules to all methods
Your task management system is ready to use.
Example 2: API Development
You: Convert my UserController to a RESTful API controller
- Return JSON responses
- Add proper status codes
- Include error handling
- Add API authentication
Claude: [Converts controller]
Converted UserController to API controller:
- All methods now return JSON
- Added proper HTTP status codes (200, 201, 404, 422)
- Added try-catch blocks with error responses
- Added middleware('auth:api') for authentication
Your API is ready. Test with: GET /api/users
Example 3: Database Design
You: I need a database structure for an e-commerce site with:
- Products with categories
- Shopping cart
- Orders and order items
- User addresses
Claude: [Creates models and migrations]
Created models:
- Product (belongsTo Category, hasMany OrderItems)
- Category (hasMany Products)
- Cart (belongsTo User, hasMany CartItems)
- CartItem (belongsTo Cart, belongsTo Product)
- Order (belongsTo User, hasMany OrderItems)
- OrderItem (belongsTo Order, belongsTo Product)
- Address (belongsTo User)
Created migrations for all tables with proper foreign keys.
Relationships are properly configured.
Next Steps
- Read Code Editor Guide for manual coding
- Learn Interface Builder for UI design
- Explore Exporting Code for deployment
Ready to code with AI? Set up the stellify-mcp server and start building!
- Previous
- JavaScript Bundling