@ncukondo/reference-manager 0.3.0 → 0.4.0

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.
Files changed (113) hide show
  1. package/README.md +267 -109
  2. package/dist/chunks/file-watcher-B-SiUw5f.js +1557 -0
  3. package/dist/chunks/file-watcher-B-SiUw5f.js.map +1 -0
  4. package/dist/chunks/{search-Be9vzUIH.js → index-DLIGxQaB.js} +399 -89
  5. package/dist/chunks/index-DLIGxQaB.js.map +1 -0
  6. package/dist/chunks/loader-DuzyKV70.js +394 -0
  7. package/dist/chunks/loader-DuzyKV70.js.map +1 -0
  8. package/dist/cli/commands/add.d.ts +3 -3
  9. package/dist/cli/commands/add.d.ts.map +1 -1
  10. package/dist/cli/commands/cite.d.ts +3 -3
  11. package/dist/cli/commands/cite.d.ts.map +1 -1
  12. package/dist/cli/commands/fulltext.d.ts +5 -34
  13. package/dist/cli/commands/fulltext.d.ts.map +1 -1
  14. package/dist/cli/commands/list.d.ts +3 -3
  15. package/dist/cli/commands/list.d.ts.map +1 -1
  16. package/dist/cli/commands/mcp.d.ts +16 -0
  17. package/dist/cli/commands/mcp.d.ts.map +1 -0
  18. package/dist/cli/commands/remove.d.ts +3 -3
  19. package/dist/cli/commands/remove.d.ts.map +1 -1
  20. package/dist/cli/commands/search.d.ts +3 -3
  21. package/dist/cli/commands/search.d.ts.map +1 -1
  22. package/dist/cli/commands/server.d.ts +2 -0
  23. package/dist/cli/commands/server.d.ts.map +1 -1
  24. package/dist/cli/commands/update.d.ts +3 -3
  25. package/dist/cli/commands/update.d.ts.map +1 -1
  26. package/dist/cli/execution-context.d.ts +23 -36
  27. package/dist/cli/execution-context.d.ts.map +1 -1
  28. package/dist/cli/index.d.ts.map +1 -1
  29. package/dist/cli/server-client.d.ts +24 -40
  30. package/dist/cli/server-client.d.ts.map +1 -1
  31. package/dist/cli/server-detection.d.ts +1 -0
  32. package/dist/cli/server-detection.d.ts.map +1 -1
  33. package/dist/cli.js +21060 -317
  34. package/dist/cli.js.map +1 -1
  35. package/dist/config/defaults.d.ts.map +1 -1
  36. package/dist/config/loader.d.ts.map +1 -1
  37. package/dist/config/schema.d.ts +2 -3
  38. package/dist/config/schema.d.ts.map +1 -1
  39. package/dist/core/csl-json/types.d.ts +3 -0
  40. package/dist/core/csl-json/types.d.ts.map +1 -1
  41. package/dist/core/library-interface.d.ts +100 -0
  42. package/dist/core/library-interface.d.ts.map +1 -0
  43. package/dist/core/library.d.ts +29 -46
  44. package/dist/core/library.d.ts.map +1 -1
  45. package/dist/features/operations/add.d.ts +2 -2
  46. package/dist/features/operations/add.d.ts.map +1 -1
  47. package/dist/features/operations/cite.d.ts +2 -2
  48. package/dist/features/operations/cite.d.ts.map +1 -1
  49. package/dist/features/operations/fulltext/attach.d.ts +47 -0
  50. package/dist/features/operations/fulltext/attach.d.ts.map +1 -0
  51. package/dist/features/operations/fulltext/detach.d.ts +38 -0
  52. package/dist/features/operations/fulltext/detach.d.ts.map +1 -0
  53. package/dist/features/operations/fulltext/get.d.ts +41 -0
  54. package/dist/features/operations/fulltext/get.d.ts.map +1 -0
  55. package/dist/features/operations/fulltext/index.d.ts +9 -0
  56. package/dist/features/operations/fulltext/index.d.ts.map +1 -0
  57. package/dist/features/operations/index.d.ts +15 -0
  58. package/dist/features/operations/index.d.ts.map +1 -0
  59. package/dist/features/operations/library-operations.d.ts +64 -0
  60. package/dist/features/operations/library-operations.d.ts.map +1 -0
  61. package/dist/features/operations/list.d.ts +2 -2
  62. package/dist/features/operations/list.d.ts.map +1 -1
  63. package/dist/features/operations/operations-library.d.ts +36 -0
  64. package/dist/features/operations/operations-library.d.ts.map +1 -0
  65. package/dist/features/operations/remove.d.ts +4 -4
  66. package/dist/features/operations/remove.d.ts.map +1 -1
  67. package/dist/features/operations/search.d.ts +2 -2
  68. package/dist/features/operations/search.d.ts.map +1 -1
  69. package/dist/features/operations/update.d.ts +2 -2
  70. package/dist/features/operations/update.d.ts.map +1 -1
  71. package/dist/features/search/matcher.d.ts.map +1 -1
  72. package/dist/features/search/normalizer.d.ts +12 -0
  73. package/dist/features/search/normalizer.d.ts.map +1 -1
  74. package/dist/features/search/tokenizer.d.ts.map +1 -1
  75. package/dist/features/search/types.d.ts +1 -1
  76. package/dist/features/search/types.d.ts.map +1 -1
  77. package/dist/features/search/uppercase.d.ts +41 -0
  78. package/dist/features/search/uppercase.d.ts.map +1 -0
  79. package/dist/index.js +24 -192
  80. package/dist/index.js.map +1 -1
  81. package/dist/mcp/context.d.ts +19 -0
  82. package/dist/mcp/context.d.ts.map +1 -0
  83. package/dist/mcp/index.d.ts +20 -0
  84. package/dist/mcp/index.d.ts.map +1 -0
  85. package/dist/mcp/resources/index.d.ts +10 -0
  86. package/dist/mcp/resources/index.d.ts.map +1 -0
  87. package/dist/mcp/resources/library.d.ts +26 -0
  88. package/dist/mcp/resources/library.d.ts.map +1 -0
  89. package/dist/mcp/tools/add.d.ts +17 -0
  90. package/dist/mcp/tools/add.d.ts.map +1 -0
  91. package/dist/mcp/tools/cite.d.ts +15 -0
  92. package/dist/mcp/tools/cite.d.ts.map +1 -0
  93. package/dist/mcp/tools/fulltext.d.ts +51 -0
  94. package/dist/mcp/tools/fulltext.d.ts.map +1 -0
  95. package/dist/mcp/tools/index.d.ts +12 -0
  96. package/dist/mcp/tools/index.d.ts.map +1 -0
  97. package/dist/mcp/tools/list.d.ts +13 -0
  98. package/dist/mcp/tools/list.d.ts.map +1 -0
  99. package/dist/mcp/tools/remove.d.ts +19 -0
  100. package/dist/mcp/tools/remove.d.ts.map +1 -0
  101. package/dist/mcp/tools/search.d.ts +13 -0
  102. package/dist/mcp/tools/search.d.ts.map +1 -0
  103. package/dist/server/index.d.ts +23 -1
  104. package/dist/server/index.d.ts.map +1 -1
  105. package/dist/server/routes/references.d.ts.map +1 -1
  106. package/dist/server.js +5 -271
  107. package/dist/server.js.map +1 -1
  108. package/package.json +2 -1
  109. package/dist/chunks/detector-DHztTaFY.js +0 -619
  110. package/dist/chunks/detector-DHztTaFY.js.map +0 -1
  111. package/dist/chunks/loader-mQ25o6cV.js +0 -1054
  112. package/dist/chunks/loader-mQ25o6cV.js.map +0 -1
  113. package/dist/chunks/search-Be9vzUIH.js.map +0 -1
@@ -0,0 +1,19 @@
1
+ import type { Config } from "../config/schema.js";
2
+ import { Library } from "../core/library.js";
3
+ import { FileWatcher } from "../features/file-watcher/file-watcher.js";
4
+ /**
5
+ * MCP context containing library, config, and file watcher.
6
+ * Simplified context for MCP server (no ExecutionContext pattern).
7
+ */
8
+ export interface McpContext {
9
+ library: Library;
10
+ config: Config;
11
+ fileWatcher: FileWatcher;
12
+ dispose: () => Promise<void>;
13
+ }
14
+ export interface CreateMcpContextOptions {
15
+ configPath: string;
16
+ libraryPath?: string;
17
+ }
18
+ export declare function createMcpContext(options: CreateMcpContextOptions): Promise<McpContext>;
19
+ //# sourceMappingURL=context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/mcp/context.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,0CAA0C,CAAC;AAEvE;;;GAGG;AACH,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,WAAW,CAAC;IACzB,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9B;AAED,MAAM,WAAW,uBAAuB;IACtC,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,wBAAsB,gBAAgB,CAAC,OAAO,EAAE,uBAAuB,GAAG,OAAO,CAAC,UAAU,CAAC,CAyC5F"}
@@ -0,0 +1,20 @@
1
+ import type { Readable, Writable } from "node:stream";
2
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
3
+ import { type McpContext } from "./context.js";
4
+ export interface CreateMcpServerOptions {
5
+ configPath: string;
6
+ libraryPath?: string;
7
+ stdin?: Readable;
8
+ stdout?: Writable;
9
+ }
10
+ export interface McpServerResult {
11
+ server: McpServer;
12
+ context: McpContext;
13
+ serverInfo: {
14
+ name: string;
15
+ version: string;
16
+ };
17
+ dispose: () => Promise<void>;
18
+ }
19
+ export declare function createMcpServer(options: CreateMcpServerOptions): Promise<McpServerResult>;
20
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/mcp/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAGpE,OAAO,EAAE,KAAK,UAAU,EAAoB,MAAM,cAAc,CAAC;AAIjE,MAAM,WAAW,sBAAsB;IACrC,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,QAAQ,CAAC;IACjB,MAAM,CAAC,EAAE,QAAQ,CAAC;CACnB;AAED,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,SAAS,CAAC;IAClB,OAAO,EAAE,UAAU,CAAC;IACpB,UAAU,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IAC9C,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9B;AAED,wBAAsB,eAAe,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,eAAe,CAAC,CA+C/F"}
@@ -0,0 +1,10 @@
1
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ import type { Library } from "../../core/library.js";
3
+ /**
4
+ * Register all resources with the MCP server.
5
+ *
6
+ * @param server - The MCP server instance
7
+ * @param getLibrary - Function to get the current library instance
8
+ */
9
+ export declare function registerAllResources(server: McpServer, getLibrary: () => Library): void;
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/mcp/resources/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAOrD;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,OAAO,GAAG,IAAI,CAIvF"}
@@ -0,0 +1,26 @@
1
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ import type { Library } from "../../core/library.js";
3
+ /**
4
+ * Register the references resource with the MCP server.
5
+ * Returns all references as CSL-JSON.
6
+ *
7
+ * @param server - The MCP server instance
8
+ * @param getLibrary - Function to get the current library instance
9
+ */
10
+ export declare function registerReferencesResource(server: McpServer, getLibrary: () => Library): void;
11
+ /**
12
+ * Register the single reference resource with the MCP server.
13
+ * Returns a single reference by ID.
14
+ *
15
+ * @param server - The MCP server instance
16
+ * @param getLibrary - Function to get the current library instance
17
+ */
18
+ export declare function registerReferenceResource(server: McpServer, getLibrary: () => Library): void;
19
+ /**
20
+ * Register the styles resource with the MCP server.
21
+ * Returns available citation styles.
22
+ *
23
+ * @param server - The MCP server instance
24
+ */
25
+ export declare function registerStylesResource(server: McpServer): void;
26
+ //# sourceMappingURL=library.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"library.d.ts","sourceRoot":"","sources":["../../../src/mcp/resources/library.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEzE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAErD;;;;;;GAMG;AACH,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,OAAO,GAAG,IAAI,CAwB7F;AAED;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,OAAO,GAAG,IAAI,CA4C5F;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAyB9D"}
@@ -0,0 +1,17 @@
1
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ import type { Library } from "../../core/library.js";
3
+ /**
4
+ * Parameters for the add tool
5
+ */
6
+ export interface AddToolParams {
7
+ /** Input string or array of strings (PMID, DOI, BibTeX, RIS, CSL-JSON) */
8
+ input: string | string[];
9
+ }
10
+ /**
11
+ * Register the add tool with the MCP server.
12
+ *
13
+ * @param server - The MCP server instance
14
+ * @param getLibrary - Function to get the current library instance
15
+ */
16
+ export declare function registerAddTool(server: McpServer, getLibrary: () => Library): void;
17
+ //# sourceMappingURL=add.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"add.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/add.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEzE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAGrD;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,0EAA0E;IAC1E,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CAC1B;AAqCD;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,OAAO,GAAG,IAAI,CAkClF"}
@@ -0,0 +1,15 @@
1
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ import type { Library } from "../../core/library.js";
3
+ export interface CiteToolParams {
4
+ ids: string[];
5
+ style?: string | undefined;
6
+ format?: "text" | "html" | undefined;
7
+ }
8
+ /**
9
+ * Register the cite tool with the MCP server.
10
+ *
11
+ * @param server - The MCP server instance
12
+ * @param getLibrary - Function to get the current library instance
13
+ */
14
+ export declare function registerCiteTool(server: McpServer, getLibrary: () => Library): void;
15
+ //# sourceMappingURL=cite.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cite.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/cite.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEzE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAGrD,MAAM,WAAW,cAAc;IAC7B,GAAG,EAAE,MAAM,EAAE,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;CACtC;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,OAAO,GAAG,IAAI,CAkCnF"}
@@ -0,0 +1,51 @@
1
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ import type { Config } from "../../config/schema.js";
3
+ import type { Library } from "../../core/library.js";
4
+ /**
5
+ * Parameters for the fulltext_attach tool
6
+ */
7
+ export interface FulltextAttachToolParams {
8
+ /** Reference ID */
9
+ id: string;
10
+ /** Path to the file to attach */
11
+ path: string;
12
+ }
13
+ /**
14
+ * Parameters for the fulltext_get tool
15
+ */
16
+ export interface FulltextGetToolParams {
17
+ /** Reference ID */
18
+ id: string;
19
+ }
20
+ /**
21
+ * Parameters for the fulltext_detach tool
22
+ */
23
+ export interface FulltextDetachToolParams {
24
+ /** Reference ID */
25
+ id: string;
26
+ }
27
+ /**
28
+ * Register the fulltext_attach tool with the MCP server.
29
+ *
30
+ * @param server - The MCP server instance
31
+ * @param getLibrary - Function to get the current library instance
32
+ * @param getConfig - Function to get the current config
33
+ */
34
+ export declare function registerFulltextAttachTool(server: McpServer, getLibrary: () => Library, getConfig: () => Config): void;
35
+ /**
36
+ * Register the fulltext_get tool with the MCP server.
37
+ *
38
+ * @param server - The MCP server instance
39
+ * @param getLibrary - Function to get the current library instance
40
+ * @param getConfig - Function to get the current config
41
+ */
42
+ export declare function registerFulltextGetTool(server: McpServer, getLibrary: () => Library, getConfig: () => Config): void;
43
+ /**
44
+ * Register the fulltext_detach tool with the MCP server.
45
+ *
46
+ * @param server - The MCP server instance
47
+ * @param getLibrary - Function to get the current library instance
48
+ * @param getConfig - Function to get the current config
49
+ */
50
+ export declare function registerFulltextDetachTool(server: McpServer, getLibrary: () => Library, getConfig: () => Config): void;
51
+ //# sourceMappingURL=fulltext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fulltext.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/fulltext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEzE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAOrD;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,mBAAmB;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,iCAAiC;IACjC,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,mBAAmB;IACnB,EAAE,EAAE,MAAM,CAAC;CACZ;AAED;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,mBAAmB;IACnB,EAAE,EAAE,MAAM,CAAC;CACZ;AAED;;;;;;GAMG;AACH,wBAAgB,0BAA0B,CACxC,MAAM,EAAE,SAAS,EACjB,UAAU,EAAE,MAAM,OAAO,EACzB,SAAS,EAAE,MAAM,MAAM,GACtB,IAAI,CAuCN;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,SAAS,EACjB,UAAU,EAAE,MAAM,OAAO,EACzB,SAAS,EAAE,MAAM,MAAM,GACtB,IAAI,CAgEN;AAED;;;;;;GAMG;AACH,wBAAgB,0BAA0B,CACxC,MAAM,EAAE,SAAS,EACjB,UAAU,EAAE,MAAM,OAAO,EACzB,SAAS,EAAE,MAAM,MAAM,GACtB,IAAI,CAqCN"}
@@ -0,0 +1,12 @@
1
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ import type { Config } from "../../config/schema.js";
3
+ import type { Library } from "../../core/library.js";
4
+ /**
5
+ * Register all tools with the MCP server.
6
+ *
7
+ * @param server - The MCP server instance
8
+ * @param getLibrary - Function to get the current library instance
9
+ * @param getConfig - Function to get the current config (required for fulltext tools)
10
+ */
11
+ export declare function registerAllTools(server: McpServer, getLibrary: () => Library, getConfig: () => Config): void;
12
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAYrD;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,SAAS,EACjB,UAAU,EAAE,MAAM,OAAO,EACzB,SAAS,EAAE,MAAM,MAAM,GACtB,IAAI,CASN"}
@@ -0,0 +1,13 @@
1
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ import type { Library } from "../../core/library.js";
3
+ export interface ListToolParams {
4
+ format?: "json" | "bibtex" | "pretty" | undefined;
5
+ }
6
+ /**
7
+ * Register the list tool with the MCP server.
8
+ *
9
+ * @param server - The MCP server instance
10
+ * @param getLibrary - Function to get the current library instance
11
+ */
12
+ export declare function registerListTool(server: McpServer, getLibrary: () => Library): void;
13
+ //# sourceMappingURL=list.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/list.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEzE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAGrD,MAAM,WAAW,cAAc;IAC7B,MAAM,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAC;CACnD;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,OAAO,GAAG,IAAI,CA0BnF"}
@@ -0,0 +1,19 @@
1
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ import type { Library } from "../../core/library.js";
3
+ /**
4
+ * Parameters for the remove tool
5
+ */
6
+ export interface RemoveToolParams {
7
+ /** Reference ID to remove */
8
+ id: string;
9
+ /** Must be true to actually remove (safety measure) */
10
+ force: boolean;
11
+ }
12
+ /**
13
+ * Register the remove tool with the MCP server.
14
+ *
15
+ * @param server - The MCP server instance
16
+ * @param getLibrary - Function to get the current library instance
17
+ */
18
+ export declare function registerRemoveTool(server: McpServer, getLibrary: () => Library): void;
19
+ //# sourceMappingURL=remove.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remove.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/remove.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEzE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAGrD;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,6BAA6B;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,uDAAuD;IACvD,KAAK,EAAE,OAAO,CAAC;CAChB;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,OAAO,GAAG,IAAI,CAiDrF"}
@@ -0,0 +1,13 @@
1
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ import type { Library } from "../../core/library.js";
3
+ export interface SearchToolParams {
4
+ query: string;
5
+ }
6
+ /**
7
+ * Register the search tool with the MCP server.
8
+ *
9
+ * @param server - The MCP server instance
10
+ * @param getLibrary - Function to get the current library instance
11
+ */
12
+ export declare function registerSearchTool(server: McpServer, getLibrary: () => Library): void;
13
+ //# sourceMappingURL=search.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/search.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEzE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAGrD,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,OAAO,GAAG,IAAI,CAyBrF"}
@@ -1,6 +1,20 @@
1
1
  import { Hono } from "hono";
2
2
  import type { Config } from "../config/schema.js";
3
- import type { Library } from "../core/library.js";
3
+ import { Library } from "../core/library.js";
4
+ import { FileWatcher } from "../features/file-watcher/file-watcher.js";
5
+ /**
6
+ * Result of starting a server with file watcher.
7
+ */
8
+ export interface ServerWithFileWatcherResult {
9
+ /** The Hono application */
10
+ app: Hono;
11
+ /** The library instance */
12
+ library: Library;
13
+ /** The file watcher instance */
14
+ fileWatcher: FileWatcher;
15
+ /** Dispose function to clean up resources */
16
+ dispose: () => Promise<void>;
17
+ }
4
18
  /**
5
19
  * Create the main Hono server application.
6
20
  * @param library - Library instance for the references API
@@ -8,4 +22,12 @@ import type { Library } from "../core/library.js";
8
22
  * @returns Hono application
9
23
  */
10
24
  export declare function createServer(library: Library, config: Config): Hono<import("hono/types").BlankEnv, import("hono/types").BlankSchema, "/">;
25
+ /**
26
+ * Start a server with file watcher for automatic library reload.
27
+ * Uses the same pattern as MCP server file monitoring.
28
+ * @param libraryPath - Path to the library file
29
+ * @param config - Configuration for the server
30
+ * @returns Server with file watcher result
31
+ */
32
+ export declare function startServerWithFileWatcher(libraryPath: string, config: Config): Promise<ServerWithFileWatcherResult>;
11
33
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAQlD;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,8EA2B5D"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,0CAA0C,CAAC;AAQvE;;GAEG;AACH,MAAM,WAAW,2BAA2B;IAC1C,2BAA2B;IAC3B,GAAG,EAAE,IAAI,CAAC;IACV,2BAA2B;IAC3B,OAAO,EAAE,OAAO,CAAC;IACjB,gCAAgC;IAChC,WAAW,EAAE,WAAW,CAAC;IACzB,6CAA6C;IAC7C,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9B;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,8EA2B5D;AAED;;;;;;GAMG;AACH,wBAAsB,0BAA0B,CAC9C,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,2BAA2B,CAAC,CAqCtC"}
@@ -1 +1 @@
1
- {"version":3,"file":"references.d.ts","sourceRoot":"","sources":["../../../src/server/routes/references.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAIrD;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,8EAmKrD"}
1
+ {"version":3,"file":"references.d.ts","sourceRoot":"","sources":["../../../src/server/routes/references.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAIrD;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,8EA8KrD"}
package/dist/server.js CHANGED
@@ -1,274 +1,8 @@
1
- import { Hono } from "hono";
2
- import { a as addReferences, c as citeReferences, l as listReferences, u as updateReference, r as removeReference, s as searchReferences } from "./chunks/search-Be9vzUIH.js";
3
- import { z } from "zod";
4
- function buildPubmedConfig(config) {
5
- const pubmedConfig = {};
6
- if (config.pubmed.email !== void 0) {
7
- pubmedConfig.email = config.pubmed.email;
8
- }
9
- if (config.pubmed.apiKey !== void 0) {
10
- pubmedConfig.apiKey = config.pubmed.apiKey;
11
- }
12
- return pubmedConfig;
13
- }
14
- function createAddRoute(library, config) {
15
- const route = new Hono();
16
- route.post("/", async (c) => {
17
- let body;
18
- try {
19
- body = await c.req.json();
20
- } catch {
21
- return c.json({ error: "Invalid JSON" }, 400);
22
- }
23
- if (!body || typeof body !== "object") {
24
- return c.json({ error: "Request body must be an object" }, 400);
25
- }
26
- const { inputs, options } = body;
27
- if (!inputs || !Array.isArray(inputs) || inputs.length === 0) {
28
- return c.json({ error: "inputs must be a non-empty array of strings" }, 400);
29
- }
30
- if (!inputs.every((input) => typeof input === "string")) {
31
- return c.json({ error: "All inputs must be strings" }, 400);
32
- }
33
- const addOptions = {
34
- force: options?.force ?? false,
35
- pubmedConfig: buildPubmedConfig(config)
36
- };
37
- if (options?.format) {
38
- addOptions.format = options.format;
39
- }
40
- const result = await addReferences(inputs, library, addOptions);
41
- return c.json(result);
42
- });
43
- return route;
44
- }
45
- const CiteRequestSchema = z.object({
46
- identifiers: z.array(z.string()).min(1, "identifiers must be a non-empty array"),
47
- byUuid: z.boolean().optional(),
48
- inText: z.boolean().optional(),
49
- style: z.string().optional(),
50
- cslFile: z.string().optional(),
51
- locale: z.string().optional(),
52
- format: z.enum(["text", "html"]).optional()
53
- });
54
- function buildCiteOptions(body) {
55
- return {
56
- identifiers: body.identifiers,
57
- ...body.byUuid !== void 0 && { byUuid: body.byUuid },
58
- ...body.inText !== void 0 && { inText: body.inText },
59
- ...body.style !== void 0 && { style: body.style },
60
- ...body.cslFile !== void 0 && { cslFile: body.cslFile },
61
- ...body.locale !== void 0 && { locale: body.locale },
62
- ...body.format !== void 0 && { format: body.format }
63
- };
64
- }
65
- function createCiteRoute(library) {
66
- const route = new Hono();
67
- route.post("/", async (c) => {
68
- let rawBody;
69
- try {
70
- rawBody = await c.req.json();
71
- } catch {
72
- return c.json({ error: "Invalid JSON" }, 400);
73
- }
74
- const parseResult = CiteRequestSchema.safeParse(rawBody);
75
- if (!parseResult.success) {
76
- const errorMessage = parseResult.error.issues[0]?.message ?? "Invalid request body";
77
- return c.json({ error: errorMessage }, 400);
78
- }
79
- const result = await citeReferences(library, buildCiteOptions(parseResult.data));
80
- return c.json(result);
81
- });
82
- return route;
83
- }
84
- const healthRoute = new Hono();
85
- healthRoute.get("/", (c) => {
86
- return c.json({ status: "ok" });
87
- });
88
- const listRequestBodySchema = z.object({
89
- format: z.enum(["pretty", "json", "bibtex", "ids-only", "uuid"]).optional()
90
- });
91
- function createListRoute(library) {
92
- const route = new Hono();
93
- route.post("/", async (c) => {
94
- let body;
95
- try {
96
- body = await c.req.json();
97
- } catch {
98
- return c.json({ error: "Invalid JSON" }, 400);
99
- }
100
- const parseResult = listRequestBodySchema.safeParse(body);
101
- if (!parseResult.success) {
102
- return c.json({ error: "Request body must be an object" }, 400);
103
- }
104
- const requestBody = parseResult.data;
105
- const options = {};
106
- if (requestBody.format !== void 0) {
107
- options.format = requestBody.format;
108
- }
109
- const result = listReferences(library, options);
110
- return c.json(result);
111
- });
112
- return route;
113
- }
114
- function createReferencesRoute(library) {
115
- const route = new Hono();
116
- route.get("/", (c) => {
117
- const references = library.getAll();
118
- const items = references.map((ref) => ref.getItem());
119
- return c.json(items);
120
- });
121
- route.get("/uuid/:uuid", (c) => {
122
- const uuid = c.req.param("uuid");
123
- const ref = library.findByUuid(uuid);
124
- if (!ref) {
125
- return c.json({ error: "Reference not found" }, 404);
126
- }
127
- return c.json(ref.getItem());
128
- });
129
- route.get("/id/:id", (c) => {
130
- const id = c.req.param("id");
131
- const ref = library.findById(id);
132
- if (!ref) {
133
- return c.json({ error: "Reference not found" }, 404);
134
- }
135
- return c.json(ref.getItem());
136
- });
137
- route.post("/", async (c) => {
138
- try {
139
- const body = await c.req.json();
140
- library.add(body);
141
- const allRefs = library.getAll();
142
- const addedRef = allRefs[allRefs.length - 1];
143
- if (!addedRef) {
144
- return c.json({ error: "Failed to add reference" }, 500);
145
- }
146
- return c.json(addedRef.getItem(), 201);
147
- } catch (error) {
148
- return c.json(
149
- {
150
- error: "Invalid request body",
151
- details: error instanceof Error ? error.message : String(error)
152
- },
153
- 400
154
- );
155
- }
156
- });
157
- route.put("/uuid/:uuid", async (c) => {
158
- const uuid = c.req.param("uuid");
159
- let body;
160
- try {
161
- body = await c.req.json();
162
- } catch {
163
- return c.json({ error: "Invalid JSON" }, 400);
164
- }
165
- if (!body || typeof body !== "object") {
166
- return c.json({ error: "Request body must be an object" }, 400);
167
- }
168
- const result = await updateReference(library, {
169
- identifier: uuid,
170
- byUuid: true,
171
- updates: body,
172
- onIdCollision: "suffix"
173
- });
174
- if (!result.updated) {
175
- const status = result.idCollision ? 409 : 404;
176
- return c.json(result, status);
177
- }
178
- return c.json(result);
179
- });
180
- route.put("/id/:id", async (c) => {
181
- const id = c.req.param("id");
182
- let body;
183
- try {
184
- body = await c.req.json();
185
- } catch {
186
- return c.json({ error: "Invalid JSON" }, 400);
187
- }
188
- if (!body || typeof body !== "object") {
189
- return c.json({ error: "Request body must be an object" }, 400);
190
- }
191
- const result = await updateReference(library, {
192
- identifier: id,
193
- byUuid: false,
194
- updates: body,
195
- onIdCollision: "suffix"
196
- });
197
- if (!result.updated) {
198
- const status = result.idCollision ? 409 : 404;
199
- return c.json(result, status);
200
- }
201
- return c.json(result);
202
- });
203
- route.delete("/uuid/:uuid", async (c) => {
204
- const uuid = c.req.param("uuid");
205
- const result = await removeReference(library, {
206
- identifier: uuid,
207
- byUuid: true
208
- });
209
- if (!result.removed) {
210
- return c.json(result, 404);
211
- }
212
- return c.json(result);
213
- });
214
- route.delete("/id/:id", async (c) => {
215
- const id = c.req.param("id");
216
- const result = await removeReference(library, {
217
- identifier: id,
218
- byUuid: false
219
- });
220
- if (!result.removed) {
221
- return c.json(result, 404);
222
- }
223
- return c.json(result);
224
- });
225
- return route;
226
- }
227
- const searchRequestBodySchema = z.object({
228
- query: z.string(),
229
- format: z.enum(["pretty", "json", "bibtex", "ids-only", "uuid"]).optional()
230
- });
231
- function createSearchRoute(library) {
232
- const route = new Hono();
233
- route.post("/", async (c) => {
234
- let body;
235
- try {
236
- body = await c.req.json();
237
- } catch {
238
- return c.json({ error: "Invalid JSON" }, 400);
239
- }
240
- const parseResult = searchRequestBodySchema.safeParse(body);
241
- if (!parseResult.success) {
242
- return c.json({ error: "Invalid request body" }, 400);
243
- }
244
- const requestBody = parseResult.data;
245
- const options = {
246
- query: requestBody.query
247
- };
248
- if (requestBody.format !== void 0) {
249
- options.format = requestBody.format;
250
- }
251
- const result = searchReferences(library, options);
252
- return c.json(result);
253
- });
254
- return route;
255
- }
256
- function createServer(library, config) {
257
- const app = new Hono();
258
- app.route("/health", healthRoute);
259
- const referencesRoute = createReferencesRoute(library);
260
- app.route("/api/references", referencesRoute);
261
- const addRoute = createAddRoute(library, config);
262
- app.route("/api/add", addRoute);
263
- const citeRoute = createCiteRoute(library);
264
- app.route("/api/cite", citeRoute);
265
- const listRoute = createListRoute(library);
266
- app.route("/api/list", listRoute);
267
- const searchRoute = createSearchRoute(library);
268
- app.route("/api/search", searchRoute);
269
- return app;
270
- }
1
+ import "hono";
2
+ import "./chunks/file-watcher-B-SiUw5f.js";
3
+ import { d, b } from "./chunks/index-DLIGxQaB.js";
271
4
  export {
272
- createServer
5
+ d as createServer,
6
+ b as startServerWithFileWatcher
273
7
  };
274
8
  //# sourceMappingURL=server.js.map