Skip to content

Commit d5e5dfe

Browse files
committed
configurable transport
1 parent 8ad1db5 commit d5e5dfe

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

src/common/config.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
load_dotenv()
66

7+
MCP_TRANSPORT = os.getenv('MCP_TRANSPORT', 'stdio')
8+
79
REDIS_CFG = {"host": os.getenv('REDIS_HOST', '127.0.0.1'),
810
"port": int(os.getenv('REDIS_PORT',6379)),
911
"username": os.getenv('REDIS_USERNAME', None),

src/common/connection.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ class RedisConnectionManager:
1515
def get_connection(cls, decode_responses=True) -> Redis:
1616
if cls._instance is None:
1717
try:
18-
print("Initializing Redis connection", file=sys.stderr)
1918
cls._instance = redis.Redis(
2019
host=REDIS_CFG["host"],
2120
port=REDIS_CFG["port"],

src/main.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import sys
2+
13
from common.connection import RedisConnectionManager
24
from common.server import mcp
35
import tools.server_management
@@ -11,14 +13,15 @@
1113
import tools.set
1214
import tools.stream
1315
import tools.pub_sub
16+
from common.config import MCP_TRANSPORT
1417

1518

1619
class RedisMCPServer:
1720
def __init__(self):
18-
redis_client = RedisConnectionManager.get_connection(decode_responses=False)
21+
print("Starting the RedisMCPServer", file=sys.stderr)
1922

2023
def run(self):
21-
mcp.run(transport='stdio')
24+
mcp.run(transport=MCP_TRANSPORT)
2225

2326
if __name__ == "__main__":
2427
server = RedisMCPServer()

0 commit comments

Comments
 (0)