Skip to content

STDIO mode has logging info in STDIO #33

@ruurtjan

Description

@ruurtjan

I've started a Laravel MCP server in STDIO mode and connected it to Cursor.

The cursor logs (/Users/ruurtjan/Library/Application Support/Cursor/logs/20250709T112740/window1/exthost/anysphere.cursor-retrieval/MCP Logs.log) show:

2025-07-10 10:49:36.646 [error] user-wirewiki: Client error for command Unexpected token 'S', "Starting MCP server" is not valid JSON
2025-07-10 10:49:36.646 [error] user-wirewiki: Client error for command No number after minus sign in JSON at position 3 (line 1 column 4)
2025-07-10 10:49:36.646 [error] user-wirewiki: Client error for command No number after minus sign in JSON at position 3 (line 1 column 4)
2025-07-10 10:49:36.646 [error] user-wirewiki: Client error for command No number after minus sign in JSON at position 3 (line 1 column 4)

The offending lines appears to be https://github.com/php-mcp/laravel/blob/main/src/Commands/ServeCommand.php#L83.

It may be that I'm misconfiguring this, in which case an update to the README would likely be helpful.

Context

/.cursor/mcp.json

{
  "mcpServers": {

    "wirewiki": {
      "command": "php",
      "args": [
          "/Users/ruurtjan/Herd/nslookup/artisan",
          "mcp:serve",
          "--transport",
          "stdio"
      ]
    },

  }
}

/config/logging.php

        'mcp' => [
            'driver' => 'daily',
            'path' => storage_path('logs/mcp.log'),
            'level' => env('MCP_LOG_LEVEL', 'info'),
            'days' => 14,
        ],

/config/mcp.php

<?php

return [
    /*
    |--------------------------------------------------------------------------
    | MCP Server Information
    |--------------------------------------------------------------------------
    */
    'server' => [
        'name' => env('MCP_SERVER_NAME', 'Laravel MCP'),
        'version' => env('MCP_SERVER_VERSION', '1.0.0'),
    ],

    /*
    |--------------------------------------------------------------------------
    | MCP Discovery Configuration
    |--------------------------------------------------------------------------
    */
    'discovery' => [
        'base_path' => base_path(),

        // Relative paths from project root (base_path()) to scan for MCP elements.
        'directories' => [
            env('MCP_DISCOVERY_PATH', 'app/Mcp'),
            // Add more paths if needed
        ],
    ],

    /*
    |--------------------------------------------------------------------------
    | MCP Cache Configuration
    |--------------------------------------------------------------------------
    | Configures caching for both discovered elements (via Registry) and
    | transport state (via TransportState). Uses Laravel's cache system.
    */
    'cache' => [
        // The Laravel cache store to use (e.g., 'file', 'redis', 'database').
        'store' => env('MCP_CACHE_STORE', config('cache.default')),

        // The prefix for the cache keys.
        'prefix' => env('MCP_CACHE_PREFIX', 'mcp_'),

        // Default TTL in seconds for cached items (null = forever).
        'ttl' => env('MCP_CACHE_TTL', 3600),
    ],

    /*
    |--------------------------------------------------------------------------
    | MCP Transport Configuration
    |--------------------------------------------------------------------------
    */
    'transports' => [

        // 'http' => [
        //     'enabled' => env('MCP_HTTP_ENABLED', true),

        //     // URL path prefix for the HTTP endpoints (e.g., /mcp and /mcp/sse).
        //     'prefix' => env('MCP_HTTP_PREFIX', 'mcp'),

        //     // Middleware group(s) to apply to the HTTP routes.
        //     'middleware' => ['web'],

        //     // Optional domain for the HTTP routes.
        //     'domain' => env('MCP_HTTP_DOMAIN'),
        // ],

        'stdio' => [
            'enabled' => true,
        ],
    ],

    /*
    |--------------------------------------------------------------------------
    | MCP Protocol & Capabilities
    |--------------------------------------------------------------------------
    */

    // Max items for list methods.
    'pagination_limit' => env('MCP_PAGINATION_LIMIT', 50),

    'capabilities' => [
        'tools' => [
            'enabled' => env('MCP_CAP_TOOLS_ENABLED', true),
            'listChanged' => env('MCP_CAP_TOOLS_LIST_CHANGED', true),
        ],

        'resources' => [
            'enabled' => env('MCP_CAP_RESOURCES_ENABLED', true),
            'subscribe' => env('MCP_CAP_RESOURCES_SUBSCRIBE', true), // Enable resource subscriptions
            'listChanged' => env('MCP_CAP_RESOURCES_LIST_CHANGED', true),
        ],

        'prompts' => [
            'enabled' => env('MCP_CAP_PROMPTS_ENABLED', true),
            'listChanged' => env('MCP_CAP_PROMPTS_LIST_CHANGED', true),
        ],

        'logging' => [
            'enabled' => env('MCP_CAP_LOGGING_ENABLED', true),
            'setLevel' => env('MCP_CAP_LOGGING_SET_LEVEL', false),
        ],
    ],

    /*
    |--------------------------------------------------------------------------
    | Logging Configuration
    |--------------------------------------------------------------------------
    */
    'logging' => [
        'channel' => 'mcp',
        'level' => 'debug',
    ],
];

composer.lock

        {
            "name": "php-mcp/laravel",
            "version": "3.0.0",
            "source": {
                "type": "git",
                "url": "https://github.com/php-mcp/laravel.git",
                "reference": "8c523941e8035fc6174c138999de53109c1e8f5e"
            },
            "dist": {
                "type": "zip",
                "url": "https://api.github.com/repos/php-mcp/laravel/zipball/8c523941e8035fc6174c138999de53109c1e8f5e",
                "reference": "8c523941e8035fc6174c138999de53109c1e8f5e",
                "shasum": ""
            },
            "require": {
                "laravel/framework": "^9.46 || ^10.34 || ^11.29 || ^12.0",
                "php": "^8.1",
                "php-mcp/server": "^3.1"
            },
            "require-dev": {
                "laravel/pint": "^1.13",
                "mockery/mockery": "^1.6",
                "orchestra/pest-plugin-testbench": "^2.1",
                "orchestra/testbench": "^8.0 || ^9.0",
                "pestphp/pest": "^2.0",
                "pestphp/pest-plugin-laravel": "^2.0",
                "phpunit/phpunit": "^10.0 || ^11.0"
            },
            "type": "library",
            "extra": {
                "laravel": {
                    "providers": [
                        "PhpMcp\\Laravel\\McpServiceProvider"
                    ]
                }
            },
            "autoload": {
                "psr-4": {
                    "PhpMcp\\Laravel\\": "src/"
                }
            },
            "notification-url": "https://packagist.org/downloads/",
            "license": [
                "MIT"
            ],
            "authors": [
                {
                    "name": "Kyrian Obikwelu",
                    "email": "[email protected]",
                    "role": "Developer"
                }
            ],
            "description": "Laravel SDK for building Model Context Protocol (MCP) servers - Seamlessly integrate MCP tools, resources, and prompts into Laravel applications",
            "homepage": "https://github.com/php-mcp/laravel",
            "keywords": [
                "ai",
                "laravel",
                "laravel mcp",
                "laravel mcp prompts",
                "laravel mcp resources",
                "laravel mcp sdk",
                "laravel mcp server",
                "laravel mcp tools",
                "laravel model context protocol",
                "llm",
                "mcp",
                "model-context-protocol",
                "tools"
            ],
            "support": {
                "issues": "https://github.com/php-mcp/laravel/issues",
                "source": "https://github.com/php-mcp/laravel/tree/3.0.0"
            },
            "time": "2025-06-26T00:29:08+00:00"
        },
        {
            "name": "php-mcp/schema",
            "version": "1.0.1",
            "source": {
                "type": "git",
                "url": "https://github.com/php-mcp/schema.git",
                "reference": "de8a32e00a007b696a0fcc55cb813bd98f1ce42c"
            },
            "dist": {
                "type": "zip",
                "url": "https://api.github.com/repos/php-mcp/schema/zipball/de8a32e00a007b696a0fcc55cb813bd98f1ce42c",
                "reference": "de8a32e00a007b696a0fcc55cb813bd98f1ce42c",
                "shasum": ""
            },
            "require": {
                "php": ">=8.1"
            },
            "type": "library",
            "autoload": {
                "psr-4": {
                    "PhpMcp\\Schema\\": "src/"
                }
            },
            "notification-url": "https://packagist.org/downloads/",
            "license": [
                "MIT"
            ],
            "authors": [
                {
                    "name": "Kyrian Obikwelu",
                    "email": "[email protected]"
                }
            ],
            "description": "PHP Data Transfer Objects (DTOs) and Enums for the Model Context Protocol (MCP) schema.",
            "support": {
                "issues": "https://github.com/php-mcp/schema/issues",
                "source": "https://github.com/php-mcp/schema/tree/1.0.1"
            },
            "time": "2025-06-25T04:27:57+00:00"
        },
        {
            "name": "php-mcp/server",
            "version": "3.2.2",
            "source": {
                "type": "git",
                "url": "https://github.com/php-mcp/server.git",
                "reference": "05357562e9d4dee076f701ccfe1e38149938e855"
            },
            "dist": {
                "type": "zip",
                "url": "https://api.github.com/repos/php-mcp/server/zipball/05357562e9d4dee076f701ccfe1e38149938e855",
                "reference": "05357562e9d4dee076f701ccfe1e38149938e855",
                "shasum": ""
            },
            "require": {
                "opis/json-schema": "^2.4",
                "php": ">=8.1",
                "php-mcp/schema": "^1.0",
                "phpdocumentor/reflection-docblock": "^5.6",
                "psr/clock": "^1.0",
                "psr/container": "^1.0 || ^2.0",
                "psr/log": "^1.0 || ^2.0 || ^3.0",
                "psr/simple-cache": "^1.0 || ^2.0 || ^3.0",
                "react/event-loop": "^1.5",
                "react/http": "^1.11",
                "react/promise": "^3.0",
                "react/stream": "^1.4",
                "symfony/finder": "^6.4 || ^7.2"
            },
            "require-dev": {
                "friendsofphp/php-cs-fixer": "^3.75",
                "mockery/mockery": "^1.6",
                "pestphp/pest": "^2.36.0|^3.5.0",
                "react/async": "^4.0",
                "react/child-process": "^0.6.6",
                "symfony/var-dumper": "^6.4.11|^7.1.5"
            },
            "suggest": {
                "react/http": "Required for using the ReactPHP HTTP transport handler (^1.11 recommended)."
            },
            "type": "library",
            "autoload": {
                "psr-4": {
                    "PhpMcp\\Server\\": "src/"
                }
            },
            "notification-url": "https://packagist.org/downloads/",
            "license": [
                "MIT"
            ],
            "authors": [
                {
                    "name": "Kyrian Obikwelu",
                    "email": "[email protected]"
                }
            ],
            "description": "PHP SDK for building Model Context Protocol (MCP) servers - Create MCP tools, resources, and prompts",
            "keywords": [
                "Model Context Protocol",
                "mcp",
                "php",
                "php mcp",
                "php mcp prompts",
                "php mcp resources",
                "php mcp sdk",
                "php mcp server",
                "php mcp tools",
                "php model context protocol",
                "server"
            ],
            "support": {
                "issues": "https://github.com/php-mcp/server/issues",
                "source": "https://github.com/php-mcp/server/tree/3.2.2"
            },
            "time": "2025-07-09T12:20:42+00:00"
        },

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions