66
77
88 < meta name ="viewport " content ="width=device-width, initial-scale=1.0 ">
9- < base href ="../ ">
9+ < base href ="./ ">
10+ < link rel ="icon " type ="image/png " sizes ="32x32 " href ="images/favicon-32x32.png "/>
11+ < link rel ="icon " type ="image/png " sizes ="16x16 " href ="images/favicon-16x16.png "/>
1012 < link rel ="icon " href ="images/favicon.ico "/>
13+ < link rel ="apple-touch-icon " href ="images/apple-touch-icon.png "/>
1114 < link rel ="stylesheet " href ="css/normalize.css ">
1215 < link rel ="stylesheet " href ="css/base.css ">
1316 < link rel ="preconnect " href ="https://fonts.gstatic.com ">
@@ -94,7 +97,46 @@ <h1 class="phpdocumentor-title">
9497 Menu
9598</ label >
9699< aside class ="phpdocumentor-column -three phpdocumentor-sidebar ">
97- < section class ="phpdocumentor-sidebar__category -namespaces ">
100+ < section class ="phpdocumentor-sidebar__category -mcp-php-sdk-guides ">
101+ < h2 class ="phpdocumentor-sidebar__category-header "> Mcp-Php-Sdk-Guides</ h2 >
102+ < h4 class ="phpdocumentor-sidebar__root-namespace ">
103+ < a href ="/authorization.html#authorization " class =""> Authorization</ a >
104+ </ h4 >
105+
106+ < h4 class ="phpdocumentor-sidebar__root-namespace ">
107+ < a href ="/client.html#client " class =""> Client</ a >
108+ </ h4 >
109+
110+ < h4 class ="phpdocumentor-sidebar__root-namespace ">
111+ < a href ="/events.html#events " class =""> Events</ a >
112+ </ h4 >
113+
114+ < h4 class ="phpdocumentor-sidebar__root-namespace ">
115+ < a href ="/examples.html#examples " class =""> Examples</ a >
116+ </ h4 >
117+
118+ < h4 class ="phpdocumentor-sidebar__root-namespace ">
119+ < a href ="/extensions.html#protocol-extensions " class =""> Protocol Extensions</ a >
120+ </ h4 >
121+
122+ < h4 class ="phpdocumentor-sidebar__root-namespace ">
123+ < a href ="/mcp-elements.html#mcp-elements " class =""> MCP Elements</ a >
124+ </ h4 >
125+
126+ < h4 class ="phpdocumentor-sidebar__root-namespace ">
127+ < a href ="/server-builder.html#server-builder " class =""> Server Builder</ a >
128+ </ h4 >
129+
130+ < h4 class ="phpdocumentor-sidebar__root-namespace ">
131+ < a href ="/server-client-communication.html#client-communication " class =""> Client Communication</ a >
132+ </ h4 >
133+
134+ < h4 class ="phpdocumentor-sidebar__root-namespace ">
135+ < a href ="/transports.html#transports " class =""> Transports</ a >
136+ </ h4 >
137+
138+ </ section >
139+ < section class ="phpdocumentor-sidebar__category -namespaces ">
98140 < h2 class ="phpdocumentor-sidebar__category-header "> Namespaces</ h2 >
99141 < h4 class ="phpdocumentor-sidebar__root-namespace ">
100142 < a href ="namespaces/mcp.html " class =""> Mcp</ a >
@@ -226,7 +268,7 @@ <h2>Overview</h2>
226268 < section class ="section " id ="quick-start ">
227269 < h2 > Quick Start</ h2 >
228270
229- < pre > < code class ="language- "> use Mcp\Server;
271+ < pre > < code class ="language-php "> use Mcp\Server;
230272use Mcp\Server\Transport\Http\Middleware\AuthorizationMiddleware;
231273use Mcp\Server\Transport\Http\Middleware\ProtectedResourceMetadataMiddleware;
232274use Mcp\Server\Transport\Http\OAuth\JwksProvider;
@@ -288,7 +330,7 @@ <h3>AuthorizationMiddleware</h3>
288330
289331 < p > The main middleware that enforces authentication:</ p >
290332
291- < pre > < code class ="language- "> $middleware = new AuthorizationMiddleware(
333+ < pre > < code class ="language-php "> $middleware = new AuthorizationMiddleware(
292334 validator: $validator, // AuthorizationTokenValidatorInterface
293335 resourceMetadata: $metadata, // ProtectedResourceMetadata instance
294336 responseFactory: null, // PSR-17 (auto-discovered)
@@ -331,7 +373,7 @@ <h3>ProtectedResourceMetadataMiddleware</h3>
331373
332374 < p > Serves Protected Resource Metadata at configured well-known paths:</ p >
333375
334- < pre > < code class ="language- "> $metadataMiddleware = new ProtectedResourceMetadataMiddleware(
376+ < pre > < code class ="language-php "> $metadataMiddleware = new ProtectedResourceMetadataMiddleware(
335377 metadata: $metadata, // ProtectedResourceMetadata instance
336378 responseFactory: null, // PSR-17 (auto-discovered)
337379 streamFactory: null, // PSR-17 (auto-discovered)
@@ -346,7 +388,7 @@ <h3>JwtTokenValidator</h3>
346388
347389 < p > Validates JWT access tokens:</ p >
348390
349- < pre > < code class ="language- "> $validator = new JwtTokenValidator(
391+ < pre > < code class ="language-php "> $validator = new JwtTokenValidator(
350392 issuer: 'https://auth.example.com', // Expected issuer claim
351393 audience: 'mcp-server', // Expected audience (string or array)
352394 jwksProvider: $jwksProvider, // JwksProviderInterface
@@ -410,7 +452,7 @@ <h3>ProtectedResourceMetadata</h3>
410452
411453 < p > Represents RFC 9728 Protected Resource Metadata:</ p >
412454
413- < pre > < code class ="language- "> $metadata = new ProtectedResourceMetadata(
455+ < pre > < code class ="language-php "> $metadata = new ProtectedResourceMetadata(
414456 authorizationServers: [ // Required: authorization server URLs
415457 'https://auth.example.com',
416458 ],
@@ -437,7 +479,7 @@ <h3>OidcDiscovery</h3>
437479
438480 < p > Discovers OAuth/OIDC server metadata:</ p >
439481
440- < pre > < code class ="language- "> $discovery = new OidcDiscovery(
482+ < pre > < code class ="language-php "> $discovery = new OidcDiscovery(
441483 httpClient: null, // PSR-18 (auto-discovered)
442484 requestFactory: null, // PSR-17 (auto-discovered)
443485 cache: $cache, // PSR-16 cache (optional)
@@ -461,7 +503,7 @@ <h3>JwksProvider</h3>
461503
462504 < p > Fetches and caches JWKS key sets:</ p >
463505
464- < pre > < code class ="language- "> $jwksProvider = new JwksProvider(
506+ < pre > < code class ="language-php "> $jwksProvider = new JwksProvider(
465507 discovery: $discovery, // OidcDiscoveryInterface
466508 httpClient: null, // PSR-18 (auto-discovered)
467509 requestFactory: null, // PSR-17 (auto-discovered)
@@ -480,7 +522,7 @@ <h2>JWT Token Validation</h2>
480522 < section class ="section " id ="keycloak ">
481523 < h3 > Keycloak</ h3 >
482524
483- < pre > < code class ="language- "> $validator = new JwtTokenValidator(
525+ < pre > < code class ="language-php "> $validator = new JwtTokenValidator(
484526 issuer: 'https://keycloak.example.com/realms/mcp',
485527 audience: 'mcp-server',
486528 jwksProvider: $jwksProvider,
@@ -492,7 +534,7 @@ <h3>Keycloak</h3>
492534 < section class ="section " id ="microsoft-entra-id-azure-ad ">
493535 < h3 > Microsoft Entra ID (Azure AD)</ h3 >
494536
495- < pre > < code class ="language- "> $tenantId = 'your-tenant-id';
537+ < pre > < code class ="language-php "> $tenantId = 'your-tenant-id';
496538$clientId = 'your-client-id';
497539
498540$validator = new JwtTokenValidator(
@@ -507,7 +549,7 @@ <h3>Microsoft Entra ID (Azure AD)</h3>
507549 < section class ="section " id ="auth0 ">
508550 < h3 > Auth0</ h3 >
509551
510- < pre > < code class ="language- "> $validator = new JwtTokenValidator(
552+ < pre > < code class ="language-php "> $validator = new JwtTokenValidator(
511553 issuer: 'https://your-tenant.auth0.com/',
512554 audience: 'https://api.example.com',
513555 jwksProvider: $jwksProvider,
@@ -519,7 +561,7 @@ <h3>Auth0</h3>
519561 < section class ="section " id ="okta ">
520562 < h3 > Okta</ h3 >
521563
522- < pre > < code class ="language- "> $validator = new JwtTokenValidator(
564+ < pre > < code class ="language-php "> $validator = new JwtTokenValidator(
523565 issuer: 'https://your-org.okta.com/oauth2/default',
524566 audience: 'api://default',
525567 jwksProvider: $jwksProvider,
@@ -537,7 +579,7 @@ <h2>Protected Resource Metadata</h2>
537579 < p > The < code > ProtectedResourceMetadataMiddleware</ code >
538580 serves Protected Resource Metadata at configured paths, enabling clients to discover the authorization server:</ p >
539581
540- < pre > < code class ="language- "> {
582+ < pre > < code class ="language-json "> {
541583 "authorization_servers": ["https://auth.example.com/realms/mcp"],
542584 "scopes_supported": ["mcp:read", "mcp:write"],
543585 "resource": "https://mcp.example.com/mcp"
@@ -569,7 +611,7 @@ <h2>Custom Token Validators</h2>
569611 < p > Implement < code > AuthorizationTokenValidatorInterface</ code >
570612 for custom validation:</ p >
571613
572- < pre > < code class ="language- "> use Mcp\Server\Transport\Http\OAuth\AuthorizationTokenValidatorInterface;
614+ < pre > < code class ="language-php "> use Mcp\Server\Transport\Http\OAuth\AuthorizationTokenValidatorInterface;
573615use Mcp\Server\Transport\Http\OAuth\AuthorizationResult;
574616
575617final class ApiKeyValidator implements AuthorizationTokenValidatorInterface
@@ -608,7 +650,7 @@ <h3>AuthorizationResult</h3>
608650
609651 < p > Factory methods for different outcomes:</ p >
610652
611- < pre > < code class ="language- "> // Allow access with attributes
653+ < pre > < code class ="language-php "> // Allow access with attributes
612654AuthorizationResult::allow(['user_id' => '123']);
613655
614656// Deny - missing/invalid token (401)
@@ -631,7 +673,7 @@ <h2>Scope-Based Access Control</h2>
631673 < section class ="section " id ="checking-scopes-in-handlers ">
632674 < h3 > Checking Scopes in Handlers</ h3 >
633675
634- < pre > < code class ="language- "> #[McpTool(name: 'admin_action')]
676+ < pre > < code class ="language-php "> #[McpTool(name: 'admin_action')]
635677public function adminAction(RequestContext $context): array
636678{
637679 $scopes = $context->getRequest()?->getAttribute('oauth.scopes') ?? [];
@@ -650,7 +692,7 @@ <h3>Checking Scopes in Handlers</h3>
650692 < section class ="section " id ="using-jwttokenvalidator-requirescopes ">
651693 < h3 > Using JwtTokenValidator::requireScopes</ h3 >
652694
653- < pre > < code class ="language- "> // In a custom middleware or handler
695+ < pre > < code class ="language-php "> // In a custom middleware or handler
654696$result = $validator->validate($token);
655697
656698if ($result->isAllowed()) {
@@ -677,7 +719,7 @@ <h2>Examples</h2>
677719 < section class ="section " id ="keycloak-example ">
678720 < h3 > Keycloak Example</ h3 >
679721
680- < pre > < code class ="language- "> cd examples/server/oauth-keycloak
722+ < pre > < code class ="language-bash "> cd examples/server/oauth-keycloak
681723docker-compose up -d
682724
683725# Test credentials: demo / demo123
@@ -691,7 +733,7 @@ <h3>Keycloak Example</h3>
691733 < section class ="section " id ="microsoft-entra-id-example ">
692734 < h3 > Microsoft Entra ID Example</ h3 >
693735
694- < pre > < code class ="language- "> cd examples/server/oauth-microsoft
736+ < pre > < code class ="language-bash "> cd examples/server/oauth-microsoft
695737cp env.example .env
696738# Edit .env with your Azure credentials
697739docker-compose up -d
0 commit comments