Download the PHP package he426100/php-mcp-server without Composer

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

PHP MCP Server

English Version

这是一个基于 PHP 实现的 MCP (Model Control Protocol) 服务器框架,支持通过注解优雅地定义 MCP 服务。

项目概述

本项目提供了一个完整的 MCP 服务器实现,特色功能:

系统要求

快速开始

安装

关于 Swow 扩展的详细安装说明,请参考 Swow 官方文档

运行示例服务器

通用命令参数

Parameter Description Default Value Options
--transport Transport type stdio stdio, sse
--port Port to listen on for SSE 8000

注解使用指南

本框架提供三种核心注解用于定义 MCP 服务:

1. Tool 注解

用于定义工具类处理器:

2. Prompt 注解

用于定义提示模板处理器:

3. Resource 注解

用于定义资源处理器:

创建自定义服务

  1. 创建服务类:

  2. 创建命令类:

注解参数说明

Tool 注解参数

参数 类型 说明 必填
name string 工具名称
description string 工具描述
parameters array 参数定义

Prompt 注解参数

参数 类型 说明 必填
name string 提示模板名称
description string 提示模板描述
arguments array 参数定义

Resource 注解参数

参数 类型 说明 必填
uri string 资源URI
name string 资源名称
description string 资源描述
mimeType string MIME类型

注解函数返回类型说明

Tool 注解函数支持的返回类型

返回类型 说明 转换结果
TextContent/ImageContent/EmbeddedResource 直接返回内容对象 原样保留
TextContent/ImageContent/EmbeddedResource 数组 内容对象数组 原样保留
ResourceContents 资源内容对象 转换为 EmbeddedResource
字符串或标量类型 如 string、int、float、bool 转换为 TextContent
null 空值 转换为空字符串的 TextContent
数组或对象 复杂数据结构 转换为 JSON 格式的 TextContent

Prompt 注解函数支持的返回类型

返回类型 说明 转换结果
PromptMessage 消息对象 原样保留
PromptMessage 数组 消息对象数组 原样保留
Content 对象 TextContent/ImageContent 等 转换为用户角色的 PromptMessage
字符串或标量类型 如 string、int、float、bool 转换为带 TextContent 的用户消息
null 空值 转换为空内容的用户消息
数组或对象 复杂数据结构 转换为 JSON 格式的用户消息

Resource 注解函数支持的返回类型

返回类型 说明 转换结果
TextResourceContents/BlobResourceContents 资源内容对象 原样保留
ResourceContents 数组 资源内容对象数组 原样保留
字符串或可转字符串对象 文本内容 根据 MIME 类型转换为对应资源内容
null 空值 转换为空的 TextResourceContents
数组或对象 复杂数据结构 转换为 JSON 格式的资源内容

注意事项:

日志配置

服务器日志默认保存在 runtime/server_log.txt,可通过继承 AbstractMcpServerCommand 修改:

Docker 支持

构建并运行容器:

sse地址:http://127.0.0.1:8000/sse

通过 CPX 使用

您可以通过 CPX (Composer Package Executor) 直接运行本项目,无需事先安装:

前提条件

  1. 全局安装 CPX:

  2. 确保 Composer 的全局 bin 目录在您的 PATH 中

使用方式

许可证

MIT License

贡献

欢迎提交 Issue 和 Pull Request。

作者

he426100
logiscape


All versions of php-mcp-server with dependencies

PHP Build Version
Package Version
Requires he426100/mcp-sdk-php Version ^1.1
chrome-php/chrome Version ^1.13
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 he426100/php-mcp-server contains the following files

Loading the files please wait ....