feat: implement MCP server with tools, Post API tests, auth middleware
- Create TryPostServer MCP server with 17 tools:
Post (List, Get, Create, Delete), Hashtag (List, Create, Update, Delete),
Label (List, Create, Update, Delete), Workspace (Get),
ApiKey (List, Create, Delete)
- Create AuthenticateMcpToken middleware (logs in workspace owner)
- Register mcp.auth middleware alias in bootstrap/app.php
- Create routes/ai.php with mcp.trypost.test subdomain
- Add PostApiTest with 6 tests (list, show, create, delete, isolation)
- Fix PostApiTest assertions for pagination/resource wrapping
- 704 tests passing, frontend build passing
2026-03-29 23:30:36 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
|
|
namespace App\Mcp\Tools\Workspace;
|
|
|
|
|
|
|
|
|
|
use Laravel\Mcp\Request;
|
|
|
|
|
use Laravel\Mcp\Response;
|
|
|
|
|
use Laravel\Mcp\ResponseFactory;
|
|
|
|
|
use Laravel\Mcp\Server\Attributes\Description;
|
|
|
|
|
use Laravel\Mcp\Server\Tool;
|
|
|
|
|
use Laravel\Mcp\Server\Tools\Annotations\IsReadOnly;
|
|
|
|
|
|
|
|
|
|
#[IsReadOnly]
|
2026-04-17 02:05:51 +00:00
|
|
|
#[Description('Get the current workspace details including name.')]
|
feat: implement MCP server with tools, Post API tests, auth middleware
- Create TryPostServer MCP server with 17 tools:
Post (List, Get, Create, Delete), Hashtag (List, Create, Update, Delete),
Label (List, Create, Update, Delete), Workspace (Get),
ApiKey (List, Create, Delete)
- Create AuthenticateMcpToken middleware (logs in workspace owner)
- Register mcp.auth middleware alias in bootstrap/app.php
- Create routes/ai.php with mcp.trypost.test subdomain
- Add PostApiTest with 6 tests (list, show, create, delete, isolation)
- Fix PostApiTest assertions for pagination/resource wrapping
- 704 tests passing, frontend build passing
2026-03-29 23:30:36 +00:00
|
|
|
class GetWorkspaceTool extends Tool
|
|
|
|
|
{
|
|
|
|
|
public function handle(Request $request): ResponseFactory
|
|
|
|
|
{
|
|
|
|
|
return Response::structured($request->user()->currentWorkspace->toArray());
|
|
|
|
|
}
|
|
|
|
|
}
|