Download the PHP package organiseyou/mcp-server without Composer

On this page you can find all versions of the php package organiseyou/mcp-server. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package mcp-server

Laravel MCP

A Model Context Protocol (MCP) server for Laravel built around runtime tool registration. Tools are registered programmatically at request time rather than declared upfront as static classes, making this package the right choice when your tool surface is dynamic — multi-tenant platforms, schema-driven APIs, feature-flagged environments, or anything else where you don't know your tools at boot time.

If your tools are static and known at boot time, laravel/mcp (the official first-party package) is likely the better fit.

Requirements

Installation

The service provider and Mcp facade are registered automatically via Laravel's package discovery.

Publish the config file:

Configuration

config/mcp.php:

Registering Tools

Inline via the Mcp facade (dynamic)

Register tools anywhere that runs before the request is handled — a service provider, middleware, or a tenant boot hook:

A multi-tenant example where tools are generated from tenant configuration:

Class-based tools (static)

For tools that are the same across all tenants or contexts, implement OrganiseYou\McpServer\Contracts\McpTool and register the class in config/mcp.php:

Tools are resolved from the Laravel container, so constructor dependencies are injected automatically.

Tool context

A tool receives a ToolContext as its second argument only when it declares one. One-argument tools are called exactly as before.

Class tools can add an optional parameter: public function __invoke(array $input, ?ToolContext $context = null): mixed.

The package never reads tenants or users itself. Supply the context by binding it in the container, for example from middleware or a service provider. Use scoped() so it is rebuilt per request:

If nothing is bound, tools get an empty context. The JSON-RPC id fills requestId unless your bound context already sets one.

Reporting tool errors

Throw ToolError for expected failures. The call returns isError: true with a JSON body, so the client can tell "you may not do this" from "the server is broken":

Any other exception is still returned as a JSON-RPC error.

Annotations

Declare tool annotations so clients can tell reads from writes. They appear in tools/list only for tools that set them. The package adds no defaults.

Class tools: add a public function annotations(): array method.

Supported keys: readOnlyHint, destructiveHint, idempotentHint, openWorldHint.

Calling tools in-process

McpServer::callTool() runs a tool without HTTP or JSON-RPC. It returns the same array as tools/call:

Long-lived workers

The registry, server and transports are bound with scoped(). Under Octane or in a queue worker, each request starts with an empty registry (plus the class tools from config), so tools registered for one tenant never leak into the next request.

Logging

Logging is off by default. Enable it in .env:

Or publish the config (php artisan vendor:publish --tag=mcp-config) and set:

To keep secrets out of the logged tool input, set redact to a callable or an invokable class name. It receives the input and returns the copy to log. The tool itself still gets the original input. Use a class name if you run config:cache, because closures can't be cached.

When enabled, the following is logged automatically:

Event Message Context keys
Request received MCP request method, id
Request completed MCP response method, id, duration_ms
Tool invoked MCP tool call tool, input
Tool returned MCP tool result tool, duration_ms
Tool threw ToolError MCP tool error tool, reason, message
Any error MCP error code, message, id

Errors always log at warning level regardless of MCP_LOG_LEVEL.

Logging inside tools

Class-based tools — inject McpLogger and call logActivity():

logActivity() respects the same channel, level, and any extended context (e.g. tenant ID) as the rest of the logger.

Closure-based tools — use Laravel's Log facade directly:

Multi-tenant: adding tenant context to every log entry

Extend McpLogger, override context(), and rebind the singleton:

Every log entry — from the server, from tool calls, and from logActivity() inside your tools — will automatically include tenant_id. No changes required to individual tools.

Transports

HTTP (default)

When mcp.transport.http is true, the package registers a POST /mcp route. Any MCP client that supports HTTP can point to https://your-app.test/mcp.

To secure the endpoint, add middleware in config/mcp.php:

Stdio (Claude Desktop / local clients)

Run the artisan command to start an stdio MCP server:

Add it to your claude_desktop_config.json:

Protocol

The server speaks JSON-RPC 2.0 and supports MCP protocol versions 2025-03-26 and 2024-11-05. On initialize it echoes the client's version if it supports it, and otherwise offers 2025-03-26. Supported methods:

Method Description
initialize Handshake, returns server info and capabilities
ping Health check
tools/list List all registered tools
tools/call Invoke a tool by name

Example HTTP request

Calling a tool:

Batch requests are also supported — send an array of JSON-RPC objects and receive an array of responses.

Testing

Or with Docker (no local PHP required):

License

MIT


All versions of mcp-server with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
laravel/framework Version ^11.0|^12.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package organiseyou/mcp-server contains the following files

Loading the files please wait ...