AI SDK 调用高德mcp报错,有谁知道,帮我看一下

AI摘要
这是一个关于Laravel框架中MCP(Model Context Protocol)客户端使用的技术问题。用户尝试连接高德地图MCP服务时遇到HTTP传输层异常,错误信息显示“No message available from the HTTP transport”,表明客户端未能从HTTP传输中获取到预期的消息响应。问题可能源于服务端连接超时、URL或API密钥无效、网络配置或MCP协议握手失败。建议检查服务端地址、密钥有效性、网络连通性及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))

《L01 基础入门》
我们将带你从零开发一个项目并部署到线上,本课程教授 Web 开发中专业、实用的技能,如 Git 工作流、Laravel Mix 前端工作流等。
《L02 从零构建论坛系统》
以构建论坛项目 LaraBBS 为线索,展开对 Laravel 框架的全面学习。应用程序架构思路贴近 Laravel 框架的设计哲学。
讨论数量: 0
(= ̄ω ̄=)··· 暂无内容!

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!