Skip to content

Commit bf9a7ca

Browse files
committed
deploy: 433c84b
1 parent 7fd9270 commit bf9a7ca

559 files changed

Lines changed: 44274 additions & 51674 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CNAME

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 62 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,11 @@
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;
230272
use Mcp\Server\Transport\Http\Middleware\AuthorizationMiddleware;
231273
use Mcp\Server\Transport\Http\Middleware\ProtectedResourceMetadataMiddleware;
232274
use 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: &#039;https://auth.example.com&#039;, // Expected issuer claim
351393
audience: &#039;mcp-server&#039;, // 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
&#039;https://auth.example.com&#039;,
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: &#039;https://keycloak.example.com/realms/mcp&#039;,
485527
audience: &#039;mcp-server&#039;,
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 = &#039;your-tenant-id&#039;;
537+
<pre><code class="language-php">$tenantId = &#039;your-tenant-id&#039;;
496538
$clientId = &#039;your-client-id&#039;;
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: &#039;https://your-tenant.auth0.com/&#039;,
512554
audience: &#039;https://api.example.com&#039;,
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: &#039;https://your-org.okta.com/oauth2/default&#039;,
524566
audience: &#039;api://default&#039;,
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
&quot;authorization_servers&quot;: [&quot;https://auth.example.com/realms/mcp&quot;],
542584
&quot;scopes_supported&quot;: [&quot;mcp:read&quot;, &quot;mcp:write&quot;],
543585
&quot;resource&quot;: &quot;https://mcp.example.com/mcp&quot;
@@ -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;
573615
use Mcp\Server\Transport\Http\OAuth\AuthorizationResult;
574616

575617
final 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
612654
AuthorizationResult::allow([&#039;user_id&#039; =&gt; &#039;123&#039;]);
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: &#039;admin_action&#039;)]
676+
<pre><code class="language-php">#[McpTool(name: &#039;admin_action&#039;)]
635677
public function adminAction(RequestContext $context): array
636678
{
637679
$scopes = $context-&gt;getRequest()?-&gt;getAttribute(&#039;oauth.scopes&#039;) ?? [];
@@ -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-&gt;validate($token);
655697

656698
if ($result-&gt;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
681723
docker-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
695737
cp env.example .env
696738
# Edit .env with your Azure credentials
697739
docker-compose up -d

0 commit comments

Comments
 (0)