mcp-win-stdio-excel 0.3.0__tar.gz → 0.3.2__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: mcp-win-stdio-excel
3
- Version: 0.3.0
3
+ Version: 0.3.2
4
4
  Summary: Windows-optimized Model Context Protocol (MCP) server for Excel: 34 tools for Pandas queries, bulk 2D writes, cell styling, conditional formatting, chart generation, data deduplication/cleaning, in-memory transformations, RapidFuzz reconciliation, and native Excel COM automation (PDF export, recalc, pivots, macros).
5
5
  Author-email: indala <indala@example.com>
6
6
  License-Expression: MIT
@@ -18,7 +18,7 @@ Classifier: Programming Language :: Python :: 3.13
18
18
  Classifier: Programming Language :: Python :: 3.14
19
19
  Classifier: Topic :: Office/Business :: Financial :: Spreadsheet
20
20
  Requires-Python: >=3.10
21
- Requires-Dist: mcp-win-stdio>=0.3.0
21
+ Requires-Dist: mcp-win-stdio>=0.3.2
22
22
  Requires-Dist: mcp>=1.2.0
23
23
  Requires-Dist: openpyxl>=3.1.0
24
24
  Requires-Dist: pandas>=2.0.0
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "mcp-win-stdio-excel"
7
- version = "0.3.0"
7
+ version = "0.3.2"
8
8
  description = "Windows-optimized Model Context Protocol (MCP) server for Excel: 34 tools for Pandas queries, bulk 2D writes, cell styling, conditional formatting, chart generation, data deduplication/cleaning, in-memory transformations, RapidFuzz reconciliation, and native Excel COM automation (PDF export, recalc, pivots, macros)."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
@@ -29,7 +29,7 @@ classifiers = [
29
29
  ]
30
30
 
31
31
  dependencies = [
32
- "mcp-win-stdio>=0.3.0",
32
+ "mcp-win-stdio>=0.3.2",
33
33
  "mcp>=1.2.0",
34
34
  "pandas>=2.0.0",
35
35
  "openpyxl>=3.1.0",
@@ -43,3 +43,6 @@ mws-excel = "mcp_win_stdio.excel.cli:main"
43
43
 
44
44
  [tool.hatch.build.targets.wheel]
45
45
  packages = ["src/mcp_win_stdio"]
46
+
47
+ [tool.uv.sources]
48
+ mcp-win-stdio = { workspace = true }
@@ -2,4 +2,4 @@
2
2
  mcp-win-stdio-excel: Windows-optimized Excel MCP Server.
3
3
  """
4
4
 
5
- __version__ = "0.3.0"
5
+ __version__ = "0.3.2"
@@ -10,10 +10,11 @@ import subprocess
10
10
  import sys
11
11
  from pathlib import Path
12
12
 
13
- from mcp_win_stdio.excel import __version__
14
13
  from mcp_win_stdio.excel.guide import print_guide
15
14
  from mcp_win_stdio.excel.server import mcp
16
15
 
16
+ from mcp_win_stdio.excel import __version__
17
+
17
18
 
18
19
  def get_claude_desktop_config_path() -> Path | None:
19
20
  appdata = os.environ.get("APPDATA")
@@ -401,7 +401,7 @@ def preview_sheet(
401
401
  "columns": [c for c in df.columns],
402
402
  "column_types": {str(col): str(dtype) for col, dtype in df.dtypes.items()},
403
403
  "format": format,
404
- "rows": data if format != "tsv" else None,
404
+ "rows": data,
405
405
  "data": data,
406
406
  }
407
407
 
@@ -466,7 +466,7 @@ def query_rows(
466
466
  "returned_rows": len(paginated_df),
467
467
  "columns": [c for c in df.columns],
468
468
  "format": format,
469
- "rows": data if format != "tsv" else None,
469
+ "rows": data,
470
470
  "data": data,
471
471
  }
472
472
 
@@ -487,6 +487,8 @@ def read_range(
487
487
  sheet_name: Optional[str] = None,
488
488
  start_row: int = 1,
489
489
  end_row: int = 50,
490
+ limit: Optional[int] = None,
491
+ nrows: Optional[int] = None,
490
492
  columns: Optional[List[str]] = None,
491
493
  header_row: Optional[int] = None,
492
494
  format: Literal["records", "compact", "tsv"] = "records",
@@ -500,6 +502,8 @@ def read_range(
500
502
  sheet_name: Sheet name or index.
501
503
  start_row: First row to read (1-indexed).
502
504
  end_row: Last row to read (1-indexed).
505
+ limit: Optional row limit count (shorthand that overrides end_row = start_row + limit - 1).
506
+ nrows: Alias for limit.
503
507
  columns: Specific columns to load.
504
508
  header_row: Row containing column headers (0-indexed).
505
509
  format: 'records', 'compact', or 'tsv'.
@@ -507,42 +511,54 @@ def read_range(
507
511
  if not os.path.exists(file_path):
508
512
  raise FileNotFoundError(f"File not found: {file_path}")
509
513
 
514
+ if limit is not None:
515
+ end_row = start_row + max(1, limit) - 1
516
+ elif nrows is not None:
517
+ end_row = start_row + max(1, nrows) - 1
518
+
510
519
  if start_row < 1:
511
520
  start_row = 1
512
521
  if end_row < start_row:
513
522
  raise ValueError(f"end_row ({end_row}) must be >= start_row ({start_row})")
514
523
 
524
+ requested_count = end_row - start_row + 1
515
525
  max_allowed = 300 if format == "tsv" else (200 if format == "compact" else 100)
516
- nrows = min(end_row - start_row + 1, max_allowed)
526
+ fetch_rows = min(requested_count, max_allowed)
517
527
 
518
528
  h_idx = header_row if header_row is not None else 0
519
529
  if start_row <= (h_idx + 1):
520
- df = pd.read_excel(file_path, sheet_name=sheet_name or 0, nrows=nrows, usecols=columns, header=h_idx)
530
+ df = pd.read_excel(file_path, sheet_name=sheet_name or 0, nrows=fetch_rows, usecols=columns, header=h_idx)
521
531
  else:
522
532
  header_df = pd.read_excel(file_path, sheet_name=sheet_name or 0, nrows=0, usecols=columns, header=h_idx)
523
533
  df = pd.read_excel(
524
534
  file_path,
525
535
  sheet_name=sheet_name or 0,
526
536
  skiprows=range(h_idx + 1, start_row),
527
- nrows=nrows,
537
+ nrows=fetch_rows,
528
538
  names=list(header_df.columns),
529
539
  usecols=columns,
530
540
  )
531
541
 
532
542
  data = _format_dataframe_output(df, format)
543
+ returned_count = len(df)
544
+ has_more = requested_count > max_allowed or returned_count == fetch_rows
545
+
533
546
  res_range: Dict[str, Any] = {
534
547
  "start_row": start_row,
535
- "end_row": start_row + len(df) - 1,
536
- "row_count": len(df),
548
+ "end_row": start_row + returned_count - 1 if returned_count > 0 else start_row,
549
+ "row_count": returned_count,
550
+ "requested_count": requested_count,
551
+ "has_more": has_more,
537
552
  "columns": [c for c in df.columns],
538
553
  "format": format,
539
- "rows": data if format != "tsv" else None,
554
+ "rows": data,
540
555
  "data": data,
541
556
  }
542
- if (end_row - start_row + 1) > max_allowed:
557
+
558
+ if requested_count > max_allowed:
543
559
  res_range["context_protection_notice"] = (
544
- f"Requested {end_row - start_row + 1} rows capped at {max_allowed} to protect your LLM context window. "
545
- f"Use start_row/end_row to page through specific slices or export_to_csv to process on disk."
560
+ f"Requested {requested_count} rows capped at {max_allowed} to protect your LLM context window. "
561
+ f"Use start_row={start_row + returned_count} to page through the next slice."
546
562
  )
547
563
  return res_range
548
564