@docrouter/mcp 0.1.0 → 0.1.2
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/CLAUDE.md +129 -0
- package/README.md +365 -8
- package/dist/CLAUDE.md +129 -0
- package/dist/index.js +83 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +83 -9
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -2
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];
|
|
@@ -1686,9 +1760,9 @@ This server provides access to DocRouter resources and tools.
|
|
|
1686
1760
|
}
|
|
1687
1761
|
case "help_prompts": {
|
|
1688
1762
|
try {
|
|
1689
|
-
const
|
|
1690
|
-
const
|
|
1691
|
-
const promptsPath = path.join(
|
|
1763
|
+
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)));
|
|
1764
|
+
const currentDir = path.dirname(currentFile);
|
|
1765
|
+
const promptsPath = path.join(currentDir, "docs/knowledge_base/prompts.md");
|
|
1692
1766
|
const promptsContent = fs.readFileSync(promptsPath, "utf-8");
|
|
1693
1767
|
return {
|
|
1694
1768
|
content: [
|
|
@@ -1712,9 +1786,9 @@ This server provides access to DocRouter resources and tools.
|
|
|
1712
1786
|
}
|
|
1713
1787
|
case "help_schemas": {
|
|
1714
1788
|
try {
|
|
1715
|
-
const
|
|
1716
|
-
const
|
|
1717
|
-
const schemasPath = path.join(
|
|
1789
|
+
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)));
|
|
1790
|
+
const currentDir = path.dirname(currentFile);
|
|
1791
|
+
const schemasPath = path.join(currentDir, "docs/knowledge_base/schemas.md");
|
|
1718
1792
|
const schemasContent = fs.readFileSync(schemasPath, "utf-8");
|
|
1719
1793
|
return {
|
|
1720
1794
|
content: [
|
|
@@ -1738,9 +1812,9 @@ This server provides access to DocRouter resources and tools.
|
|
|
1738
1812
|
}
|
|
1739
1813
|
case "help_forms": {
|
|
1740
1814
|
try {
|
|
1741
|
-
const
|
|
1742
|
-
const
|
|
1743
|
-
const formsPath = path.join(
|
|
1815
|
+
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)));
|
|
1816
|
+
const currentDir = path.dirname(currentFile);
|
|
1817
|
+
const formsPath = path.join(currentDir, "docs/knowledge_base/forms.md");
|
|
1744
1818
|
const formsContent = fs.readFileSync(formsPath, "utf-8");
|
|
1745
1819
|
return {
|
|
1746
1820
|
content: [
|