luma-mcp 1.2.2 → 1.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/CHANGELOG.md +13 -1
  2. package/build/image-processor.d.ts +1 -2
  3. package/build/image-processor.d.ts.map +1 -1
  4. package/build/image-processor.js +55 -69
  5. package/build/image-processor.js.map +1 -1
  6. package/build/index.d.ts +1 -1
  7. package/build/index.js +52 -60
  8. package/build/index.js.map +1 -1
  9. package/build/vision-client.d.ts.map +1 -1
  10. package/package.json +1 -1
  11. package/minimax_coding_plan_mcp-0.0.2/.env.test +0 -4
  12. package/minimax_coding_plan_mcp-0.0.2/LICENSE +0 -21
  13. package/minimax_coding_plan_mcp-0.0.2/PKG-INFO +0 -200
  14. package/minimax_coding_plan_mcp-0.0.2/README.md +0 -143
  15. package/minimax_coding_plan_mcp-0.0.2/minimax_coding_plan_mcp.egg-info/PKG-INFO +0 -200
  16. package/minimax_coding_plan_mcp-0.0.2/minimax_coding_plan_mcp.egg-info/SOURCES.txt +0 -17
  17. package/minimax_coding_plan_mcp-0.0.2/minimax_coding_plan_mcp.egg-info/dependency_links.txt +0 -1
  18. package/minimax_coding_plan_mcp-0.0.2/minimax_coding_plan_mcp.egg-info/entry_points.txt +0 -2
  19. package/minimax_coding_plan_mcp-0.0.2/minimax_coding_plan_mcp.egg-info/requires.txt +0 -20
  20. package/minimax_coding_plan_mcp-0.0.2/minimax_coding_plan_mcp.egg-info/top_level.txt +0 -1
  21. package/minimax_coding_plan_mcp-0.0.2/minimax_mcp/__init__.py +0 -3
  22. package/minimax_coding_plan_mcp-0.0.2/minimax_mcp/__main__.py +0 -99
  23. package/minimax_coding_plan_mcp-0.0.2/minimax_mcp/__pycache__/__init__.cpython-313.pyc +0 -0
  24. package/minimax_coding_plan_mcp-0.0.2/minimax_mcp/__pycache__/client.cpython-313.pyc +0 -0
  25. package/minimax_coding_plan_mcp-0.0.2/minimax_mcp/__pycache__/const.cpython-313.pyc +0 -0
  26. package/minimax_coding_plan_mcp-0.0.2/minimax_mcp/__pycache__/exceptions.cpython-313.pyc +0 -0
  27. package/minimax_coding_plan_mcp-0.0.2/minimax_mcp/__pycache__/utils.cpython-313.pyc +0 -0
  28. package/minimax_coding_plan_mcp-0.0.2/minimax_mcp/client.py +0 -104
  29. package/minimax_coding_plan_mcp-0.0.2/minimax_mcp/const.py +0 -4
  30. package/minimax_coding_plan_mcp-0.0.2/minimax_mcp/exceptions.py +0 -24
  31. package/minimax_coding_plan_mcp-0.0.2/minimax_mcp/server.py +0 -169
  32. package/minimax_coding_plan_mcp-0.0.2/minimax_mcp/utils.py +0 -101
  33. package/minimax_coding_plan_mcp-0.0.2/pyproject.toml +0 -59
  34. package/minimax_coding_plan_mcp-0.0.2/setup.cfg +0 -4
  35. package/minimax_coding_plan_mcp-0.0.2/setup.py +0 -6
  36. package/minimax_coding_plan_mcp-0.0.2/test_at_prefix.py +0 -134
  37. package/minimax_coding_plan_mcp-0.0.2/test_real_image.py +0 -153
@@ -1,134 +0,0 @@
1
- #!/usr/bin/env python3
2
- """
3
- Test script to verify @ prefix handling
4
- """
5
-
6
- import sys
7
- import os
8
-
9
- # Add parent directory to path
10
- sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
11
-
12
- from minimax_mcp.utils import strip_at_prefix, process_image_url
13
- from minimax_mcp.exceptions import MinimaxRequestError
14
-
15
-
16
- def test_strip_at_prefix():
17
- """Test @ prefix removal"""
18
- print("Testing strip_at_prefix()...")
19
-
20
- # Test cases
21
- test_cases = [
22
- ("@test-minimax-image/image.png", "test-minimax-image/image.png"),
23
- ("@folder/subfolder/image.jpg", "folder/subfolder/image.jpg"),
24
- ("./normal/path.png", "./normal/path.png"),
25
- ("D:\\images\\test.png", "D:\\images\\test.png"),
26
- ("https://example.com/image.jpg", "https://example.com/image.jpg"),
27
- ("data:image/png;base64,abc123", "data:image/png;base64,abc123"),
28
- ]
29
-
30
- all_passed = True
31
- for input_path, expected in test_cases:
32
- result = strip_at_prefix(input_path)
33
- passed = result == expected
34
- status = "✅ PASS" if passed else "❌ FAIL"
35
- print(f"{status}: '{input_path}' -> '{result}' (expected: '{expected}')")
36
- if not passed:
37
- all_passed = False
38
-
39
- return all_passed
40
-
41
-
42
- def test_process_image_url_with_at_prefix():
43
- """Test process_image_url with @ prefix"""
44
- print("\nTesting process_image_url() with @ prefix...")
45
-
46
- # Create a test image file
47
- test_image_path = "test_image_for_at_prefix.png"
48
-
49
- # Create a simple 1x1 PNG
50
- import base64
51
- tiny_png_base64 = "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg=="
52
- with open(test_image_path, "wb") as f:
53
- f.write(base64.b64decode(tiny_png_base64))
54
-
55
- try:
56
- # Test with @ prefix
57
- result = process_image_url(f"@{test_image_path}")
58
- print(f"✅ PASS: Successfully processed '@{test_image_path}'")
59
- print(f" Result starts with: {result[:50]}...")
60
-
61
- # Test without @ prefix
62
- result2 = process_image_url(test_image_path)
63
- print(f"✅ PASS: Successfully processed '{test_image_path}' (without @)")
64
-
65
- # Results should be identical
66
- if result == result2:
67
- print(f"✅ PASS: Results are identical (@ prefix correctly removed)")
68
- return True
69
- else:
70
- print(f"❌ FAIL: Results differ")
71
- return False
72
-
73
- except Exception as e:
74
- print(f"❌ FAIL: {str(e)}")
75
- return False
76
- finally:
77
- # Cleanup
78
- if os.path.exists(test_image_path):
79
- os.remove(test_image_path)
80
-
81
-
82
- def test_nonexistent_file_with_at_prefix():
83
- """Test error message with @ prefix on nonexistent file"""
84
- print("\nTesting error message with @ prefix on nonexistent file...")
85
-
86
- try:
87
- process_image_url("@nonexistent/file.png")
88
- print("❌ FAIL: Should have raised MinimaxRequestError")
89
- return False
90
- except MinimaxRequestError as e:
91
- error_msg = str(e)
92
- # Error message should NOT contain @ prefix
93
- if "@" not in error_msg and "nonexistent/file.png" in error_msg:
94
- print(f"✅ PASS: Error message correctly shows path without @")
95
- print(f" Error: {error_msg}")
96
- return True
97
- else:
98
- print(f"❌ FAIL: Error message still contains @ or incorrect path")
99
- print(f" Error: {error_msg}")
100
- return False
101
- except Exception as e:
102
- print(f"❌ FAIL: Wrong exception type: {type(e).__name__}: {str(e)}")
103
- return False
104
-
105
-
106
- if __name__ == "__main__":
107
- print("=" * 60)
108
- print("Testing @ Prefix Handling in minimax_mcp")
109
- print("=" * 60)
110
-
111
- results = []
112
-
113
- results.append(("strip_at_prefix", test_strip_at_prefix()))
114
- results.append(("process_image_url with @", test_process_image_url_with_at_prefix()))
115
- results.append(("error message with @", test_nonexistent_file_with_at_prefix()))
116
-
117
- print("\n" + "=" * 60)
118
- print("Test Summary")
119
- print("=" * 60)
120
-
121
- all_passed = True
122
- for name, passed in results:
123
- status = "✅ PASS" if passed else "❌ FAIL"
124
- print(f"{status}: {name}")
125
- if not passed:
126
- all_passed = False
127
-
128
- print("=" * 60)
129
- if all_passed:
130
- print("✅ All tests passed!")
131
- sys.exit(0)
132
- else:
133
- print("❌ Some tests failed")
134
- sys.exit(1)
@@ -1,153 +0,0 @@
1
- #!/usr/bin/env python3
2
- """
3
- Real API test with actual image and API key
4
- """
5
-
6
- import sys
7
- import os
8
- from dotenv import load_dotenv
9
-
10
- # Load test environment
11
- load_dotenv('.env.test')
12
-
13
- # Add parent directory to path
14
- sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
15
-
16
- from minimax_mcp.utils import process_image_url
17
- from minimax_mcp.client import MinimaxAPIClient
18
- from minimax_mcp.exceptions import MinimaxRequestError
19
-
20
-
21
- def test_real_image_with_at_prefix(image_path: str, prompt: str = "请详细描述这张图片的内容,包括画面中的主要元素、文字信息、场景等所有细节"):
22
- """
23
- Test with real image using actual MiniMax API
24
-
25
- Args:
26
- image_path: Path to the image (can have @ prefix)
27
- prompt: Analysis prompt
28
- """
29
- print("=" * 60)
30
- print("Real Image Test with MiniMax API")
31
- print("=" * 60)
32
-
33
- # Get API credentials
34
- api_key = os.getenv('MINIMAX_API_KEY')
35
- api_host = os.getenv('MINIMAX_API_HOST')
36
-
37
- if not api_key or api_key == 'your-api-key-here':
38
- print("❌ Error: Please set MINIMAX_API_KEY in .env.test file")
39
- print(" Edit .env.test and add your actual API key")
40
- return False
41
-
42
- if not api_host:
43
- print("❌ Error: MINIMAX_API_HOST not set")
44
- return False
45
-
46
- print(f"API Host: {api_host}")
47
- print(f"API Key: {api_key[:10]}...{api_key[-4:]}")
48
- print()
49
-
50
- # Test 1: With @ prefix
51
- print("Test 1: With @ prefix")
52
- print("-" * 60)
53
- print(f"Original path: @{image_path}")
54
-
55
- try:
56
- # Process image
57
- print("Processing image...")
58
- processed_image_url = process_image_url(f"@{image_path}")
59
- print(f"✅ Image processed successfully")
60
- print(f" Data URI length: {len(processed_image_url)} chars")
61
- print(f" First 50 chars: {processed_image_url[:50]}...")
62
-
63
- # Call API
64
- print("\nCalling MiniMax API...")
65
- client = MinimaxAPIClient(api_key, api_host)
66
-
67
- payload = {
68
- "prompt": prompt,
69
- "image_url": processed_image_url
70
- }
71
-
72
- response = client.post("/v1/coding_plan/vlm", json=payload)
73
-
74
- content = response.get("content", "")
75
- if content:
76
- print(f"✅ API call successful!")
77
- print("\n" + "=" * 60)
78
- print("Response:")
79
- print("=" * 60)
80
- print(content)
81
- print("=" * 60)
82
- return True
83
- else:
84
- print("❌ No content in response")
85
- print(f"Response: {response}")
86
- return False
87
-
88
- except Exception as e:
89
- print(f"❌ Test failed: {str(e)}")
90
- import traceback
91
- traceback.print_exc()
92
- return False
93
-
94
-
95
- def test_without_at_prefix(image_path: str, prompt: str = "请详细描述这张图片的内容"):
96
- """
97
- Test without @ prefix for comparison
98
- """
99
- print("\n\nTest 2: Without @ prefix (for comparison)")
100
- print("-" * 60)
101
- print(f"Original path: {image_path}")
102
-
103
- try:
104
- processed_image_url = process_image_url(image_path)
105
- print(f"✅ Image processed successfully")
106
- print(f" Data URI length: {len(processed_image_url)} chars")
107
- return True
108
- except Exception as e:
109
- print(f"❌ Test failed: {str(e)}")
110
- return False
111
-
112
-
113
- if __name__ == "__main__":
114
- if len(sys.argv) < 2:
115
- print("Usage: python test_real_image.py <image_path> [prompt]")
116
- print("\nExample:")
117
- print(" python test_real_image.py test-image.png")
118
- print(" python test_real_image.py test-image.png \"描述这张图片\"")
119
- print("\nNote: Image path should NOT include @ prefix in command line")
120
- print(" The script will automatically test both with and without @")
121
- sys.exit(1)
122
-
123
- image_path = sys.argv[1]
124
- prompt = sys.argv[2] if len(sys.argv) > 2 else "请详细描述这张图片的内容,包括画面中的主要元素、文字信息、场景等所有细节"
125
-
126
- # Verify image exists
127
- if not os.path.exists(image_path):
128
- print(f"❌ Error: Image file not found: {image_path}")
129
- sys.exit(1)
130
-
131
- print(f"Testing with image: {image_path}")
132
- print(f"Prompt: {prompt}")
133
- print()
134
-
135
- # Test with @ prefix (calls real API)
136
- result1 = test_real_image_with_at_prefix(image_path, prompt)
137
-
138
- # Test without @ prefix (just image processing)
139
- result2 = test_without_at_prefix(image_path, prompt)
140
-
141
- print("\n" + "=" * 60)
142
- print("Test Summary")
143
- print("=" * 60)
144
- print(f"{'✅' if result1 else '❌'} Test 1: With @ prefix (real API call)")
145
- print(f"{'✅' if result2 else '❌'} Test 2: Without @ prefix (image processing)")
146
- print("=" * 60)
147
-
148
- if result1 and result2:
149
- print("✅ All tests passed!")
150
- sys.exit(0)
151
- else:
152
- print("❌ Some tests failed")
153
- sys.exit(1)