Skip to content

Commit

Permalink
use mcpx docker transport
Browse files Browse the repository at this point in the history
  • Loading branch information
SecretiveShell committed Jan 18, 2025
1 parent 05af1b9 commit a6e4d8e
Show file tree
Hide file tree
Showing 6 changed files with 73 additions and 152 deletions.
7 changes: 1 addition & 6 deletions mcp_bridge/config/final.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from pydantic import BaseModel, Field

from mcp.client.stdio import StdioServerParameters
from mcpx.client.transports.docker import DockerMCPServer


class InferenceServer(BaseModel):
Expand Down Expand Up @@ -36,12 +37,6 @@ class SSEMCPServer(BaseModel):
# TODO: expand this once I find a good definition for this
url: str = Field(description="URL of the MCP server")

class DockerMCPServer(BaseModel):
container_name: str | None = Field(default=None, description="Name of the docker container")
image: str = Field(description="Image of the docker container")
args: list[str] = Field(default_factory=list, description="Command line arguments for the docker container")
env: dict[str, str] = Field(default_factory=dict, description="Environment variables for the docker container")


MCPServer = Annotated[
Union[StdioServerParameters, SSEMCPServer, DockerMCPServer],
Expand Down
4 changes: 1 addition & 3 deletions mcp_bridge/mcp_clients/DockerClient.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import asyncio
from mcp import ClientSession

from mcp_bridge.mcp_clients.session import McpClientSession
from .transports.docker import docker_client
from mcp_bridge.config import config
from mcp_bridge.config.final import DockerMCPServer
from mcpx.client.transports.docker import docker_client, DockerMCPServer
from .AbstractClient import GenericMcpClient
from loguru import logger

Expand Down
13 changes: 8 additions & 5 deletions mcp_bridge/mcp_clients/McpClientManager.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
from typing import Union
from mcp_bridge.config import config
from mcp import McpError, StdioServerParameters

from loguru import logger
from mcp import McpError, StdioServerParameters
from mcpx.client.transports.docker import DockerMCPServer

from mcp_bridge.config import config
from mcp_bridge.config.final import SSEMCPServer

from .StdioClient import StdioClient
from .SseClient import SseClient
from .DockerClient import DockerClient
from mcp_bridge.config.final import DockerMCPServer, SSEMCPServer
from .SseClient import SseClient
from .StdioClient import StdioClient

client_types = Union[StdioClient, SseClient, DockerClient]

Expand Down
94 changes: 0 additions & 94 deletions mcp_bridge/mcp_clients/transports/docker.py

This file was deleted.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ description = "A middleware to provide an openAI compatible endpoint that can ca
readme = "README.md"
requires-python = ">=3.11"
dependencies = [
"aiodocker>=0.24.0",
"deepmerge>=2.0",
"fastapi>=0.115.6",
"httpx>=0.28.1",
"httpx-sse>=0.4.0",
"lmos-openai-types",
"loguru>=0.7.3",
"mcp>=1.2.0",
"mcpx[docker]>=0.1.1",
"pydantic>=2.10.4",
"pydantic-settings>=2.7.0",
"sse-starlette>=2.2.0",
Expand Down
Loading

0 comments on commit a6e4d8e

Please sign in to comment.