One Codebase. REST for Humans, MCP for AI Agents. Laravel Restify turns your Eloquent models into both JSON:API endpoints and MCP servers -- automatically. Build once, and instantly serve APIs that work seamlessly for developers, apps, and AI agents. Traditional API development requires separate implementations for different consumers. Laravel Restify changes that: - Humans get full-featured JS
Add this skill
npx mdskills install BinarCode/laravel-restifyComprehensive Laravel package generating both JSON:API endpoints and MCP servers from one codebase
1<p align="center"><img src="/docs-v2/static/logo.png"></p>23<p align="center">4 <a href="https://github.com/BinarCode/laravel-restify/actions"><img src="https://github.com/BinarCode/laravel-restify/actions/workflows/tests.yml/badge.svg" alt="Build Status"></a>5 <a href="https://packagist.org/packages/binaryk/laravel-restify"><img src="https://poser.pugx.org/binaryk/laravel-restify/d/total.svg" alt="Total Downloads"></a>6 <a href="https://packagist.org/packages/binaryk/laravel-restify"><img src="https://poser.pugx.org/binaryk/laravel-restify/v/stable.svg" alt="Latest Stable Version"></a>7 <a href="https://packagist.org/packages/binaryk/laravel-restify"><img src="https://poser.pugx.org/binaryk/laravel-restify/license.svg" alt="License"></a>8</p>910# Unified Laravel API Layer for Humans and AI1112**One Codebase. REST for Humans, MCP for AI Agents.**1314Laravel Restify turns your Eloquent models into both JSON:API endpoints and MCP servers -- automatically. Build once, and instantly serve APIs that work seamlessly for developers, apps, and AI agents.1516## 🚀 The Power of One Codebase1718Traditional API development requires separate implementations for different consumers. Laravel Restify changes that:1920- **👥 Humans** get full-featured JSON:API endpoints21- **🤖 AI Agents** get structured MCP (Model Context Protocol) servers22- **🔒 Same Rules** - All authentication, authorization, and policies apply to both23- **📝 One Definition** - Write your repository once, serve everywhere2425## Key Features2627- **JSON:API Endpoints** - Full [JSON:API](https://jsonapi.org) specification compliance28- **MCP Server Generation** - Automatic AI agent interfaces with tool definitions29- **Unified Authorization** - Laravel policies protect both human and AI access30- **Search & Filtering** - Powerful query capabilities for all consumers31- **Authentication** - Laravel Sanctum integration for secure access32- **GraphQL Support** - Auto-generated GraphQL schemas33- **Field Validation** - Consistent validation rules across all interfaces3435## Installation3637```bash38composer require binaryk/laravel-restify39```4041## Quick Start4243**1. Setup the package:**44```bash45php artisan restify:setup46```4748**2. Create your first repository:**49```bash50php artisan restify:repository PostRepository --all51```5253**3. Enable MCP for AI agents (optional):**5455Add to your `config/ai.php`:56```php57use Binaryk\LaravelRestify\MCP\RestifyServer;58use Laravel\Mcp\Facades\Mcp;5960Mcp::web('restify', RestifyServer::class)61 ->middleware(['auth:sanctum'])62 ->name('mcp.restify');63```6465**That's it!** Your API now serves both:6667**For Humans (JSON:API):**68```bash69GET /api/restify/posts70POST /api/restify/posts71PUT /api/restify/posts/172DELETE /api/restify/posts/173```7475**For AI Agents (MCP):**76```bash77GET /mcp/restify # Tool definitions and capabilities78```7980## Example Repository8182```php83use Binaryk\LaravelRestify\Http\Requests\RestifyRequest;84use Binaryk\LaravelRestify\Repositories\Repository;85use Binaryk\LaravelRestify\Attributes\Model;8687#[Model(Post::class)]88class PostRepository extends Repository89{90 public function fields(RestifyRequest $request): array91 {92 return [93 field('title')->rules('required', 'string', 'max:255'),94 textarea('content')->rules('required'),95 field('author')->readonly(),96 datetime('published_at')->nullable(),97 ];98 }99}100```101102This single definition automatically provides:103- ✅ JSON:API CRUD endpoints with validation104- ✅ MCP tools for AI agents with the same validation105- ✅ Authorization policies applied to both interfaces106- ✅ Search and filtering capabilities for all consumers107108## One Codebase, Two Outputs109110Here's what you get from one repository definition:111112### For Humans (JSON:API Response)113```bash114GET /api/restify/posts115```116117```json118{119 "data": [120 {121 "id": "1",122 "type": "posts",123 "attributes": {124 "title": "Laravel Restify Guide",125 "content": "Build APIs fast...",126 "published_at": "2024-01-15"127 }128 }129 ],130 "links": {131 "self": "/api/restify/posts",132 "next": "/api/restify/posts?page=2"133 }134}135```136137### For AI Agents (MCP Tool Definition)138```bash139GET /mcp/restify # Tool definitions for AI agents140```141142```json143{144 "tools": [145 {146 "name": "posts-index-tool",147 "description": "Retrieve a paginated list of Post records from the posts repository with filtering, sorting, and search capabilities.",148 "inputSchema": {149 "type": "object",150 "properties": {151 "page": {152 "type": "number",153 "description": "Page number for pagination"154 },155 "perPage": {156 "type": "number",157 "description": "Number of posts per page"158 },159 "search": {160 "type": "string",161 "description": "Search term to filter posts by title or content"162 },163 "sort": {164 "type": "string",165 "description": "Sorting criteria (e.g., sort=title or sort=-published_at for descending)"166 },167 "title": {168 "type": "string",169 "description": "Filter by exact match for title (e.g., title=Laravel). Accepts negation with -title=value"170 },171 "published_at": {172 "type": "string",173 "description": "Filter by publication date (e.g., published_at=2024-01-15)"174 }175 }176 }177 }178 ]179}180```181182**All generated from this simple repository:**183```php184#[Model(Post::class)]185class PostRepository extends Repository186{187 use HasMcpTools;188189 public function fields(RestifyRequest $request): array190 {191 return [192 field('title')->required()->matchable(),193 field('content'),194 field('published_at')->rules('date')->matchable(),195 ];196 }197}198```199200## Restify Boost201202**Laravel Restify Boost** is a development companion that provides MCP server capabilities to help you build Restify APIs faster with AI assistance.203204**Repository:** [laravel-restify-boost](https://github.com/BinarCode/laravel-restify-boost)205206**Features:**207- Documentation access for AI agents208- Repository and action generation assistance209- Code examples and best practices210- Integration with Claude Desktop and other AI tools211212**Installation:**213```bash214composer require --dev binarcode/laravel-restify-boost215```216217## Templates218219Need a production-ready starting point? Check out [Restify Templates](https://restifytemplates.com) for complete API starter kits with authentication, permissions, and team management.220221## Resources222223- **[Documentation](https://laravel-restify.com)** - Complete guides and API reference224- **[Demo Repository](https://github.com/BinarCode/restify-demo)** - Working example225- **[Video Course](https://www.binarcode.com/learn/restify)** - Visual learning resource226227## Testing228229```bash230composer test231```232233## Contributing234235Please see [CONTRIBUTING](CONTRIBUTING.md) for details.236237## Security238239If you discover any security related issues, please email eduard.lupacescu@binarcode.com instead of using the issue tracker.240241## Credits242243- [Eduard Lupacescu](https://twitter.com/LupacescuEuard)244- [Koen Koenster](https://github.com/Koenster)245- [All Contributors](../../contributors)246247## License248249The MIT License (MIT). Please see [License File](LICENSE.md) for more information.250
Full transparency — inspect the skill content before installing.