Refactor MCP server and enhance development environment

This commit refactors the MCP server implementation, updates the Dockerfile with new development tools and dependencies, introduces a Makefile for building and running the application, and adds utility modules for sandbox management and Ollama integration. The server name has also been updated from 'echo-server' to 'PMO-Crazy-coder' in the configuration.
This commit is contained in:
2026-01-25 17:24:46 +01:00
parent 9f9d9bc3b3
commit 766b90a548
16 changed files with 536 additions and 8 deletions

1
src/jujutsu/__init__.py Normal file
View File

@@ -0,0 +1 @@
from .command import jj

87
src/jujutsu/command.py Normal file
View File

@@ -0,0 +1,87 @@
import json
import subprocess
from typing import List, Optional
def jj(
subcommand: str,
options: Optional[List[str]] = None,
args: Optional[List[str]] = None,
template: Optional[str] = None,
) -> str:
"""
Lance une commande jj.
Args:
subcommand: La sous-commande jj (ex: 'log', 'status', 'diff')
options: Liste des options (ex: ['--limit', '5'])
args: Liste des arguments additionnels
template: Template jj à utiliser (ex: 'builtin_log_compact')
Returns:
str: sortie de la commande
"""
cmd = ["jj", subcommand]
# Ajoute le template spécifié
if template:
cmd.extend(["--template", template])
if options:
cmd.extend(options)
if args:
cmd.extend(args)
result = subprocess.run(cmd, capture_output=True, text=True)
if result.returncode != 0:
raise RuntimeError(
f"Commande jj échouée: {' '.join(cmd)}\nstderr: {result.stderr}"
)
return result.stdout
def jj_log(options=None, args=None, template=None):
"""
Execute jj log command with optional arguments.
Args:
options: List of options to pass to jj log (ex: ['--limit', '5'])
args: List of additional arguments
template: Template to use (ex: 'builtin_log_compact')
Returns:
str: Output of the jj log command
"""
return jj("log", options, args, template)
def jj_clone(url, destination=None, options=None):
"""
Execute jj git clone command.
Args:
url: The repository URL to clone
destination: The destination directory (optional)
options: List of additional options for jj git clone
Returns:
str: Output of the jj git clone command
"""
cmd = ["jj", "git", "clone", url]
if destination:
cmd.append(destination)
if options:
cmd.extend(options)
result = subprocess.run(cmd, capture_output=True, text=True)
if result.returncode != 0:
raise RuntimeError(
f"Commande jj git clone échouée: {' '.join(cmd)}\nstderr: {result.stderr}"
)
return result.stdout