You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+8-10Lines changed: 8 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -67,7 +67,7 @@ Next, register your server in `routes/ai.php`:
67
67
68
68
```php
69
69
use App\Mcp\Servers\DemoServer;
70
-
use Laravel\Mcp\Server\Facades\Mcp;
70
+
use Laravel\Mcp\Facades\Mcp;
71
71
72
72
Mcp::local('demo', DemoServer::class);
73
73
```
@@ -247,22 +247,20 @@ To register a web-based MCP server that can be accessed via HTTP POST requests,
247
247
248
248
```php
249
249
use App\Mcp\Servers\ExampleServer;
250
-
use Laravel\Mcp\Server\Facades\Mcp;
250
+
use Laravel\Mcp\Facades\Mcp;
251
251
252
-
Mcp::web('demo', ExampleServer::class);
252
+
Mcp::web('/mcp/demo', ExampleServer::class);
253
253
```
254
254
255
255
This will make `ExampleServer` available at the `/mcp/demo` endpoint.
256
256
257
-
> **Security Note:** Exposing a local development server via `Mcp::web()` can make your application vulnerable to DNS rebinding attacks. If you must expose a local MCP server over HTTP, it is critical to validate the `Host` and `Origin` headers on incoming requests to ensure they are coming from a trusted source.
258
-
259
257
### Local Servers
260
258
261
259
To register a local MCP server that can be run as an Artisan command:
262
260
263
261
```php
264
262
use App\Mcp\Servers\ExampleServer;
265
-
use Laravel\Mcp\Server\Facades\Mcp;
263
+
use Laravel\Mcp\Facades\Mcp;
266
264
267
265
Mcp::local('demo', ExampleServer::class);
268
266
```
@@ -275,12 +273,12 @@ php artisan mcp:start demo
275
273
276
274
## Authentication
277
275
278
-
Web-based MCP servers can be protected using [Laravel Passport](laravel.com/docs/passport), turning your MCP server into an OAuth2 protected resource.
276
+
Web-based MCP servers can be protected using [Laravel Passport](https://laravel.com/docs/passport), turning your MCP server into an OAuth2 protected resource.
279
277
280
278
If you already have Passport set up for your app, all you need to do is add the `Mcp::oauthRoutes()` helper to your `routes/web.php` file. This registers the required OAuth2 discovery and client registration endpoints. The method accepts an optional route prefix, which defaults to `oauth`.
281
279
282
280
```php
283
-
use Laravel\Mcp\Server\Facades\Mcp;
281
+
use Laravel\Mcp\Facades\Mcp;
284
282
285
283
Mcp::oauthRoutes();
286
284
```
@@ -289,9 +287,9 @@ Then, apply the `auth:api` middleware to your server registration in `routes/ai.
0 commit comments