MCP cover image
See in Github
2025-03-23

Servidor MCP Para Php Universal - Integra Php Com O Protocolo Model Context Protocol

1

Github Watches

1

Github Forks

0

Github Stars

PHP MCP Protocol Server

License

Servidor MCP (Model Context Protocol) para PHP, que permite integrar o PHP com o Claude AI da Anthropic. Utiliza o SDK MCP oficial para fornecer uma solução robusta e compatível com o protocolo.

Recursos

  • Execução de código PHP direto do Claude
  • Implementação baseada no SDK MCP oficial da Anthropic
  • Tratamento adequado de erros e exceções
  • Limpeza automática de arquivos temporários
  • Suporte a verificação do ambiente PHP

Requisitos

  • Node.js (v14 ou superior)
  • PHP (v7.0 ou superior)
  • npm ou yarn

Instalação

Global (recomendado)

npm install -g php-mcp-protocol-server

Após a instalação global, você pode iniciar o servidor com:

php-mcp-server

Local via npm

npm install php-mcp-protocol-server

Via GitHub

git clone https://github.com/Lucasdoreac/php-mcp-protocol-server.git
cd php-mcp-protocol-server
npm install

Uso

Verificar o ambiente PHP

Antes de começar, verifique se o PHP está corretamente instalado:

npm run verify

Iniciar o servidor

npm start

Por padrão, o servidor escutará na porta 7654. Você pode alterar isso definindo a variável de ambiente MCP_PORT.

Integração com o Claude AI

  1. Inicie o servidor PHP MCP
  2. No aplicativo Claude Desktop, configure para usar uma ferramenta MCP local em localhost:7654
  3. Você pode agora executar código PHP diretamente do Claude!

API MCP

O servidor expõe duas ferramentas MCP:

executePhp

Executa código PHP e retorna a saída.

Parâmetros:

  • code (string): O código PHP a ser executado

Retorno:

  • output (string): A saída do código PHP
  • error (string, opcional): Mensagens de erro, se houver
  • exitCode (number, opcional): Código de saída do processo PHP

phpInfo

Retorna informações detalhadas sobre o ambiente PHP.

Parâmetros: Nenhum

Retorno:

  • info (string): Informações sobre o ambiente PHP, incluindo versão, extensões e configurações

Exemplo de uso no Claude

Para usar o PHP no Claude, basta pedir para executar código PHP. Por exemplo:

Pode executar este código PHP para mim?

<?php
$data = [
  'nome' => 'Exemplo',
  'valor' => 42,
  'timestamp' => time()
];

echo "Dados em JSON:\n";
echo json_encode($data, JSON_PRETTY_PRINT);
?>

Solução de Problemas

Se o servidor não iniciar ou ocorrerem erros:

  1. Verifique se o PHP está instalado e no PATH do sistema
  2. Confirme que a porta 7654 (ou a configurada) está disponível
  3. Verifique os logs do servidor para mensagens de erro detalhadas

Licença

MIT

相关推荐

  • https://suefel.com
  • Latest advice and best practices for custom GPT development.

  • NiKole Maxwell
  • I craft unique cereal names, stories, and ridiculously cute Cereal Baby images.

  • Yusuf Emre Yeşilyurt
  • I find academic articles and books for research and literature reviews.

  • https://maiplestudio.com
  • Find Exhibitors, Speakers and more

  • Carlos Ferrin
  • Encuentra películas y series en plataformas de streaming.

  • Bora Yalcin
  • Evaluator for marketplace product descriptions, checks for relevancy and keyword stuffing.

  • Joshua Armstrong
  • Confidential guide on numerology and astrology, based of GG33 Public information

  • Elijah Ng Shi Yi
  • Advanced software engineer GPT that excels through nailing the basics.

  • Emmet Halm
  • Converts Figma frames into front-end code for various mobile frameworks.

  • Contraband Interactive
  • Emulating Dr. Jordan B. Peterson's style in providing life advice and insights.

  • rustassistant.com
  • Your go-to expert in the Rust ecosystem, specializing in precise code interpretation, up-to-date crate version checking, and in-depth source code analysis. I offer accurate, context-aware insights for all your Rust programming questions.

  • apappascs
  • Entdecken Sie die umfassendste und aktuellste Sammlung von MCP-Servern auf dem Markt. Dieses Repository dient als zentraler Hub und bietet einen umfangreichen Katalog von Open-Source- und Proprietary MCP-Servern mit Funktionen, Dokumentationslinks und Mitwirkenden.

  • Mintplex-Labs
  • Die All-in-One-Desktop & Docker-AI-Anwendung mit integriertem Lappen, AI-Agenten, No-Code-Agent Builder, MCP-Kompatibilität und vielem mehr.

  • modelcontextprotocol
  • Modellkontext -Protokollserver

  • n8n-io
  • Fair-Code-Workflow-Automatisierungsplattform mit nativen KI-Funktionen. Kombinieren Sie visuelles Gebäude mit benutzerdefiniertem Code, SelbstHost oder Cloud, 400+ Integrationen.

  • WangRongsheng
  • 🧑‍🚀 全世界最好的 llm 资料总结(数据处理、模型训练、模型部署、 O1 模型、 MCP 、小语言模型、视觉语言模型) | Zusammenfassung der weltbesten LLM -Ressourcen.

  • wong2
  • Eine kuratierte Liste von Servern des Modellkontextprotokolls (MCP)

  • metorial
  • Containerisierte Versionen von Hunderten von MCP -Servern 📡 🧠

  • open-webui
  • Benutzerfreundliche KI-Schnittstelle (unterstützt Ollama, OpenAI-API, ...)

    Reviews

    4 (1)
    Avatar
    user_pBCR1uRa
    2025-04-16

    php-mcp-protocol-server by Lucasdoreac is a robust and efficient MCP protocol server written in PHP. It offers seamless integration, easy-to-follow documentation, and reliable performance for MCP applications. As an avid MCP user, I appreciate the stability and overall quality of this server. Highly recommended for anyone looking to implement MCP protocol in their projects!