Cover image
Try Now
2025-04-14

Selector AI的MCP服务器和示例客户端

3 years

Works with Finder

1

Github Watches

1

Github Forks

2

Github Stars

Selector AI FastMCP

This repository provides a full implementation of the Model Context Protocol (MCP) for Selector AI. It includes a streaming-capable server and a Docker-based interactive client that communicates via stdin/stdout.

✨ Features

✅ Server

FastMCP-compatible and built on Python

Real-time SSE streaming support

Interactive AI chat with Selector AI

Minimal boilerplate

Built-in health check for container orchestration

Request/response logging and retries

✅ Client

Python client spawns server via Docker

Supports both CLI and programmatic access

Reads/writes via stdin and stdout

Environment variable configuration using .env

🚀 Quick Start

Prerequisites

Python 3.8+

Docker

A Selector AI API Key

Selector API URL

⚙️ Installation

Clone the Repository

git clone https://github.com/automateyournetwork/selector-mcp-server

cd selector-ai-mcp

Install Python Dependencies

pip install -r requirements.txt

Set Environment Variables Create a .env file:

SELECTOR_URL=https://your-selector-api-url

SELECTOR_AI_API_KEY=your-api-key

🐳 Dockerfile

The server runs in a lightweight container using the following Dockerfile:

FROM python:3.11-slim

WORKDIR /app

COPY requirements.txt .

RUN pip install -r requirements.txt

COPY . .

CMD ["python", "-u", "mcp_server.py"]

HEALTHCHECK --interval=30s --timeout=30s --start-period=5s
CMD python -c "import socket; s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM); s.connect('/tmp/mcp.sock'); s.send(b'{"tool_name": "ready"}\n'); data = s.recv(1024); s.close(); import json; result = json.loads(data); exit(0 if result.get('status') == 'ready' else 1)" || exit 1

Build the Docker Image

docker build -t selector-mcp .

🧠 Using the Client

Start the Client

This will spawn the Docker container and open an interactive shell.

python mcp_client.py

Example CLI Session

You> What is AIOps?

Selector> AIOps refers to the application of AI to IT operations...

Programmatic Access

from selector_client import call_tool, spawn_server

proc = spawn_server()

call_tool(proc, "ready")

response = call_tool(proc, "ask_selector", {"content": "What is AIOps?"})

print(response)

🖥️ Using with Claude Desktop

If you're integrating with Claude Desktop, you can run this server and expose a socket or HTTP endpoint locally:

Run the server using Docker or natively:

python mcp_server.py

Connect to the socket or HTTP endpoint from Claude Desktop's external tool configuration.

Ensure your messages match the format:

{
  "method": "tools/call",
  "tool_name": "ask_selector",
  "content": "What can you tell me about device S6?"
}

Claude Desktop will receive the AI's structured response via stdout.

🛠️ Build Your Own Container

To customize this setup:

Fork or clone this repo

Modify the selector_fastmcp_server.py to integrate your preferred model or routing logic

Rebuild the Docker image:

docker build -t my-custom-mcp .

Update the client to spawn my-custom-mcp instead:

"docker", "run", "-i", "--rm", "my-custom-mcp"

📁 Project Structure

selector-ai-mcp/

├── selector_fastmcp_server.py     # Server: MCP + Selector AI integration
├── selector_client.py             # Client: Docker + stdin/stdout CLI
├── Dockerfile                     # Container config
├── requirements.txt               # Python deps
├── .env                           # Environment secrets
└── README.md                      # You are here

✅ Requirements

Dependencies in requirements.txt:

requests

python-dotenv

📜 License

Apache License 2.0

相关推荐

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

  • 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.

  • Yasir Eryilmaz
  • AI scriptwriting assistant for short, engaging video content.

  • Alexandru Strujac
  • Efficient thumbnail creator for YouTube videos

  • J. DE HARO OLLE
  • Especialista en juegos de palabras en varios idiomas.

  • Daren White
  • A supportive coach for mastering all Spanish tenses.

  • albert tan
  • Japanese education, creating tailored learning experiences.

  • Beniyam Berhanu
  • Therapist adept at identifying core issues and offering practical advice with images.

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

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

  • huahuayu
  • 统一的API网关,用于将多个Etherscan样区块链Explorer API与对AI助手的模型上下文协议(MCP)支持。

  • deemkeen
  • 用电源组合控制您的MBOT2:MQTT+MCP+LLM

  • zhaoyunxing92
  • MCP(消息连接器协议)服务

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

    Reviews

    3 (1)
    Avatar
    user_n6AG2b1a
    2025-04-15

    XiYan MCP Server is an exceptional tool for managing and deploying server infrastructures. Created by MCP-Mirror, it offers a seamless experience in server performance and stability. The user-friendly interface and the comprehensive features make it a must-have for any serious IT professional. Highly recommended for its efficiency and reliability!