Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

layout title nav_order has_children format_version
default
MCP PHP SDK Tutorial
172
true
v2

MCP PHP SDK Tutorial: Building MCP Servers in PHP with Discovery and Transport Flexibility

Learn how to implement MCP server workflows with modelcontextprotocol/php-sdk, including attribute discovery, manual capability registration, transport strategy, session storage, and framework integration patterns.

GitHub Repo Packagist Latest Release

Why This Track Matters

PHP teams integrating MCP need a practical path that works across plain scripts and framework-based HTTP stacks. The official PHP SDK focuses on server construction with a strong attribute model, pluggable discovery and session controls, and transport support for both local stdio and HTTP deployments.

This track focuses on:

  • setting a safe baseline for an actively evolving SDK
  • designing tools/resources/prompts with schema discipline
  • choosing between discovery, manual registration, or hybrid patterns
  • running transport/session strategies for CLI and web workloads

Current Snapshot (auto-updated)

Mental Model

flowchart LR
    A[PHP app] --> B[Server::builder]
    B --> C[Discovery + Attributes]
    B --> D[Manual Registration]
    B --> E[STDIO Transport]
    B --> F[Streamable HTTP Transport]
    B --> G[Session + Cache + Logger]
Loading

Chapter Guide

Chapter Key Question Outcome
01 - Getting Started and Experimental Baseline How do I start safely with a fast-moving PHP SDK? Stable setup
02 - Server Builder and Capability Registration How does Server::builder() shape server architecture? Better composition
03 - MCP Elements: Tools, Resources, Prompts, and Schemas How should primitives be modeled for robust interoperability? Higher schema quality
04 - Discovery, Manual Registration, and Caching When should I use discovery, explicit registration, or both? Faster startup and lower drift
05 - Transports: STDIO and Streamable HTTP Which transport should I deploy per environment? Clear runtime strategy
06 - Client Communication: Sampling, Logging, and Progress How do server-side handlers communicate back to clients correctly? Better protocol UX
07 - Framework Integration, Session Stores, and Dependencies How do I integrate PHP MCP into web stacks safely? Production-ready integration
08 - Roadmap, Release Strategy, and Production Readiness How should teams manage upgrades while APIs are still evolving? Safer operations

What You Will Learn

  • how to build PHP MCP servers with a durable builder/discovery architecture
  • how to expose and validate primitives using attribute and schema controls
  • how to run stdio and HTTP transports with appropriate session management
  • how to operate the SDK with roadmap-aware release discipline

Source References

Related Tutorials


Start with Chapter 1: Getting Started and Experimental Baseline.

Navigation & Backlinks

Full Chapter Map

  1. Chapter 1: Getting Started and Experimental Baseline
  2. Chapter 2: Server Builder and Capability Registration
  3. Chapter 3: MCP Elements: Tools, Resources, Prompts, and Schemas
  4. Chapter 4: Discovery, Manual Registration, and Caching
  5. Chapter 5: Transports: STDIO and Streamable HTTP
  6. Chapter 6: Client Communication: Sampling, Logging, and Progress
  7. Chapter 7: Framework Integration, Session Stores, and Dependencies
  8. Chapter 8: Roadmap, Release Strategy, and Production Readiness

Generated by AI Codebase Knowledge Builder