@docrouter/mcp 0.1.0 → 0.1.1

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/dist/index.js CHANGED
@@ -24,9 +24,83 @@ var ConfigSchema = zod.z.object({
24
24
  timeout: zod.z.number().default(3e4),
25
25
  retries: zod.z.number().default(3)
26
26
  });
27
+ function showTools() {
28
+ const toolNames = tools.map((tool) => tool.name).sort();
29
+ console.log(toolNames.join("\n"));
30
+ }
31
+ function showClaudeMd() {
32
+ try {
33
+ const currentFile = url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.js', document.baseURI).href)));
34
+ const currentDir = path.dirname(currentFile);
35
+ const claudePath = path.join(currentDir, "CLAUDE.md");
36
+ const claudeContent = fs.readFileSync(claudePath, "utf-8");
37
+ console.log(claudeContent);
38
+ } catch (error) {
39
+ console.error(`Error reading CLAUDE.md: ${error instanceof Error ? error.message : "Unknown error"}`);
40
+ process.exit(1);
41
+ }
42
+ }
43
+ function showHelp() {
44
+ console.log(`
45
+ DocRouter MCP Server v0.1.0
46
+
47
+ USAGE:
48
+ docrouter-mcp [OPTIONS]
49
+
50
+ DESCRIPTION:
51
+ DocRouter MCP (Model Context Protocol) server that provides access to DocRouter
52
+ document processing, OCR, LLM extraction, and form management capabilities.
53
+
54
+ OPTIONS:
55
+ --url <URL> DocRouter API base URL
56
+ (default: https://app.docrouter.ai/fastapi)
57
+ --org-id <ID> DocRouter organization ID
58
+ --org-token <TOKEN> DocRouter organization API token
59
+ --timeout <MS> Request timeout in milliseconds (default: 30000)
60
+ --retries <COUNT> Number of retry attempts (default: 3)
61
+ --tools List all supported MCP tools
62
+ --claude-md Print CLAUDE.md contents
63
+ -h, --help Show this help message
64
+
65
+ ENVIRONMENT VARIABLES:
66
+ DOCROUTER_API_URL DocRouter API base URL
67
+ DOCROUTER_ORG_ID DocRouter organization ID
68
+ DOCROUTER_ORG_API_TOKEN DocRouter organization API token
69
+
70
+ EXAMPLES:
71
+ # Using command line arguments
72
+ docrouter-mcp --org-id "org123" --org-token "token456"
73
+
74
+ # Using environment variables
75
+ export DOCROUTER_ORG_ID="org123"
76
+ export DOCROUTER_ORG_API_TOKEN="token456"
77
+ docrouter-mcp
78
+
79
+ # With custom API URL
80
+ docrouter-mcp --url "https://custom.docrouter.ai/fastapi" --org-id "org123" --org-token "token456"
81
+
82
+ REQUIRED:
83
+ Either provide --org-id and --org-token as command line arguments,
84
+ or set DOCROUTER_ORG_ID and DOCROUTER_ORG_API_TOKEN environment variables.
85
+
86
+ For more information about DocRouter, visit: https://docrouter.ai
87
+ `);
88
+ }
27
89
  function parseConfig() {
28
90
  const args = process.argv.slice(2);
29
91
  const config = {};
92
+ if (args.includes("--help") || args.includes("-h")) {
93
+ showHelp();
94
+ process.exit(0);
95
+ }
96
+ if (args.includes("--tools")) {
97
+ showTools();
98
+ process.exit(0);
99
+ }
100
+ if (args.includes("--claude-md")) {
101
+ showClaudeMd();
102
+ process.exit(0);
103
+ }
30
104
  for (let i = 0; i < args.length; i += 2) {
31
105
  const key = args[i]?.replace("--", "");
32
106
  const value = args[i + 1];