Download the PHP package llm/mcp-server without Composer

On this page you can find all versions of the php package llm/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

PHP MCP Server SDK

Latest Version on Packagist Total Downloads PHP Version

A comprehensive PHP SDK for building Model Context Protocol (MCP) servers. Create production-ready MCP servers in PHP with modern architecture, flexible transport options, and comprehensive feature support.

Table of Contents

This SDK implements the MCP 2025-03-26 specification with full backward compatibility support.

Features

What's NOT Included

This SDK focuses on core MCP functionality and intentionally does not include:

Why? These features are better implemented as separate packages or framework-specific bridges that can:

Requirements

Installation

Framework Integration

For enhanced developer experience with automatic discovery and validation:

Spiral Framework: Use the spiral/mcp-server bridge

Other Frameworks: Framework-specific bridges are planned. Contributions welcome!

Quick Start

Here's a minimal working example that demonstrates core functionality:

Expected Output: The server will listen on STDIN/STDOUT and respond to MCP requests.

To Test: Save as server.php and run php server.php, then send MCP messages via STDIN.

Core Concepts

Architecture Overview

The SDK follows a layered architecture:

Key Components

Transport Options

STDIO Transport (Recommended for CLI)

Perfect for command-line tools and process-based communication:

Use Cases: CLI tools, subprocess communication, development/testing

HTTP Transport with SSE

For web-based applications with real-time communication:

Use Cases: Web applications, browser-based clients, dashboard integrations

Streamable HTTP Transport

Advanced HTTP transport with JSON response and resumability support:

Use Cases: High-performance applications, stateless deployments, fault-tolerant systems

Working with Tools

Tools are executable functions that AI assistants can call to perform actions.

Basic Tool Registration

Advanced Tool with Multiple Content Types

Error Handling in Tools

Working with Resources

Resources provide read-only access to data that AI assistants can reference.

Static Resources

Dynamic Resource Templates

Resource templates use URI patterns to handle multiple similar resources:

Resource with Completion Providers

Working with Prompts

Prompts provide templated text generation for AI assistants.

Basic Prompt

{$language}\n{$code}\n

Advanced Prompt with Multiple Message Types

Session Management

Custom Session Handlers

Implement the SessionHandlerInterface for custom storage:

Cache-Based Session Storage

HTTP Middleware

Built-in Middleware

CORS Middleware

Authentication Middleware

Custom Middleware

Advanced Configuration

Complete Server Setup

Event Store for Resumability

Performance Optimization

Caching Strategies

Memory Management

Handler Factory Pattern

Decorator Pattern for Handlers

Class-Based Tool Handlers with Schema Mapping

For more advanced use cases with automatic schema generation and request mapping, you can create handlers that work with DTO classes:

Schema Mapper Interface:

Implementation with Valinor and spiral/json-schema-generator:

Usage Example:

Contributing

We welcome contributions! Please follow these guidelines:

Development Setup

Code Style

We follow PSR-12 coding standards:

Testing

License

The MIT License (MIT). See LICENSE for details.

Ecosystem & Extensions

Framework Bridges

Spiral Framework: spiral/mcp-server

Planned Extensions

Acknowledgments


All versions of mcp-server with dependencies

PHP Build Version
Package Version
Requires php Version >=8.3
ext-openssl Version *
php-mcp/schema Version ^1.0
psr/clock Version ^1.0
psr/container Version ^1.0 || ^2.0
psr/container-implementation Version ^1.0
psr/log Version ^1.0 || ^2.0 || ^3.0
psr/http-server-middleware Version ^1.0 || ^2.0 || ^3.0
psr/simple-cache Version ^1.0 || ^2.0 || ^3.0
react/event-loop Version ^1.5
react/http Version ^1.11
react/promise Version ^3.0
react/stream Version ^1.4
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 llm/mcp-server contains the following files

Loading the files please wait ...