init commit, added server and client

This commit is contained in:
2026-01-23 14:26:21 +01:00
parent 412fbdef48
commit a34633eaee
12 changed files with 1117 additions and 1 deletions

41
mcpServer/main.py Normal file
View File

@@ -0,0 +1,41 @@
import os
from mcp.server.fastmcp import FastMCP
from modules.filesystem import internal_listFiles, internal_readFile, internal_writeFile, internal_executeCommand, internal_writePythonFile
mcpServer = FastMCP(
"Cariddi",
host=os.getenv("FASTMCP_HOST", os.getenv("MCP_HOST", "0.0.0.0")),
port=int(os.getenv("FASTMCP_PORT", os.getenv("MCP_PORT", "8000"))),
)
@mcpServer.tool()
def listFiles(path: str) -> list[str]:
"""List all files in the given path"""
return internal_listFiles(path)
@mcpServer.tool()
def readFile(path: str) -> str:
"""Read the contents of a file"""
return internal_readFile(path)
@mcpServer.tool()
def writeFile(path: str, content: str) -> bool:
"""Write the contents of a file"""
return internal_writeFile(path, content)
@mcpServer.tool()
def executeCommand(command: str) -> dict:
"""Execute a command"""
return internal_executeCommand(command)
@mcpServer.tool()
def writePythonFile(path: str, content: str) -> str:
"""Write a Python file handling streaming and escape characters correctly."""
return internal_writePythonFile(path, content)
if __name__ == "__main__":
try:
mcpServer.run(transport="streamable-http")
except KeyboardInterrupt:
print("Server stopped by user")