MCP Server with Docker

MIT License
  • Linux
  • Apple

Integrations

  • Enables the MCP server to run inside Docker containers, providing tool access while maintaining isolation and portability.

  • Provides integration with OpenAI's API, allowing OpenAI models to access and use tools exposed by the MCP server for retrieving information like knowledge base data.

Docker를 사용한 MCP 서버

이 프로젝트는 MCP(모델 제어 프로토콜)를 OpenAI의 API와 통합하는 방법을 보여줍니다. 이를 통해 OpenAI가 Docker에서 실행되는 MCP 서버에서 노출된 도구에 액세스하여 사용할 수 있습니다.

필수 조건

  • 시스템에 Docker가 설치됨
  • Git(저장소 복제)

프로젝트 구조

  • server.py : 도구를 사용한 MCP 서버 구현
  • client.py : 서버에 연결하고 에이전트를 호출하는 클라이언트
  • Dockerfile : Docker 이미지를 빌드하기 위한 지침
  • requirements.txt : 프로젝트에 대한 Python 종속성

데이터 흐름 설명

  1. 사용자 쿼리 : 사용자가 시스템에 쿼리를 보냅니다(예: "우리 회사의 휴가 정책은 무엇입니까?").
  2. OpenAI API : OpenAI는 MCP 서버로부터 쿼리와 사용 가능한 도구를 수신합니다.
  3. 도구 선택 : OpenAI는 쿼리를 기반으로 사용할 도구를 결정합니다.
  4. MCP 클라이언트 : 클라이언트는 OpenAI의 도구 호출 요청을 수신하여 MCP 서버로 전달합니다.
  5. MCP 서버 : 서버는 요청된 도구(예: 지식 기반 데이터 검색)를 실행합니다.
  6. 응답 흐름 : 도구 결과는 MCP 클라이언트를 통해 OpenAI로 다시 흐릅니다.
  7. 최종 응답 : OpenAI는 도구 데이터를 통합하여 최종 응답을 생성합니다.

Docker로 실행

1단계: Docker 이미지 빌드

지엑스피1

2단계: Docker 컨테이너 실행

docker run -p 8050:8050 mcp-server

이렇게 하면 Docker 컨테이너 내부에서 MCP 서버가 시작되고 포트 8050에 노출됩니다.

클라이언트 실행

서버가 실행되면 별도의 터미널에서 클라이언트를 실행할 수 있습니다.

python client.py

클라이언트는 서버에 연결하여 사용 가능한 도구를 나열하고, 에이전트에게 전화하여 쿼리에 답변합니다.

문제 해결

연결 문제가 발생하는 경우:

  1. 서버가 실행 중인지 확인하세요 : docker ps 로 Docker 컨테이너가 실행 중인지 확인하세요.
  2. 포트 매핑 확인 : docker ps 사용하거나 docker run 명령의 출력을 확인하여 포트가 올바르게 매핑되었는지 확인합니다.
  3. 서버 로그 확인 : docker logs <container_id> 로 서버 로그를 보고 오류가 있는지 확인하세요.
  4. 호스트 바인딩 : 컨테이너 외부에서 접근할 수 있도록 서버가 127.0.0.1 대신 0.0.0.0 에 바인딩되도록 구성되었습니다. 문제가 지속되면 방화벽 설정을 확인해야 할 수 있습니다.
  5. 네트워크 문제 : 원격 컴퓨터에서 Docker를 실행하는 경우 클라이언트 컴퓨터에서 포트에 액세스할 수 있는지 확인하세요.

노트

  • 서버는 SSE(Server-Sent Events) 전송을 사용하도록 구성되어 있으며 포트 8050에서 수신합니다.
  • 클라이언트는 http://localhost:8050/sse 에서 서버에 연결합니다.
  • 클라이언트를 시작하기 전에 서버가 실행 중인지 확인하세요.
-
security - not tested
A
license - permissive license
-
quality - not tested

모델 제어 프로토콜을 OpenAI의 API와 통합하여 OpenAI가 도커화된 MCP 서버에서 노출된 도구에 액세스하고 활용할 수 있도록 하는 프로젝트입니다.

  1. Prerequisites
    1. Project Structure
      1. Data Flow Explanation
    2. Running with Docker
      1. Step 1: Build the Docker image
      2. Step 2: Run the Docker container
    3. Running the Client
      1. Troubleshooting
        1. Notes

          Related MCP Servers

          • -
            security
            A
            license
            -
            quality
            A Model Context Protocol (MCP) server that lets you seamlessly use OpenAI's models right from Claude.
            Last updated -
            1
            24
            28
            JavaScript
            MIT License
            • Apple
          • -
            security
            A
            license
            -
            quality
            A simple MCP server for interacting with OpenAI assistants. This server allows other tools (like Claude Desktop) to create and interact with OpenAI assistants through the Model Context Protocol.
            Last updated -
            18
            Python
            MIT License
            • Apple
          • A
            security
            A
            license
            A
            quality
            Enables integration with OpenAI models through the MCP protocol, supporting concise and detailed responses for use with Claude Desktop.
            Last updated -
            1
            1
            Python
            MIT License
            • Apple
            • Linux
          • -
            security
            F
            license
            -
            quality
            A Model Context Protocol server implementation that enables connection between OpenAI APIs and MCP clients for coding assistance with features like CLI interaction, web API integration, and tool-based architecture.
            Last updated -
            9
            Python
            • Linux
            • Apple

          View all related MCP servers

          ID: yu6qfxkcxv