PHPDIGEST Telegram 345
Forwarded from Пых (Валентин Удальцов)
Официальный PHP SDK для MCP

PHP Foundation, Anthropic и Symfony вместе работают над фреймворк-независимым PHP-SDK для MCP протокола!

1. Ставим: composer require mcp/sdk.

2. Размечаем код:

use Mcp\Capability\Attribute\McpTool;

final readonly class Calculator
{
#[McpTool(name: 'add_numbers')]
public function add(int $a, int $b): int
{
return $a + $b;
}
}


3. Готовим скрипт mcp-server.php:

#!/usr/bin/env php
<?php

require_once __DIR__ . '/vendor/autoload.php';

use Mcp\Server;
use Mcp\Server\Transport\StdioTransport;

Server::make()
->withServerInfo('Calculator', '1.1.0', 'Basic Calculator over STDIO transport.')
->withDiscovery(__DIR__, ['.'])
->build()
->connect(new StdioTransport());


4. Прописываем сервер:

{
"mcpServers": {
"php-calculator": {
"command": "php",
"args": ["/absolute/path/to/your/mcp-server.php"]
}
}
}


Профит!

https://thephp.foundation/blog/2025/09/05/php-mcp-sdk/
https://github.com/modelcontextprotocol/php-sdk
🔥479🤯9💩4👍3



tgoop.com/phpdigest/345
Create:
Last Update:

Официальный PHP SDK для MCP

PHP Foundation, Anthropic и Symfony вместе работают над фреймворк-независимым PHP-SDK для MCP протокола!

1. Ставим: composer require mcp/sdk.

2. Размечаем код:


use Mcp\Capability\Attribute\McpTool;

final readonly class Calculator
{
#[McpTool(name: 'add_numbers')]
public function add(int $a, int $b): int
{
return $a + $b;
}
}


3. Готовим скрипт mcp-server.php:

#!/usr/bin/env php
<?php

require_once __DIR__ . '/vendor/autoload.php';

use Mcp\Server;
use Mcp\Server\Transport\StdioTransport;

Server::make()
->withServerInfo('Calculator', '1.1.0', 'Basic Calculator over STDIO transport.')
->withDiscovery(__DIR__, ['.'])
->build()
->connect(new StdioTransport());


4. Прописываем сервер:

{
"mcpServers": {
"php-calculator": {
"command": "php",
"args": ["/absolute/path/to/your/mcp-server.php"]
}
}
}


Профит!

https://thephp.foundation/blog/2025/09/05/php-mcp-sdk/
https://github.com/modelcontextprotocol/php-sdk

BY PHP Digest




Share with your friend now:
tgoop.com/phpdigest/345

View MORE
Open in Telegram


Telegram News

Date: |

Matt Hussey, editorial director at NEAR Protocol also responded to this news with “#meIRL”. Just as you search “Bear Market Screaming” in Telegram, you will see a Pepe frog yelling as the group’s featured image. Private channels are only accessible to subscribers and don’t appear in public searches. To join a private channel, you need to receive a link from the owner (administrator). A private channel is an excellent solution for companies and teams. You can also use this type of channel to write down personal notes, reflections, etc. By the way, you can make your private channel public at any moment. Those being doxxed include outgoing Chief Executive Carrie Lam Cheng Yuet-ngor, Chung and police assistant commissioner Joe Chan Tung, who heads police's cyber security and technology crime bureau. Although some crypto traders have moved toward screaming as a coping mechanism, several mental health experts call this therapy a pseudoscience. The crypto community finds its way to engage in one or the other way and share its feelings with other fellow members. “Hey degen, are you stressed? Just let it all out,” he wrote, along with a link to join the group.
from us


Telegram PHP Digest
FROM American