Skip to content

Commit 314a9cb

Browse files
Merge pull request #30 from SemClone/fix/osslili-informational-output-parsing
fix: Handle osslili informational output in download_and_scan_package (v1.6.1)
2 parents 99c6837 + 329d6e6 commit 314a9cb

File tree

5 files changed

+46
-4
lines changed

5 files changed

+46
-4
lines changed

CHANGELOG.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,43 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [1.6.1] - 2025-01-13
11+
12+
### Fixed
13+
14+
#### download_and_scan_package: Handle osslili Informational Output
15+
16+
**Problem:**
17+
The `download_and_scan_package` tool was failing with JSON parsing errors when osslili outputs informational messages before JSON output. osslili now prefixes output with messages like:
18+
```
19+
ℹ Processing local path: package.tar.gz
20+
```
21+
22+
This caused `json.loads()` to fail with "Expecting value: line 1 column 1 (char 0)"
23+
24+
**Root Cause:**
25+
Line 2026 in server.py attempted to parse osslili stdout directly as JSON without stripping informational messages.
26+
27+
**Solution:**
28+
Added preprocessing to find the first `{` character and parse JSON from that position, effectively stripping any informational messages before the JSON payload.
29+
30+
**Changes:**
31+
- mcp_semclone/server.py:
32+
* Added informational message stripping before JSON parsing (lines 2026-2031)
33+
* Finds first `{` in output and parses from there
34+
* Preserves backward compatibility with osslili versions that don't output messages
35+
36+
**Installation Note:**
37+
When using pipx, ensure `purl2src` is installed with console scripts enabled:
38+
```bash
39+
pipx inject mcp-semclone purl2src --include-apps --force
40+
```
41+
42+
**Impact:**
43+
- Tool now works correctly with latest osslili versions
44+
- All 7 tests passing
45+
- Fixes download failures reported in the field
46+
1047
## [1.6.0] - 2025-01-13
1148

1249
### Added

examples/strands-agent-ollama/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Python 3.10+ required
33

44
# MCP server with SEMCL.ONE compliance tools
5-
mcp-semclone>=1.6.0
5+
mcp-semclone>=1.6.1
66

77
# MCP SDK for connecting to MCP servers
88
mcp>=1.0.0

mcp_semclone/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""MCP SEMCL.ONE - Model Context Protocol server for OSS compliance."""
22

3-
__version__ = "1.6.0"
3+
__version__ = "1.6.1"
44
__author__ = "Oscar Valenzuela B."
55
__email__ = "oscar.valenzuela.b@gmail.com"

mcp_semclone/server.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2023,7 +2023,12 @@ async def download_and_scan_package(
20232023
])
20242024

20252025
if osslili_result.returncode == 0 and osslili_result.stdout:
2026-
osslili_data = json.loads(osslili_result.stdout)
2026+
# Strip informational messages (e.g., "ℹ Processing local path...")
2027+
osslili_output = osslili_result.stdout
2028+
json_start = osslili_output.find('{')
2029+
if json_start != -1:
2030+
osslili_output = osslili_output[json_start:]
2031+
osslili_data = json.loads(osslili_output)
20272032

20282033
# Extract licenses from osslili
20292034
if osslili_data.get("components"):

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "mcp-semclone"
7-
version = "1.6.0"
7+
version = "1.6.1"
88
description = "Model Context Protocol server for SEMCL.ONE OSS compliance toolchain"
99
readme = "README.md"
1010
requires-python = ">=3.10"

0 commit comments

Comments
 (0)