Open Source Laravel Package

Build APIs for Humans & AI Agents via MCP

Transform your Laravel Eloquent models into JSON:API compliant endpoints and MCP servers automatically. No boilerplate, just results.

composer require binaryk/laravel-restify
// Create a repository
class PostRepository extends Repository
{
    public static string $model = Post::class;
}
// Enable MCP server for AI agents
Mcp::web('restify', RestifyServer::class);
// That's it! Your API is ready
// GET /api/restify/posts
// POST /api/restify/posts
// + MCP tools for AI agents
One Codebase, Two Outputs

Write your models once, get both REST APIs for humans and MCP servers for AI agents automatically.

Laravel Models

Your existing Eloquent models

#[Model(Post::class)]
class PostRepository extends Repository
{
    use HasMcpTools;

    public function fields(): array
    {
        return [
            field('title')->required(),
            field('content'),
            field('published_at'),
        ];
    }
}

REST API

For humans & applications

GET  /api/restify/posts
POST /api/restify/posts
PATCH /api/restify/posts/{id}
DELETE /api/restify/posts/{id}
🤖

MCP Server

For AI agents

tools/call:
  posts-index-tool
  posts-create-tool
  posts-update-tool
  posts-delete-tool

Key Features

Everything you need to build modern APIs

JSON:API Compliant

Automatically generate endpoints that follow JSON:API specifications with proper relationships, pagination, and filtering.

{
  "data": {
    "id": "1",
    "type": "posts",
    "attributes": {
      "title": "Laravel Restify"
    }
  },
  "relationships": {
    "author": {
      "data": {"id": "1", "type": "users"}
    }
  }
}

Policy-Based Authorization

Leverage Laravel's built-in authorization system with policies for fine-grained access control on every endpoint.

class PostPolicy
{
    public function index(User $user): bool
    {
        return $user->can('view posts');
    }

    public function show(User $user, Post
$post): bool
    {
        return $user->id === $post->user_id;
    }
}

Advanced Filtering

Built-in support for complex queries, sorting, filtering, and search across relationships without extra configuration.

GET /api/restify/posts?filter[title]=Laravel
&filter[status]=published
&sort=-created_at
&include=author,comments

MCP Server Support

Generate Model Context Protocol servers for AI agents to interact with your APIs using structured data exchange.

use Binaryk\LaravelRestify\MCP\RestifyServer;
use Laravel\Mcp\Facades\Mcp;

// Web-based MCP server with authentication
Mcp::web('restify', RestifyServer::class)
    ->middleware(['auth:sanctum'])
    ->name('mcp.restify');

Zero Configuration

Get started in minutes. Just create a repository class and you're ready to go with a fully functional API.

class UserRepository extends Repository
{
    public static string $model = User::class;

    // That's it! Your API is ready
}

Laravel Ecosystem

Built specifically for Laravel, leveraging Eloquent ORM, Service Container, and all Laravel conventions you know and love.

// Works with your existing Laravel app
Route::middleware('auth:sanctum')
    ->group(function () {
        Route::restify();
    });
});

Join the Community

Laravel Restify is open source and community-driven. Get help, contribute, and help shape the future of API development in Laravel.

Open Source

MIT licensed and fully open source

Star on GitHub

Documentation

Comprehensive guides and API reference

Read Docs

Discussions

Get help and share your experience

Join Discussion
B

BinarCode

Maintained by the BinarCode team

Visit Website

Ready to build amazing APIs?

Get started with Laravel Restify today and transform how you build APIs.