AI SDK 调用高德mcp报错,有谁知道,帮我看一下
<?php
namespace App\Console\Commands;
use Illuminate\Console\Attributes\Description;
use Illuminate\Console\Attributes\Signature;
use Illuminate\Console\Command;
use Laravel\Mcp\Client\Exceptions\AuthorizationRequiredException;
use Laravel\Mcp\Client\Primitives\Tool;
use Mcp\Client\Client;
#[Signature('app:test2')]
#[Description('Command description')]
class Test2 extends Command
{
/**
* Execute the console command.
* @throws AuthorizationRequiredException
*/
public function handle()
{
//
$session = \Laravel\Mcp\Client::web('https://mcp.amap.com/mcp?key=9adb7e37a55696ffefe816b9a0efb4c8')->withTimeout(120)
->withHeaders(['Accept'=>'application/json, text/event-stream','User-Agent' => 'Laravel-MCP-Client'])->connect();
// Call the add-numbers tool with two arguments
$result = $session->tools();
dump($result);
}
}
报错信息如下:
Laravel\Mcp\Exceptions\ClientException
No message available from the HTTP transport.
at vendor\laravel\mcp\src\Client\Transport\HttpTransport.php:162
158▕ {
159▕ $message = array_shift($this->queue);
160▕
161▕ if ($message === null) {
➜ 162▕ throw new ClientException(‘No message available from the HTTP transport.’);
163▕ }
164▕
165▕ return $message;
166▕ }
1 vendor\laravel\mcp\src\Client\Protocol.php:117
Laravel\Mcp\Client\Transport\HttpTransport::receive()
2 vendor\laravel\mcp\src\Client\Protocol.php:93
Laravel\Mcp\Client\Protocol::attempt(Object(Laravel\Mcp\Client\Methods\Initialize))
关于 LearnKu
推荐文章: