This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
This project uses uv for dependency and environment management.
- Run CLI:
uv run jmai [args]oruv run jmcomic-ai [args] - Start MCP Server (SSE):
uv run jmai mcp(Port 8000 by default) - Start MCP Server (stdio):
uv run jmai mcp stdio - Start MCP with Hot Reload:
uv run jmai mcp --reload - Install AI Skills:
uv run jmai skills install(Exports to~/.claude/skills/jmcomic) - Manage Options:
uv run jmai option show|path|edit
- Build Package:
uv build - Linting:
uv run ruff check src/ - Type Checking:
uv run mypy src/ - Run All Tests:
uv run python -m unittest discover tests - Run Integration Test:
uv run python tests/test_mcp_integration.py
JMComic AI is an intermediary layer that exposes the jmcomic crawler's capabilities to AI agents via the Model Context Protocol (MCP).
- Transport Layer (
src/jmcomic_ai/mcp/): Built usingFastMCP. Handles communication between AI clients (Cursor, Claude, etc.) and the server via SSE/HTTP or stdio. - Service Layer (
src/jmcomic_ai/cli.py& others): Connects MCP tools to the underlying crawler logic and manages the CLI application. - Knowledge Layer (
src/jmcomic_ai/skills/): ContainsSKILL.mdand related logic to inject domain-specific expertise into AI agents. - Configuration System: Manages
option.ymlwhich controls proxies, download paths, threading, and crawler behavior.
reference/: This directory contains a local copy of the upstreamjmcomicsource code. Because the upstream library is complex and frequently updated, developers should consult this directory to understand the implementation of core entities (likeJmAlbumDetail) before modifying MCP tools.
- Type Safety: Use static type hints and verify with
mypy. - Linting: Follow the rules defined in
pyproject.toml(120 character line length). - Tool Definitions: When adding or modifying MCP tools in
src/jmcomic_ai/mcp/, ensure clear docstrings as they are directly consumed by AI agents. - Environment: Prefer
uv runfor executing commands to ensure consistent environment usage.