How to Build an MCP Server Quickly with the Webman Plugin

This guide explains how to install, configure, and run the Webman MCP plugin—covering features, command‑line tools, component creation, and deployment steps—to rapidly set up a Model Context Protocol server using PHP.

Open Source Tech Hub
Open Source Tech Hub
Open Source Tech Hub
How to Build an MCP Server Quickly with the Webman Plugin

Overview

Provides a Webman plugin based on the Model Context Protocol (MCP) SDK for quickly creating an MCP server.

Features

🚀 Fast startup, supports multiple transport protocols

🛠️ Command‑line tool to generate components

📡 Supports stdio, HTTP, SSE transports

🔧 Built‑in utilities, prompts, and resource management

Installation

composer require x2nx/webman-mcp

Quick Start

# Start stdio mode
php mcp-stdio.php

# Production mode (HTTP)
php webman start

# Test connection
curl -X POST http://127.0.0.1:7190/mcp \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc": "2.0", "method": "initialize", "params": {}}'

Create Components

# Create tool
php webman make:mcp-tool UserManager --name=get_user_info --description="获取用户信息"

# Create prompt
php webman make:mcp-prompt CodeReview --name=code_review --description="代码审查提示"

# Create resource
php webman make:mcp-resource ConfigResource --name=get_config --description="获取配置信息"

# Create resource template
php webman make:mcp-template ConfigResourceTemplate --name=get_config --description="获取配置信息"

Configuration

Edit config/plugin/x2nx/webman-mcp/mcp.php to set server name, version, description, and discovery options such as base_path, scan_dirs, and exclude_dirs.

<?php
return [
    'server' => [
        'name' => 'My MCP Server',
        'version' => '1.0.0',
        'description' => '自定义 MCP 服务器',
        'discover' => [
            'base_path' => base_path(),
            'scan_dirs' => ['app/mcp'],
            'exclude_dirs' => ['vendor', 'runtime'],
        ],
    ],
];

Deployment

# Production environment
php webman start -d

Running Screenshots

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

CLIMCPpluginPHPServerWebman
Open Source Tech Hub
Written by

Open Source Tech Hub

Sharing cutting-edge internet technologies and practical AI resources.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.