mcp-word-bridge 4.0.4 → 4.0.5

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.
package/README.md CHANGED
@@ -70,7 +70,6 @@ Single process. The MCP client spawns the server, which starts both the HTTPS br
70
70
  | `word_set_document_properties` | Set metadata fields |
71
71
  | `word_save` | Save document to disk |
72
72
  | `word_clear` | Clear all document body content |
73
- | `word_create_document` | Create and open a new blank document in a new Word window |
74
73
  | `word_get_word_count` | Get word, character, and paragraph counts |
75
74
  | `word_get_styles` | List available styles |
76
75
  | `word_get_coauthors` | Get co-authoring status and active authors |
package/dist/server.js CHANGED
@@ -18784,16 +18784,6 @@ var clear = forwardTool(
18784
18784
  { properties: {} },
18785
18785
  "clearDocument"
18786
18786
  );
18787
- var createDocument = forwardTool(
18788
- "word_create_document",
18789
- "[Document] Create and open a new blank document in a new Word window. Optionally provide base64-encoded .docx as template.",
18790
- {
18791
- properties: {
18792
- base64: { type: "string", description: "Optional base64-encoded .docx file to use as template" }
18793
- }
18794
- },
18795
- "createNewDocument"
18796
- );
18797
18787
  var getWordCount = forwardTool(
18798
18788
  "word_get_word_count",
18799
18789
  "[Document] Get word, character, and paragraph counts.",
@@ -18857,7 +18847,6 @@ var documentTools = [
18857
18847
  setDocumentProperties,
18858
18848
  save,
18859
18849
  clear,
18860
- createDocument,
18861
18850
  getWordCount,
18862
18851
  getStyles,
18863
18852
  getCoauthors,
@@ -19082,12 +19071,23 @@ var moveParagraph = {
19082
19071
  checkBounds(fromIndex, total, "fromIndex");
19083
19072
  if (fromIndex + count - 1 >= total) throw new ToolError(`fromIndex + count (${fromIndex + count}) exceeds paragraph count (${total}).`);
19084
19073
  checkBounds(toIndex, total, "toIndex");
19074
+ for (const para of paraCount.paragraphs) {
19075
+ if (para.index >= fromIndex && para.index < fromIndex + count && para.inTable) {
19076
+ throw new ToolError(`Paragraph ${para.index} is inside a table cell. Use table-specific tools to modify table content.`);
19077
+ }
19078
+ }
19079
+ const adjustedTo = fromIndex < toIndex ? toIndex - count : toIndex;
19080
+ if (toIndex === fromIndex + count && location === "After") {
19081
+ return jsonResult({ success: true, warning: "No move performed \u2014 destination is equivalent to source position.", moved: null });
19082
+ }
19083
+ if (adjustedTo === fromIndex && location === "After") {
19084
+ return jsonResult({ success: true, warning: "No move performed \u2014 destination is equivalent to source position.", moved: null });
19085
+ }
19085
19086
  const ooxmlResult = await bridge2.send("getParaOoxml", { index: fromIndex, count });
19086
19087
  const savedOoxml = ooxmlResult.ooxml;
19087
19088
  for (let i = count - 1; i >= 0; i--) {
19088
19089
  await bridge2.send("deleteParagraph", { index: fromIndex + i });
19089
19090
  }
19090
- const adjustedTo = fromIndex < toIndex ? toIndex - count : toIndex;
19091
19091
  try {
19092
19092
  await bridge2.send("insertOoxmlAtIndex", { ooxml: savedOoxml, index: adjustedTo, location });
19093
19093
  } catch (insertErr) {
@@ -19127,8 +19127,15 @@ var copyParagraph = {
19127
19127
  checkBounds(fromIndex, total, "fromIndex");
19128
19128
  if (fromIndex + count - 1 >= total) throw new ToolError(`fromIndex + count (${fromIndex + count}) exceeds paragraph count (${total}).`);
19129
19129
  checkBounds(toIndex, total, "toIndex");
19130
+ for (const para of paraCount.paragraphs) {
19131
+ if (para.index >= fromIndex && para.index < fromIndex + count && para.inTable) {
19132
+ throw new ToolError(`Paragraph ${para.index} is inside a table cell. Use table-specific tools to modify table content.`);
19133
+ }
19134
+ }
19130
19135
  const ooxmlResult = await bridge2.send("getParaOoxml", { index: fromIndex, count });
19131
- await bridge2.send("insertOoxmlAtIndex", { ooxml: ooxmlResult.ooxml, index: toIndex, location });
19136
+ const effectiveToIndex = toIndex >= fromIndex && toIndex < fromIndex + count ? fromIndex + count - 1 : toIndex;
19137
+ const effectiveLocation = toIndex >= fromIndex && toIndex < fromIndex + count ? "After" : location;
19138
+ await bridge2.send("insertOoxmlAtIndex", { ooxml: ooxmlResult.ooxml, index: effectiveToIndex, location: effectiveLocation });
19132
19139
  return jsonResult({ success: true, copied: { from: fromIndex, count, to: toIndex, location } });
19133
19140
  }
19134
19141
  };
@@ -19148,7 +19155,7 @@ var paragraphTools = [
19148
19155
  // src/server/tools/search.ts
19149
19156
  var search = forwardTool(
19150
19157
  "word_search",
19151
- "[Search] Find text in the document. Returns match count and up to 30 matches. Query must be \u2264255 chars.",
19158
+ '[Search] Find text in the document. Returns match count and up to 30 matches. Query must be \u2264255 chars. Note: Word search codes (^p = paragraph mark, ^t = tab) are interpreted. To search for literal "^", use "^^".',
19152
19159
  {
19153
19160
  properties: {
19154
19161
  query: { type: "string" },
@@ -19556,7 +19563,7 @@ var commentTools = [
19556
19563
  // src/server/tools/footnotes.ts
19557
19564
  var insertFootnote = forwardTool(
19558
19565
  "word_insert_footnote",
19559
- "[Footnotes] Insert a footnote anchored to a text match.",
19566
+ "[Footnotes] Insert a footnote anchored to a text match. Note: multiple footnotes on the same anchor appear in reverse insertion order (most recent first). Use word_insert_footnote_at_index for explicit placement.",
19560
19567
  {
19561
19568
  properties: {
19562
19569
  anchorText: { type: "string", description: "Text to search for as anchor point" },
@@ -20393,7 +20400,7 @@ After inserting a Table of Contents, heading text appears twice (in TOC and body
20393
20400
  // package.json
20394
20401
  var package_default = {
20395
20402
  name: "mcp-word-bridge",
20396
- version: "4.0.4",
20403
+ version: "4.0.5",
20397
20404
  description: "MCP server for live Word document editing via Office Add-in",
20398
20405
  main: "dist/server.js",
20399
20406
  bin: {