SP

spiral-packages/mcp-server

Developer tools

이 페이지는 AI로 자동 번역되었습니다. 기술적인 세부 사항은 원문을 확인하세요. 원문 보기

54 stars 1 forks 품질 48 트렌드 13MIT

사이트맵 Spiral Framework의 서버 구현

개요

Spiral Framework의 강력하고 유연한 구현. 이 패키지는 자동 공구 발견, 속성 기반 구성 및 나선형의 의존성 주입 용기와 완벽하게 통합 된 MCP 서버 솔루션을 제공합니다. ✨ - 자동으로 PHP 속성을 사용하여 MCP 도구에 등록 - HTTP를 지원, HTTP 스트리밍, 및 STDIO 전송 - 간단한 PHP 속성과 도구 동작을 정의 De️ - 나선형 / json-schema-generator를 사용하여 자동 JSON 스키마 생성 nam - 요청 / 응답 처리를위한 확장 가능한 미들웨어 시스템 - 나선형 프레임 워크의 IoC 컨테이너 과 함께 일류 통합 - Tur-in 세션을 처리 - Tur-in-in-in-in-in-in-in-in-in-in-in-in-in-in-in-in-in-in-in-in-in-in-in-en-in-in-in-in-in-in-in-in-in-in-in-in-in-in-in-in-in-in-in-in-in-in-in-in-in-in-in-in-in-in-in-in-in-in-in-in-in-in-in-in-in-in-in-in-in-in-in-in-in-in-in-in-in-in- - PHP 8.3 이상 - 나선형 프레임 워크 3.15 + - 작곡가 당신의 나선형 신청에 bootloader를 추가하십시오: : DTO schema 정의에 대한 자세한 내용은 Spiral/json-schema-generator를 방문하십시오.

개요(AI 번역)

강력하고 유연 ** 모델 Context Protocol (MCP) Server** 나선형 프레임 워크에 대한 구현. 이 패키지 완전한 MCP 서버 솔루션을 자동 도구 발견, 속성 기반 구성 및 원활한 나선형의 의존성 주입 용기와 통합.

내용 표

  • 특징
  • 요구 사항
  • 설치
  • 빠른 시작
  • 구성
  • 도구 만들기
  • 도구 속성
  • 기타
  • 기여
  • 라이센스

특징

✨Automatic Tool Discovery - 자동 발견 및 PHP 속성을 사용하여 MCP 도구를 등록 ☸ Multiple Transport Options - HTTP, 스트리밍 HTTP 및 STDIO 전송 지원 A Attribute-Based Configuration - 간단한 PHP 속성과 도구 동작 정의 S️ Schema Validation - 나선형 / json-schema-generator를 사용하여 자동 JSON 스키마 생성 西 Middleware Support - 요청/response 처리를위한 탁월한 미들웨어 시스템 Azur Spiral Integration - 나선형 프레임 워크의 IoC 컨테이너와 일류 통합 Session Management - 구성 가능한 TTL과 내장 세션 처리 ♨Production Ready - 고성능 생산 환경 설계

이 페이지는 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

✨ 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

GitHub에서 전체 README 보기

설치

This server does not publish a one-line install command.

Open the repository installation guide MCP 초보자라면? mcpskill.org 가이드부터 시작하세요 →