Skip to main content
Glama

MyAIServ MCP Server

MCP 서버 - 모델 컨텍스트 프로토콜 API

MCP 서버는 LLM 모델과 애플리케이션 간의 상호작용을 위한 표준화된 인터페이스를 제공하는 모델 컨텍스트 프로토콜(MCP)의 FastAPI 기반 구현입니다.

특이점

  • 🚀 FastAPI 및 비동기 작업을 기반으로 한 고성능 API
  • 🔄 리소스, 악기, 프롬프트 및 샘플링을 포함한 전체 MCP 지원
  • 📊 Prometheus 및 Grafana를 통한 모니터링 및 메트릭
  • 🧩 새로운 도구를 추가하기 위한 간단한 인터페이스를 통한 확장성
  • 📝 유연한 데이터 작업을 위한 GraphQL API
  • 💬 실시간 상호작용을 위한 WebSocket 지원
  • 🔍 Elasticsearch와 통합을 통한 의미 검색
  • 🗃️ Redis를 통한 캐싱 으로 성능 향상
  • 📦 Poetry를 통해 종속성을 관리하여 안정적인 패키지 관리를 제공합니다.

시작하기

설치

  1. 복제 저장소:지엑스피1
  2. Poetry를 설치하세요(아직 설치되지 않은 경우):
    curl -sSL https://install.python-poetry.org | python3 -
  3. Poetry를 통해 종속성 설치:
    poetry install

서버 시작

poetry run uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload

또는 just 유틸리티를 통해서:

just run

출시 후 API는 http://localhost:8000 에서 사용 가능합니다.

API 문서

프로젝트 구조

myaiserv/ ├── app/ │ ├── core/ # Базовые компоненты MCP │ │ ├── base_mcp.py # Абстрактные классы MCP │ │ └── base_sampling.py # Базовые классы для сэмплирования │ ├── models/ # Pydantic модели │ │ ├── mcp.py # Модели данных MCP │ │ └── graphql.py # GraphQL схема │ ├── services/ # Бизнес-логика │ │ └── mcp_service.py # Сервис MCP │ ├── storage/ # Хранилище данных │ ├── tools/ # Инструменты MCP │ │ ├── example_tool.py # Примеры инструментов │ │ └── text_processor.py # Инструмент обработки текста │ ├── utils/ # Утилиты │ └── main.py # Точка входа FastAPI ├── app/tests/ # Тесты ├── docs/ # Документация │ └── MCP_API.md # Описание API ├── pyproject.toml # Конфигурация Poetry и инструментов └── .justfile # Задачи для утилиты just

사용 가능한 도구

파일 시스템 도구

파일 읽기, 쓰기, 삭제, 나열 기능을 지원하는 파일 시스템 도구입니다.

curl -X POST "http://localhost:8000/tools/file_operations" \ -H "Content-Type: application/json" \ -d '{"operation": "list", "path": "."}'

날씨 도구

좌표로 날씨 데이터를 얻는 도구입니다.

curl -X POST "http://localhost:8000/tools/weather" \ -H "Content-Type: application/json" \ -d '{"latitude": 37.7749, "longitude": -122.4194}'

텍스트 분석 도구

감정 감지 및 요약을 포함한 텍스트 분석을 위한 도구입니다.

curl -X POST "http://localhost:8000/tools/text_analysis" \ -H "Content-Type: application/json" \ -d '{"text": "Example text for analysis", "analysis_type": "sentiment"}'

텍스트 프로세서 도구

서식 지정, 통계 계산, 엔터티 추출 등을 포함한 텍스트 처리를 위한 도구입니다.

curl -X POST "http://localhost:8000/tools/text_processor" \ -H "Content-Type: application/json" \ -d '{"operation": "statistics", "text": "Example text", "stat_options": ["chars", "words"]}'

이미지 처리 도구

크기 조절, 자르기, 필터 적용을 지원하는 이미지 처리 도구입니다.

curl -X POST "http://localhost:8000/tools/image_processing" \ -H "Content-Type: application/json" \ -d '{"operation": "resize", "image_data": "base64...", "params": {"width": 800, "height": 600}}'

웹소켓 API

WebSocket API에 연결하려면:

const socket = new WebSocket("ws://localhost:8000/ws"); socket.onopen = () => { socket.send(JSON.stringify({ type: "initialize", id: "my-request-id" })); }; socket.onmessage = (event) => { const data = JSON.parse(event.data); console.log("Received:", data); };

GraphQL API

GraphQL을 통한 쿼리의 예:

# Получение списка всех инструментов query { getTools { name description } } # Выполнение инструмента mutation { executeTool(input: { name: "text_processor", parameters: { operation: "statistics", text: "Example text for analysis" } }) { content { type text } is_error } }

테스트 실행

테스트를 실행하려면 Poetry를 사용하세요.

poetry run pytest

또는 just 유틸리티를 통해서:

just test

도커

Docker Compose를 통한 빌드 및 실행

docker compose up -d

개별 서비스를 시작하려면:

docker compose up -d web redis elasticsearch

LLM과의 통합

MCP 서버는 다양한 공급업체의 LLM 모델과의 통합을 위한 표준화된 인터페이스를 제공합니다.

import httpx async def query_mcp_with_llm(prompt: str): async with httpx.AsyncClient() as client: # Запрос к MCP для получения контекста и инструментов tools_response = await client.get("http://localhost:8000/tools") tools = tools_response.json()["tools"] # Отправка запроса к LLM с включением MCP контекста llm_response = await client.post( "https://api.example-llm.com/v1/chat", json={ "messages": [ {"role": "system", "content": "You have access to the following tools:"}, {"role": "user", "content": prompt} ], "tools": tools, "tool_choice": "auto" } ) return llm_response.json()

지표 및 모니터링

MCP 서버는 /metrics 엔드포인트를 통해 Prometheus 형식의 메트릭을 제공합니다. 측정항목은 다음과 같습니다.

  • 각 도구에 대한 요청 수
  • 쿼리 실행 시간
  • 오류 및 예외

개발

코드를 포맷하고 린터로 확인하려면 다음을 수행합니다.

just fmt just lint

특허

MIT 라이센스

-
security - not tested
A
license - permissive license
-
quality - not tested

hybrid server

The server is able to function both locally and remotely, depending on the configuration or use case.

대규모 언어 모델과의 원활한 통합을 위한 모델 컨텍스트 프로토콜(MCP)을 지원하는 고성능 FastAPI 서버로, REST, GraphQL, WebSocket API와 실시간 모니터링 및 벡터 검색 기능을 제공합니다.

  1. 특이점
    1. 시작하기
      1. 설치
      2. 서버 시작
      3. API 문서
    2. 프로젝트 구조
      1. 사용 가능한 도구
        1. 파일 시스템 도구
        2. 날씨 도구
        3. 텍스트 분석 도구
        4. 텍스트 프로세서 도구
        5. 이미지 처리 도구
      2. 웹소켓 API
        1. GraphQL API
          1. 테스트 실행
            1. 도커
              1. Docker Compose를 통한 빌드 및 실행
            2. LLM과의 통합
              1. 지표 및 모니터링
                1. 개발
                  1. 특허

                    Related MCP Servers

                    • -
                      security
                      F
                      license
                      -
                      quality
                      A Model Context Protocol server that integrates with Cursor IDE, providing real-time communication, modern web dashboards, and extensible tools via SSE and WebSocket connections.
                      Last updated -
                      839
                      1
                      Python
                    • -
                      security
                      A
                      license
                      -
                      quality
                      A server that enables Large Language Models to discover and interact with REST APIs defined by OpenAPI specifications through the Model Context Protocol.
                      Last updated -
                      378
                      96
                      TypeScript
                      MIT License
                      • Apple
                    • -
                      security
                      F
                      license
                      -
                      quality
                      A Model Context Protocol server implementation that enables seamless integration with Claude and other MCP-compatible clients to access Prem AI's language models, RAG capabilities, and document management features.
                      Last updated -
                      JavaScript
                    • -
                      security
                      A
                      license
                      -
                      quality
                      A Model Context Protocol server that exposes over 200+ APIs from API.market as MCP resources, allowing large language models to discover and interact with various APIs through natural language commands.
                      Last updated -
                      111
                      2
                      TypeScript
                      MIT License
                      • Apple

                    View all related MCP servers

                    MCP directory API

                    We provide all the information about MCP servers via our MCP API.

                    curl -X GET 'https://glama.ai/api/mcp/v1/servers/eagurin/myaiserv'

                    If you have feedback or need assistance with the MCP directory API, please join our Discord server