Cover image
Try Now
2025-03-12

使用Elixir的Phoenix框架对模型上下文协议(MCP)服务器的简化实现。

3 years

Works with Finder

1

Github Watches

4

Github Forks

49

Github Stars

MCPheonix

A simplified implementation of the Model Context Protocol (MCP) server using Elixir's Phoenix Framework.

Overview

MCPheonix is an intelligent, self-healing, distributed AI event system using Model Context Protocol and Elixir's Phoenix Framework. It provides a server that implements the Model Context Protocol, allowing AI models to interact with your application data and functionality through a unified interface.

Features

  • Server-Sent Events (SSE) stream for real-time notifications
  • JSON-RPC endpoint for client requests
  • Simple resource system
  • Event publish/subscribe mechanism
  • Basic tool invocation
  • Flux image generation integration
  • Dart task management integration
  • Extensible MCP server architecture
  • Self-healing distributed architecture via Cloudflare Durable Objects
  • Edge computing capabilities through Cloudflare Workers

Self-Healing Distributed Architecture

MCPheonix implements a sophisticated self-healing system through its integration with Cloudflare Durable Objects and Workers, creating a distributed, resilient architecture that can withstand failures and ensure continuous operation.

Key Components

  • Durable Objects: Stateful serverless components running on Cloudflare's global edge network that maintain consistency even across failures.
  • Edge Distribution: Critical application state is replicated across Cloudflare's global network, ensuring availability even during regional outages.
  • Automatic Recovery: If an instance becomes unavailable, the system automatically recreates it with consistent state from durable storage.
  • Real-time Communication: WebSocket support enables instant recovery coordination and state synchronization across the distributed system.
  • Event-Driven Architecture: Components react to state changes through a publish/subscribe model, allowing the system to self-heal and adapt to failures.

For detailed information on the implementation, see the Cloudflare Integration documentation.

Getting Started

Prerequisites

  • Elixir 1.14 or higher
  • Erlang 25 or higher
  • Phoenix 1.7.0 or higher
  • Python 3.9+ (for Flux and Dart integration)
  • Node.js 18+ (for Dart MCP server)
  • Cloudflare account (for Durable Objects integration)

Installation

  1. Clone the repository
git clone https://github.com/yourusername/mcpheonix.git
cd mcpheonix
  1. Install dependencies
mix deps.get
  1. Configure the Cloudflare integration

    • Create a Cloudflare Worker using the template in cloudflare/durable-objects-worker.js
    • Deploy it to your Cloudflare account
    • Set the environment variables:
      • CLOUDFLARE_WORKER_URL: URL of your deployed worker
      • CLOUDFLARE_ACCOUNT_ID: Your Cloudflare account ID
      • CLOUDFLARE_API_TOKEN: API token with Workers and DO permissions
  2. Configure the Flux integration (if using image generation)

  3. Configure the Dart integration (if using task management)

  4. Start the server

mix phx.server

The server will be available at http://localhost:4001.

Adding Custom MCP Servers

MCPheonix is designed to work with multiple MCP servers. This system includes a flexible infrastructure for integrating custom MCP servers through:

  1. Simple JSON Configuration: Define your server settings in priv/config/mcp_servers.json:
{
  "mcpServers": {
    "your_server_id": {
      "command": "/path/to/executable",
      "args": ["arg1", "arg2"],
      "env": {
        "ENV_VAR1": "value1",
        "ENV_VAR2": "value2"
      },
      "tools": {
        "your_tool": {
          "description": "Description of your tool",
          "parameters": [
            { "name": "param1", "type": "string", "description": "Parameter description" }
          ]
        }
      }
    }
  }
}
  1. Automatic Server Management: Servers are automatically loaded and managed during application startup.

For comprehensive implementation details, including the Elixir architecture, server lifecycle management, and protocol handling, see the Adding MCP Servers documentation.

MCP Endpoints

  • SSE Stream: GET /mcp/stream

    • Establishes a Server-Sent Events stream for receiving real-time notifications
    • Returns a client ID in the response headers
  • JSON-RPC: POST /mcp/rpc

    • Accepts JSON-RPC 2.0 requests
    • Client ID can be provided in the x-mcp-client-id header or will be generated if missing

Built-in Capabilities

Resources

相关推荐

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

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

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

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

  • Alexandru Strujac
  • Efficient thumbnail creator for YouTube videos

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

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

  • lumpenspace
  • Take an adjectivised noun, and create images making it progressively more adjective!

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

  • https://zenepic.net
  • Embark on a thrilling diplomatic quest across a galaxy on the brink of war. Navigate complex politics and alien cultures to forge peace and avert catastrophe in this immersive interstellar adventure.

  • apappascs
  • 发现市场上最全面,最新的MCP服务器集合。该存储库充当集中式枢纽,提供了广泛的开源和专有MCP服务器目录,并提供功能,文档链接和贡献者。

  • ShrimpingIt
  • MCP系列GPIO Expander的基于Micropython I2C的操作,源自ADAFRUIT_MCP230XX

  • pontusab
  • 光标与风浪冲浪社区,查找规则和MCP

  • jae-jae
  • MCP服务器使用剧作《无头浏览器》获取网页内容。

  • ravitemer
  • 一个功能强大的Neovim插件,用于管理MCP(模型上下文协议)服务器

  • patruff
  • Ollama和MCP服务器之间的桥梁,使本地LLMS可以使用模型上下文协议工具

  • av
  • 毫不费力地使用一个命令运行LLM后端,API,前端和服务。

  • Mintplex-Labs
  • 带有内置抹布,AI代理,无代理构建器,MCP兼容性等的多合一桌面和Docker AI应用程序。

  • appcypher
  • 很棒的MCP服务器 - 模型上下文协议服务器的策划列表

  • 1Panel-dev
  • 🔥1Panel提供了直观的Web接口和MCP服务器,用于在Linux服务器上管理网站,文件,容器,数据库和LLMS。

    Reviews

    5 (1)
    Avatar
    user_jaIxSYt3
    2025-04-17

    MCPhoenix is a fantastic application created by jmanhype that has significantly improved my experience. It is user-friendly and robust, making it perfect for both beginners and advanced users. The documentation is clear, and the community support is excellent. I highly recommend MCPhoenix to anyone looking for a reliable and efficient solution. Check it out on GitHub here: https://github.com/jmanhype/MCPhoenix.