@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.mjs
CHANGED
|
@@ -21,9 +21,83 @@ var ConfigSchema = z.object({
|
|
|
21
21
|
timeout: z.number().default(3e4),
|
|
22
22
|
retries: z.number().default(3)
|
|
23
23
|
});
|
|
24
|
+
function showTools() {
|
|
25
|
+
const toolNames = tools.map((tool) => tool.name).sort();
|
|
26
|
+
console.log(toolNames.join("\n"));
|
|
27
|
+
}
|
|
28
|
+
function showClaudeMd() {
|
|
29
|
+
try {
|
|
30
|
+
const currentFile = fileURLToPath(import.meta.url);
|
|
31
|
+
const currentDir = dirname(currentFile);
|
|
32
|
+
const claudePath = join(currentDir, "CLAUDE.md");
|
|
33
|
+
const claudeContent = readFileSync(claudePath, "utf-8");
|
|
34
|
+
console.log(claudeContent);
|
|
35
|
+
} catch (error) {
|
|
36
|
+
console.error(`Error reading CLAUDE.md: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
37
|
+
process.exit(1);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
function showHelp() {
|
|
41
|
+
console.log(`
|
|
42
|
+
DocRouter MCP Server v0.1.0
|
|
43
|
+
|
|
44
|
+
USAGE:
|
|
45
|
+
docrouter-mcp [OPTIONS]
|
|
46
|
+
|
|
47
|
+
DESCRIPTION:
|
|
48
|
+
DocRouter MCP (Model Context Protocol) server that provides access to DocRouter
|
|
49
|
+
document processing, OCR, LLM extraction, and form management capabilities.
|
|
50
|
+
|
|
51
|
+
OPTIONS:
|
|
52
|
+
--url <URL> DocRouter API base URL
|
|
53
|
+
(default: https://app.docrouter.ai/fastapi)
|
|
54
|
+
--org-id <ID> DocRouter organization ID
|
|
55
|
+
--org-token <TOKEN> DocRouter organization API token
|
|
56
|
+
--timeout <MS> Request timeout in milliseconds (default: 30000)
|
|
57
|
+
--retries <COUNT> Number of retry attempts (default: 3)
|
|
58
|
+
--tools List all supported MCP tools
|
|
59
|
+
--claude-md Print CLAUDE.md contents
|
|
60
|
+
-h, --help Show this help message
|
|
61
|
+
|
|
62
|
+
ENVIRONMENT VARIABLES:
|
|
63
|
+
DOCROUTER_API_URL DocRouter API base URL
|
|
64
|
+
DOCROUTER_ORG_ID DocRouter organization ID
|
|
65
|
+
DOCROUTER_ORG_API_TOKEN DocRouter organization API token
|
|
66
|
+
|
|
67
|
+
EXAMPLES:
|
|
68
|
+
# Using command line arguments
|
|
69
|
+
docrouter-mcp --org-id "org123" --org-token "token456"
|
|
70
|
+
|
|
71
|
+
# Using environment variables
|
|
72
|
+
export DOCROUTER_ORG_ID="org123"
|
|
73
|
+
export DOCROUTER_ORG_API_TOKEN="token456"
|
|
74
|
+
docrouter-mcp
|
|
75
|
+
|
|
76
|
+
# With custom API URL
|
|
77
|
+
docrouter-mcp --url "https://custom.docrouter.ai/fastapi" --org-id "org123" --org-token "token456"
|
|
78
|
+
|
|
79
|
+
REQUIRED:
|
|
80
|
+
Either provide --org-id and --org-token as command line arguments,
|
|
81
|
+
or set DOCROUTER_ORG_ID and DOCROUTER_ORG_API_TOKEN environment variables.
|
|
82
|
+
|
|
83
|
+
For more information about DocRouter, visit: https://docrouter.ai
|
|
84
|
+
`);
|
|
85
|
+
}
|
|
24
86
|
function parseConfig() {
|
|
25
87
|
const args = process.argv.slice(2);
|
|
26
88
|
const config = {};
|
|
89
|
+
if (args.includes("--help") || args.includes("-h")) {
|
|
90
|
+
showHelp();
|
|
91
|
+
process.exit(0);
|
|
92
|
+
}
|
|
93
|
+
if (args.includes("--tools")) {
|
|
94
|
+
showTools();
|
|
95
|
+
process.exit(0);
|
|
96
|
+
}
|
|
97
|
+
if (args.includes("--claude-md")) {
|
|
98
|
+
showClaudeMd();
|
|
99
|
+
process.exit(0);
|
|
100
|
+
}
|
|
27
101
|
for (let i = 0; i < args.length; i += 2) {
|
|
28
102
|
const key = args[i]?.replace("--", "");
|
|
29
103
|
const value = args[i + 1];
|
|
@@ -1683,9 +1757,9 @@ This server provides access to DocRouter resources and tools.
|
|
|
1683
1757
|
}
|
|
1684
1758
|
case "help_prompts": {
|
|
1685
1759
|
try {
|
|
1686
|
-
const
|
|
1687
|
-
const
|
|
1688
|
-
const promptsPath = join(
|
|
1760
|
+
const currentFile = fileURLToPath(import.meta.url);
|
|
1761
|
+
const currentDir = dirname(currentFile);
|
|
1762
|
+
const promptsPath = join(currentDir, "docs/knowledge_base/prompts.md");
|
|
1689
1763
|
const promptsContent = readFileSync(promptsPath, "utf-8");
|
|
1690
1764
|
return {
|
|
1691
1765
|
content: [
|
|
@@ -1709,9 +1783,9 @@ This server provides access to DocRouter resources and tools.
|
|
|
1709
1783
|
}
|
|
1710
1784
|
case "help_schemas": {
|
|
1711
1785
|
try {
|
|
1712
|
-
const
|
|
1713
|
-
const
|
|
1714
|
-
const schemasPath = join(
|
|
1786
|
+
const currentFile = fileURLToPath(import.meta.url);
|
|
1787
|
+
const currentDir = dirname(currentFile);
|
|
1788
|
+
const schemasPath = join(currentDir, "docs/knowledge_base/schemas.md");
|
|
1715
1789
|
const schemasContent = readFileSync(schemasPath, "utf-8");
|
|
1716
1790
|
return {
|
|
1717
1791
|
content: [
|
|
@@ -1735,9 +1809,9 @@ This server provides access to DocRouter resources and tools.
|
|
|
1735
1809
|
}
|
|
1736
1810
|
case "help_forms": {
|
|
1737
1811
|
try {
|
|
1738
|
-
const
|
|
1739
|
-
const
|
|
1740
|
-
const formsPath = join(
|
|
1812
|
+
const currentFile = fileURLToPath(import.meta.url);
|
|
1813
|
+
const currentDir = dirname(currentFile);
|
|
1814
|
+
const formsPath = join(currentDir, "docs/knowledge_base/forms.md");
|
|
1741
1815
|
const formsContent = readFileSync(formsPath, "utf-8");
|
|
1742
1816
|
return {
|
|
1743
1817
|
content: [
|