
spiral-packages/mcp-server
Developer toolsこのページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。 原文を見る
MCPの特長 スパイラルフレームワークのサーバー実装
概要
スパイラルフレームワークの強力で柔軟な実装。 このパッケージは、自動ツールの検出、属性ベースの設定、およびスパイラルの依存注入コンテナとのシームレスな統合により、完全なMCPサーバーソリューションを提供します。 ✨ - PHP 属性を使用して MCP ツールを自動的に検出し、登録します。 - HTTP をサポートし、HTTP をストリーミングし、STDIO を転送します。 - シンプルな PHP 属性でツールの動作を定義する ️️ - スパイラル/json-schema-generator ⚡ を使用して自動 JSON スキーマ生成 - リクエスト/応答処理のための拡張可能なミドルウェア システム for - スパイラルフレームワークの IoC コンテナとファーストクラスの統合 - 設定可能な TTL を使用してセッション処理を組み込む パフォーマンスの高い環境を設計 - - PHP 8.3 以上 - スパイラルフレームワーク 3.15+ - Composer スパイラル アプリケーションに bootloader を追加します。 : DTO スキーマ定義の詳細については、スパイラル/json-schema-generator をご覧ください.
概要(AI 翻訳)
スパイラルフレームワークの強力で柔軟な Model Context Protocol (MCP) Server 実装。 このパッケージ 完全なMCPサーバーソリューションを自動ツールの検出、属性ベースの設定、シームレスに提供 スパイラルの依存注入コンテナとの統合。
コンテンツの表
- 特徴
- 条件
- インストール
- クイックスタート
- 構成
- ツールの作成
- ツール属性
- ミドルウェア
- 貢献
- ライセンス
##特徴
✨自動ツールディスカバリー - PHP属性を使用してMCPツールを自動的に発見し、登録 ◀複数のトランスポートオプション - HTTP、ストリーミングHTTP、およびSTDIOトランスポートをサポート Attribute-Based Configuration* - シンプルなPHP属性でツールの動作を定義する 🛡️ Schema Validation - スパイラル/json-schema-generatorを用いた自動JSONスキーマ生成 ⚡ミドルウェアサポート - リクエスト/応答処理のための拡張可能なミドルウェアシステム 🔌 スパイラルインテグレーション - スパイラルフレームワークのIoCコンテナとのファーストクラスの統合 セッション管理* - 設定可能なTTLでセッション処理を内蔵 生産準備完了** - 高性能の生産環境のために設計
このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。
README
以下は原文 README の抜粋です。原文を見る。
Spiral MCP Server
A powerful and flexible Model Context Protocol (MCP) Server implementation for the Spiral Framework. This package provides a complete MCP server solution with automatic tool discovery, attribute-based configuration, and seamless integration with Spiral’s dependency injection container.
Table of Contents
- Features
- Requirements
- Installation
- Quick Start
- Configuration
- Creating Tools
- Tool Attributes
- Middleware
- Contributing
- License
Features
✨ Automatic Tool Discovery - Automatically discovers and registers MCP tools using PHP attributes
🔧 Multiple Transport Options - Supports HTTP, streaming HTTP, and STDIO transports
🎯 Attribute-Based Configuration - Define tool behavior with simple PHP attributes
🛡️ Schema Validation - Automatic JSON schema generation using spiral/json-schema-generator
⚡ Middleware Support - Extensible middleware system for request/response processing
🔌 Spiral Integration - First-class integration with Spiral Framework’s IoC container
📊 Session Management - Built-in session handling with configurable TTL
🚀 Production Ready - Designed for high-performance production environments
Requirements
- PHP 8.3 or higher
- Spiral Framework 3.15+
- Composer
Installation
Install the package via Composer:
composer require spiral/mcp-server
Add the bootloader to your Spiral application:
// app/src/Application/Kernel.php
use Spiral\McpServer\Bootloader\McpServerBootloader;
protected const LOAD = [
// ... other bootloaders
McpServerBootloader::class,
];
Quick Start
1. Create Your First Tool
Create a simple calculator tool:
<?php
namespace App\Tool;
use Spiral\McpServer\Attribute\Tool;
use Spiral\McpServer\Attribute\IsReadonly;
#[Tool(
name: 'calculator_add',
description: 'Adds two numbers together'
)]
#[IsReadonly]
class CalculatorTool
{
public function __invoke(CalculatorRequest $request): array
{
return [
'result' => $request->a + $request->b,
'operation' => 'addition'
];
}
}
2. Define the Request Schema
<?php
namespace App\Tool;
use Spiral\JsonSchemaGenerator\Attribute\Field;
final readonly class CalculatorRequest
{
public function __construct(
#[Field(
title: 'First Number',
description: 'The first number to add'
)]
public float $a,
#[Field(
title: 'Second Number',
description: 'The second number to add'
)]
public float $b,
) {}
}
Note: For more information about DTO schema definition visit spiral/json-schema-generator.
3. Set Environment Variables
インストール
This server does not publish a one-line install command.
Open the repository installation guide MCP 初心者?mcpskill.org のガイドから始めましょう →