[build-system]
requires = ["setuptools>=68.0", "wheel"]
build-backend = "setuptools.build_meta"
[project]
name = "ib-sec-mcp"
version = "0.1.0"
description = "Interactive Brokers portfolio analytics with MCP server support"
readme = "README.md"
requires-python = ">=3.12"
license = {text = "MIT"}
authors = [
{name = "Kenichiro Nishioka"}
]
keywords = ["interactive-brokers", "trading", "analytics", "portfolio", "finance"]
classifiers = [
"Development Status :: 3 - Alpha",
"Intended Audience :: Financial and Insurance Industry",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
]
dependencies = [
"requests>=2.32.5",
"pandas>=2.2.3",
"pydantic>=2.10.0",
"python-dotenv>=1.0.0",
"httpx>=0.27.0",
"rich>=13.7.0",
"typer>=0.12.0",
"defusedxml>=0.7.1",
"yfinance>=0.2.40,<1.0",
]
[project.optional-dependencies]
mcp = [
"fastmcp>=2.0.0,<3.0",
"scipy>=1.14.0",
"pyyaml>=6.0.0",
]
dev = [
"pytest>=8.0.0",
"pytest-asyncio>=0.24.0",
"pytest-cov>=4.1.0",
"ruff>=0.14.0",
"mypy>=1.19.0",
"pre-commit>=4.0.0",
"bandit[toml]>=1.9.0",
]
visualization = [
"plotly>=5.18.0",
"kaleido>=0.2.1",
]
reporting = [
"jinja2>=3.1.0",
"weasyprint>=60.0",
]
[project.scripts]
ib-sec-fetch = "ib_sec_mcp.cli.fetch:app"
ib-sec-analyze = "ib_sec_mcp.cli.analyze:app"
ib-sec-report = "ib_sec_mcp.cli.report:app"
ib-sec-mcp = "ib_sec_mcp.mcp.server:main"
[tool.setuptools.packages.find]
where = ["."]
include = ["ib_sec_mcp*"]
[tool.ruff]
line-length = 100
target-version = "py312"
[tool.ruff.lint]
select = ["E", "F", "I", "N", "W", "UP", "B", "A", "C4", "T20", "SIM", "RUF", "PTH", "PERF"]
ignore = [
"E501", # Line too long (handled by formatter)
"UP024", # asyncio.TimeoutError is intentional for asyncio.wait_for
"RUF001", # Ambiguous unicode in strings (Japanese text is intentional)
"RUF002", # Ambiguous unicode in docstrings (Japanese text is intentional)
"RUF003", # Ambiguous unicode in comments (Japanese text is intentional)
"PTH123", # open() -> Path.open() migration deferred to separate refactor
"RUF012", # Mutable class defaults are intentional in Pydantic models
"N817", # CamelCase imported as acronym (e.g., ElementTree as ET) is conventional
]
[tool.ruff.lint.per-file-ignores]
"ib_sec_mcp/cli/*.py" = ["T201", "B008"] # Allow print and typer.Option defaults in CLI tools
"ib_sec_mcp/mcp/tools/options.py" = ["N806"] # Black-Scholes variable names (S, T, K, IV) are standard notation
[tool.mypy]
python_version = "3.12"
strict = true
warn_return_any = true
warn_unused_configs = true
warn_redundant_casts = true
warn_unused_ignores = true
disallow_untyped_defs = true
disallow_any_unimported = false
disallow_any_generics = true
disallow_subclassing_any = true
check_untyped_defs = true
no_implicit_reexport = true
plugins = ["pydantic.mypy"]
# Ignore missing imports for third-party libraries without stubs
[[tool.mypy.overrides]]
module = [
"yfinance",
"yfinance.*",
"fastmcp",
"fastmcp.*",
"mcp",
"mcp.*",
"defusedxml",
"defusedxml.*",
"dotenv",
"pydantic_settings",
"pydantic_settings.*",
"yaml",
"yaml.*",
"scipy",
"scipy.*",
"numpy",
"numpy.*",
"pandas",
"pandas.*",
"requests",
"requests.*",
]
ignore_missing_imports = true
# FastMCP decorators and base classes lack type stubs
[[tool.mypy.overrides]]
module = "ib_sec_mcp.mcp.*"
disallow_subclassing_any = false
# pydantic-settings BaseSettings lacks type stubs; allow subclassing Any
[[tool.mypy.overrides]]
module = "ib_sec_mcp.utils.config"
disallow_subclassing_any = false
[tool.pytest.ini_options]
testpaths = ["tests"]
python_files = ["test_*.py"]
python_classes = ["Test*"]
python_functions = ["test_*"]
addopts = "-v --cov=ib_sec_mcp --cov-report=term-missing"
asyncio_mode = "auto"
[tool.coverage.run]
branch = true
source = ["ib_sec_mcp"]
omit = ["*/tests/*", "*/__pycache__/*"]
[tool.coverage.report]
fail_under = 48
show_missing = true
exclude_lines = [
"pragma: no cover",
"if TYPE_CHECKING:",
"if __name__ == .__main__.",
]
[tool.bandit]
exclude_dirs = ["tests", ".venv", "venv"]
skips = ["B601"]
[tool.bandit.assert_used]
skips = ["tests/*"]