Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
89 commits
Select commit Hold shift + click to select a range
179f9f7
Initial commit for qr-code-server, created using scaffold script
cafalchio Nov 25, 2025
55eb79e
Added config.yaml based on requirements.
cafalchio Nov 26, 2025
c36fd49
feat: Implement configuration management for QR code generation - loa…
cafalchio Nov 26, 2025
efa5a4d
fix: Update dependencies in pyproject.toml for QR code server
cafalchio Nov 26, 2025
794c922
Refactored config.py
cafalchio Nov 29, 2025
0083efd
Added dev requirements to test and lint
cafalchio Nov 29, 2025
5b1ad4d
Add qr generation logic
cafalchio Nov 29, 2025
93f2fc8
"Fix lint issues in config.py"
cafalchio Nov 29, 2025
e938818
Improved qr_generator
cafalchio Nov 30, 2025
aee2017
Create a resolve_output_path function
cafalchio Dec 1, 2025
9aae91d
Fixed resolve output path not creating correct path
cafalchio Dec 1, 2025
b3fc55d
Added ImageAscii class to convert pillow image to ascii
cafalchio Dec 1, 2025
cfabab1
Refactored ImageAscii to be compatible to qrcode image factory
cafalchio Dec 1, 2025
114ee55
Refactored file.utils to not raise error and added filename + extensi…
cafalchio Dec 1, 2025
81b2b77
Refactored generator
cafalchio Dec 1, 2025
2d8f59a
Added tests for generator, covering 100%
cafalchio Dec 1, 2025
2977d1d
rename main folder from qr-code-serve to qr_code_server,
cafalchio Dec 1, 2025
6c6a9be
Fixed generator test creating output path
cafalchio Dec 2, 2025
13ab933
Fixed resolve output path to address filename without extension, it m…
cafalchio Dec 2, 2025
c25a3e7
Removed qr code file generated by a test
cafalchio Dec 2, 2025
5e4d3dc
Added validator and decoder file with request validation model
cafalchio Dec 2, 2025
3cf6a44
Improved image utils to handle batch qr code generation
cafalchio Dec 3, 2025
c08a7ff
Improved QRcode batch generator and added tests
cafalchio Dec 3, 2025
a2f63f5
Refactored Image utils
cafalchio Dec 3, 2025
e581c8c
Added create_batch_qr_codes to server and test_server
cafalchio Dec 3, 2025
7bed5f6
Added dependencies for QR code Decoder
cafalchio Dec 3, 2025
67137de
Fixed bugs in generator and improved test coverage
cafalchio Dec 4, 2025
1dcdaea
Added a load image for decoder
cafalchio Dec 5, 2025
a0c7efd
Added max data lenght validation for Qr generator
cafalchio Dec 5, 2025
a7adc1d
Added max image size error for decoder
cafalchio Dec 5, 2025
2274b1b
Added a function to decode string bytes size to bytes
cafalchio Dec 5, 2025
cb7f132
Added decoder validation for image format
cafalchio Dec 5, 2025
76d2fd4
Removed hard coded supported formats
cafalchio Dec 5, 2025
05f704b
Added request validations for validator
cafalchio Dec 5, 2025
071dfc3
Handled max concurrent requests using semaphore
cafalchio Dec 5, 2025
c9d200d
Fixed folder and file handling for generator
cafalchio Dec 5, 2025
36f1854
Improved convert to bytes function
cafalchio Dec 5, 2025
0cd89a5
Fixed double quotes inside double quotes in rstrip
cafalchio Dec 6, 2025
6043dd6
Refactored test_generator and linted
cafalchio Dec 7, 2025
fda73c3
Added default values from config in generator
cafalchio Dec 7, 2025
158b13f
Added QR validator Request model
cafalchio Dec 7, 2025
4d8b8b7
Refactored and linted image utils
cafalchio Dec 7, 2025
5ef6171
Refactored and improved generator
cafalchio Dec 8, 2025
8a29085
Refactored and cleaned generator errors
cafalchio Dec 8, 2025
f13dc3c
Addeed functions to estimate bits and size
cafalchio Dec 8, 2025
74bd321
Added validator tests and bits table size reference
cafalchio Dec 8, 2025
5360f93
Added validate qr code to server
cafalchio Dec 8, 2025
526380b
Improved load_image
cafalchio Dec 8, 2025
ace92ff
Added decoder qr code
cafalchio Dec 8, 2025
9eb5499
Fixed bug where zipped png files were corrupted
cafalchio Dec 10, 2025
9a791ed
change project name script to qr-code-server
cafalchio Dec 10, 2025
d4078f1
Added qr code decoder in server
cafalchio Dec 10, 2025
da38ce9
Added semaphore server tests
cafalchio Dec 10, 2025
22b1791
Fixed batch generator missing format input
cafalchio Dec 10, 2025
f7f85a6
Renamed internal function decode_qr_code to qr_decode
cafalchio Dec 10, 2025
11ffe01
Added test decode qr tool in server tests
cafalchio Dec 10, 2025
bf77123
Added tests to call tools from server
cafalchio Dec 10, 2025
47536b5
Fix small images not decoding
cafalchio Dec 14, 2025
565c600
Improved decoder log when cannot decode image or find file
cafalchio Dec 14, 2025
ac36fae
Added different types of qr images for decoding tests
cafalchio Dec 14, 2025
271d65b
Improved decoder tests
cafalchio Dec 14, 2025
1d369e2
Added test for multiple tools running concurrently
cafalchio Dec 14, 2025
7fbfc6d
Added more tests in server.py to reach > 90% coverage
cafalchio Dec 15, 2025
84f0ed9
Improved test coverage for config.
cafalchio Dec 17, 2025
7db97d4
Removed Cache generated qr code config
cafalchio Dec 17, 2025
dcc2698
Linted and removed health endpoit as it is not on requirements
cafalchio Dec 17, 2025
1ad31c2
Fixed wrong command in make format
cafalchio Dec 17, 2025
436bc68
Linted and formatted the code
cafalchio Dec 17, 2025
1a03533
Fixed image utils types and lint
cafalchio Dec 17, 2025
0d57da3
Fixed types and lint for decoder
cafalchio Dec 17, 2025
49c8ee4
Added return type to qr_decode function
cafalchio Dec 17, 2025
1d4921d
Fixed types in validador
cafalchio Dec 17, 2025
1d6b82f
Improved types in decoder
cafalchio Dec 17, 2025
34a773e
Improved types and return tyoes in generator
cafalchio Dec 17, 2025
425aebf
changed how to handle error correction in Qrgeneration config
cafalchio Dec 17, 2025
a3ca63a
change BytesIO to Any in Ascii save image
cafalchio Dec 17, 2025
8c55508
Normalized tools Output using Model
cafalchio Dec 18, 2025
985fb77
Created Comprehensive Readme
cafalchio Dec 18, 2025
8adb3a4
Normalized output for server errors using models
cafalchio Dec 18, 2025
960beb7
Improved logs for server
cafalchio Dec 18, 2025
87082f6
Removed files from BatchQRresult
cafalchio Dec 18, 2025
d756069
Capped border at 100 to avoid long request and computer freezing
cafalchio Dec 18, 2025
83ddede
Improved Readme with notes on Border and Colors
cafalchio Dec 18, 2025
8d4bf75
Fixed lint and long lines
cafalchio Dec 18, 2025
fdb52b9
Formatted and linted files for PR
cafalchio Dec 18, 2025
5b9e87e
fix(qr-code-server): correct file extension handling in resolve_outpu…
crivetimihai Jan 15, 2026
969a78a
fix(qr-code-server): address security and correctness issues
crivetimihai Jan 15, 2026
1a48ef2
fix(qr-code-server): improve validation and container compatibility
crivetimihai Jan 15, 2026
9df68eb
fix(qr-code-server): ensure batch uses config for border and error_co…
crivetimihai Jan 15, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions mcp-servers/python/qr_code_server/Containerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# syntax=docker/dockerfile:1
FROM python:3.11-slim AS base
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PIP_NO_CACHE_DIR=1 \
PATH="/app/.venv/bin:$PATH"

WORKDIR /app

RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates curl && \
rm -rf /var/lib/apt/lists/*

# Copy all source files before install (hatchling needs src/ at build time)
COPY pyproject.toml README.md ./
COPY src/ ./src/

RUN python -m venv /app/.venv && \
/app/.venv/bin/pip install --upgrade pip setuptools wheel && \
/app/.venv/bin/pip install -e .

RUN useradd -u 1001 -m appuser && chown -R 1001:1001 /app
USER 1001

CMD ["python", "-m", "qr_code_server.server"]
45 changes: 45 additions & 0 deletions mcp-servers/python/qr_code_server/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Makefile for QR Code Server

.PHONY: help install dev-install format lint test dev mcp-info serve-http test-http clean

PYTHON ?= python3
HTTP_PORT ?= 9000
HTTP_HOST ?= localhost

help: ## Show help
@awk 'BEGIN {FS=":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "%-18s %s\n", $$1, $$2}' $(MAKEFILE_LIST)

install: ## Install in editable mode
$(PYTHON) -m pip install -e .

dev-install: ## Install with dev extras
$(PYTHON) -m pip install -e ".[dev]"

format: ## Format (black + ruff --fix)
black . && ruff check --fix .

lint: ## Lint (ruff, mypy)
ruff check . && mypy src/qr_code_server

test: ## Run tests
pytest -v --cov=qr_code_server --cov-report=term-missing

dev: ## Run stdio MCP server
@echo "Starting QR Code Server (stdio)..."
$(PYTHON) -m qr_code_server.server

mcp-info: ## Show stdio client config snippet
@echo '{"command": "python", "args": ["-m", "qr_code_server.server"], "cwd": "'$(PWD)'"}'

serve-http: ## Expose stdio server over HTTP (JSON-RPC + SSE)
@echo "HTTP: http://$(HTTP_HOST):$(HTTP_PORT)"
$(PYTHON) -m mcpgateway.translate --stdio "$(PYTHON) -m qr_code_server.server" --host $(HTTP_HOST) --port $(HTTP_PORT) --expose-sse

test-http: ## Basic HTTP checks
curl -s http://$(HTTP_HOST):$(HTTP_PORT)/ | head -20 || true
curl -s -X POST -H 'Content-Type: application/json' \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}' \
http://$(HTTP_HOST):$(HTTP_PORT)/ | head -40 || true

clean: ## Remove caches
rm -rf .pytest_cache .ruff_cache .mypy_cache __pycache__ */__pycache__
Loading