feat(mcp): mcp 独立应用与 /mcp Streamable HTTP 端点(官方 SDK + PSR-7 桥接)

This commit is contained in:
augushong
2026-08-16 22:15:19 +08:00
parent 1ab276b1e9
commit c21bf9f240
9 changed files with 489 additions and 0 deletions

View File

@@ -0,0 +1,14 @@
<?php
declare(strict_types=1);
namespace app\mcp\controller;
use base\mcp\controller\IndexBase;
/**
* MCP 协议端点(/mcp无中间件免 Session/CSRF先例 app/tools/.
*/
class Index extends IndexBase
{
}

View File

@@ -0,0 +1,14 @@
<?php
declare(strict_types=1);
namespace app\mcp\service;
use base\mcp\service\McpDispatchBase;
/**
* MCP 工具分发器.
*/
class McpDispatch extends McpDispatchBase
{
}

View File

@@ -0,0 +1,18 @@
<?php
declare(strict_types=1);
namespace app\mcp\service;
use base\mcp\service\Psr16ThinkCacheBase;
/**
* MCP 会话 PSR-16 适配器(包装 Cache::store('mcp_session').
*/
class Psr16ThinkCache extends Psr16ThinkCacheBase
{
protected function defaultStore(): string
{
return 'mcp_session';
}
}