From b740378a906a28b554982d607934f8b0b740ac1f Mon Sep 17 00:00:00 2001 From: George Antonopoulos Date: Sun, 29 Jun 2025 08:37:41 +0100 Subject: [PATCH] Update MCP server CLI and example script to include card_table_id in request handling - Add card_table_id to the required properties in MCPServer class. - Modify the move_column method to retrieve card_table_id from arguments. - Refactor subprocess call in card_table_example.py to use subprocess.run for better error handling. --- examples/card_table_example.py | 12 ++++++------ mcp_server_cli.py | 9 ++++----- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/examples/card_table_example.py b/examples/card_table_example.py index bf84927..1f108af 100644 --- a/examples/card_table_example.py +++ b/examples/card_table_example.py @@ -25,20 +25,20 @@ def send_mcp_request(method, params=None): } # Run the MCP server with the request - process = subprocess.Popen( + result = subprocess.run( [sys.executable, "mcp_server_cli.py"], - stdin=subprocess.PIPE, + input=json.dumps(request), stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True ) - stdout, stderr = process.communicate(input=json.dumps(request)) - - if process.returncode != 0: - print(f"Error: {stderr}") + if result.returncode != 0: + print(f"Error: {result.stderr}") return None + stdout = result.stdout + try: return json.loads(stdout) except json.JSONDecodeError as e: diff --git a/mcp_server_cli.py b/mcp_server_cli.py index 71b2f3a..357607d 100755 --- a/mcp_server_cli.py +++ b/mcp_server_cli.py @@ -240,10 +240,11 @@ class MCPServer: "type": "object", "properties": { "project_id": {"type": "string", "description": "The project ID"}, + "card_table_id": {"type": "string", "description": "The card table ID"}, "column_id": {"type": "string", "description": "The column ID"}, "position": {"type": "integer", "description": "The new 1-based position"} }, - "required": ["project_id", "column_id", "position"] + "required": ["project_id", "card_table_id", "column_id", "position"] } }, { @@ -840,16 +841,14 @@ class MCPServer: return { "status": "success", "column": column, - "message": f"Column updated successfully" + "message": "Column updated successfully" } elif tool_name == "move_column": project_id = arguments.get("project_id") + card_table_id = arguments.get("card_table_id") column_id = arguments.get("column_id") position = arguments.get("position") - # Get the card table ID from the project - card_table = client.get_card_table(project_id) - card_table_id = card_table['id'] client.move_column(project_id, column_id, position, card_table_id) return { "status": "success",