agentleFS
kirschbaum-developmentkirschbaum-development/laravel-loop/CLAUDE.md

laravel-loop

CLAUDE.md132 starsChanged 11 months agoMITView on GitHub

Laravel Loop is a Model Context Protocol (MCP) server package for Laravel applications that enables AI assistants to interact with Laravel apps through multiple transport protocols (STDIO, Streamable HTTP, SSE). Uses Prism PHP for tool building. Core Components: - Loop - Main service class for managing tools/toolkits - McpHandler - Handles MCP JSON-RPC protocol messages - Tool interface - Contract for individual tools (implements Prism\Tool) - Toolkit interface - Contract for tool collections - CustomTool - Flexible tool builder for…

The file

We split this CLAUDE.md into the rules it gives an agent

2 rules. About 0 are common, 1 is distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    All classes use Makeable trait for static factory methods

    line 34
  2. Distinctive:

    Use Prism's fluent API for parameter definition and tool configuration

    line 43

≈ “Common” is an estimate: at least 1 in 5 of the 12,729 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
CLAUDE.md

CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

Laravel Loop Package

Laravel Loop is a Model Context Protocol (MCP) server package for Laravel applications that enables AI assistants to interact with Laravel apps through multiple transport protocols (STDIO, Streamable HTTP, SSE). Uses Prism PHP for tool building.

Build/Test Commands

  • Run tests: composer test
  • Code formatting: composer lint (Laravel Pint)
  • Static analysis: composer analyse (Larastan)
  • All quality checks: composer check (lint + analyse + test)
  • Run artisan commands: vendor/bin/testbench
  • MCP server (STDIO): php artisan loop:mcp:start [--user-id=1] [--debug]
  • Generate MCP config: php artisan loop:mcp:config
  • Development server: composer serve (testbench workbench)

Architecture

Core Components:

  • Loop - Main service class for managing tools/toolkits
  • McpHandler - Handles MCP JSON-RPC protocol messages
  • Tool interface - Contract for individual tools (implements Prism\Tool)
  • Toolkit interface - Contract for tool collections
  • CustomTool - Flexible tool builder for custom functionality

Transport Layer:

  • STDIO transport via Artisan command using ReactPHP event loop
  • Streamable HTTP transport (/mcp endpoint)
  • SSE transport (/mcp/sse endpoint, deprecated)

Design Patterns:

  • All classes use Makeable trait for static factory methods
  • Contract-based architecture with clear interfaces
  • ToolCollection for managing groups of tools
  • Facade pattern (Loop::tool(), Loop::toolkit())

Development Guidelines

Tool Development:

  • Tools implement Tool contract with build() and getName() methods
  • Use Prism's fluent API for parameter definition and tool configuration
  • Group related tools in Toolkits that return ToolCollection
  • Register tools in service providers using Loop::tool() or Loop::toolkit()

Code Style:

  • Uses Pest testing framework with Orchestra Testbench
  • Strict typing with declare(strict_types=1)
  • PSR-12 compliant via Laravel Pint
  • Type hints required for parameters and return types

Testing:

  • Extends Tests\TestCase (Orchestra Testbench)
  • Uses workbench setup for package development
  • Lazy database refresh for performance
  • Mock utilities for dependency injection

Security:

  • HTTP endpoints protected by Sanctum middleware by default
  • User impersonation support in STDIO mode via --user-id flag
  • Debug mode available for development
  • SSE sessions managed with file/Redis drivers

Configuration

Key config options in config/loop.php:

  • Transport enablement (LOOP_STREAMABLE_HTTP_ENABLED, LOOP_SSE_ENABLED)
  • Endpoint paths and middleware configuration
  • SSE driver selection (file/redis) with TTL settings
  • Authentication middleware (defaults to auth:sanctum)

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.