docsie-mcp 0.1.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.
- package/README.md +41 -0
- package/bin/docsie-mcp.js +148 -0
- package/package.json +39 -0
package/README.md
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# docsie-mcp
|
|
2
|
+
|
|
3
|
+
Local stdio bridge for the hosted Docsie MCP server.
|
|
4
|
+
|
|
5
|
+
Use this package for MCP clients or directories that require a locally-run stdio server instead of a remote Streamable HTTP endpoint.
|
|
6
|
+
|
|
7
|
+
## Install Snippet
|
|
8
|
+
|
|
9
|
+
```json
|
|
10
|
+
{
|
|
11
|
+
"mcpServers": {
|
|
12
|
+
"docsie": {
|
|
13
|
+
"command": "npx",
|
|
14
|
+
"args": ["-y", "docsie-mcp"],
|
|
15
|
+
"env": {
|
|
16
|
+
"DOCSIE_MCP_TOKEN": "mcp_sa_...",
|
|
17
|
+
"DOCSIE_MCP_ENDPOINT": "https://app.docsie.io/mcp"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
`DOCSIE_MCP_ENDPOINT` defaults to `https://app.docsie.io/mcp`.
|
|
25
|
+
|
|
26
|
+
## Authentication
|
|
27
|
+
|
|
28
|
+
The first version expects a Docsie MCP service token:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
export DOCSIE_MCP_TOKEN=mcp_sa_...
|
|
32
|
+
npx -y docsie-mcp
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
The token is sent as:
|
|
36
|
+
|
|
37
|
+
```text
|
|
38
|
+
Authorization: Bearer <token>
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
The token still controls the selected Docsie organization, workspace, and permission packs.
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import readline from "node:readline";
|
|
4
|
+
|
|
5
|
+
const DEFAULT_ENDPOINT = "https://app.docsie.io/mcp";
|
|
6
|
+
const PROTOCOL_VERSION = "2025-06-18";
|
|
7
|
+
const TOKEN_ENV_NAMES = ["DOCSIE_MCP_TOKEN", "DOCSIE_SERVICE_TOKEN", "DOCSIE_API_TOKEN"];
|
|
8
|
+
|
|
9
|
+
function getConfig() {
|
|
10
|
+
const endpoint = (process.env.DOCSIE_MCP_ENDPOINT || DEFAULT_ENDPOINT).trim();
|
|
11
|
+
const tokenName = TOKEN_ENV_NAMES.find((name) => process.env[name]);
|
|
12
|
+
const token = tokenName ? process.env[tokenName].trim() : "";
|
|
13
|
+
return { endpoint, token, tokenName };
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function writeMessage(message) {
|
|
17
|
+
process.stdout.write(`${JSON.stringify(message)}\n`);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function makeResult(id, result) {
|
|
21
|
+
return { jsonrpc: "2.0", id, result };
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function makeError(id, code, message, data = undefined) {
|
|
25
|
+
const error = { code, message };
|
|
26
|
+
if (data !== undefined) {
|
|
27
|
+
error.data = data;
|
|
28
|
+
}
|
|
29
|
+
return { jsonrpc: "2.0", id, error };
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function missingTokenError(id) {
|
|
33
|
+
return makeError(
|
|
34
|
+
id,
|
|
35
|
+
-32001,
|
|
36
|
+
"Docsie MCP token is not configured. Set DOCSIE_MCP_TOKEN to a Docsie MCP service token.",
|
|
37
|
+
{ env: TOKEN_ENV_NAMES }
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
async function forwardToDocsie(payload) {
|
|
42
|
+
const { endpoint, token } = getConfig();
|
|
43
|
+
if (!token) {
|
|
44
|
+
return missingTokenError(payload.id ?? null);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const response = await fetch(endpoint, {
|
|
48
|
+
method: "POST",
|
|
49
|
+
headers: {
|
|
50
|
+
"Authorization": `Bearer ${token}`,
|
|
51
|
+
"Content-Type": "application/json",
|
|
52
|
+
"Accept": "application/json",
|
|
53
|
+
"MCP-Protocol-Version": PROTOCOL_VERSION,
|
|
54
|
+
"User-Agent": "docsie-mcp local-stdio-bridge/0.1.0"
|
|
55
|
+
},
|
|
56
|
+
body: JSON.stringify(payload)
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
const text = await response.text();
|
|
60
|
+
let body;
|
|
61
|
+
try {
|
|
62
|
+
body = text ? JSON.parse(text) : null;
|
|
63
|
+
} catch (error) {
|
|
64
|
+
return makeError(
|
|
65
|
+
payload.id ?? null,
|
|
66
|
+
-32603,
|
|
67
|
+
`Docsie MCP returned non-JSON HTTP ${response.status}`,
|
|
68
|
+
{ body: text.slice(0, 1000) }
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if (!response.ok && body && body.error) {
|
|
73
|
+
if (body.jsonrpc === "2.0") {
|
|
74
|
+
return body;
|
|
75
|
+
}
|
|
76
|
+
return makeError(payload.id ?? null, -32603, `Docsie MCP HTTP ${response.status}`, body);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
return body;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
async function handleMessage(message) {
|
|
83
|
+
if (!message || typeof message !== "object") {
|
|
84
|
+
return makeError(null, -32600, "Invalid Request");
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
const id = message.id ?? null;
|
|
88
|
+
const method = message.method;
|
|
89
|
+
|
|
90
|
+
if (!method) {
|
|
91
|
+
return makeError(id, -32600, "Invalid Request");
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
if (method.startsWith("notifications/")) {
|
|
95
|
+
return null;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
if (method === "initialize") {
|
|
99
|
+
return makeResult(id, {
|
|
100
|
+
protocolVersion: message.params?.protocolVersion || PROTOCOL_VERSION,
|
|
101
|
+
capabilities: { tools: { listChanged: true } },
|
|
102
|
+
serverInfo: { name: "Docsie MCP Local Bridge", version: "0.1.0" }
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
if (method === "ping") {
|
|
107
|
+
return makeResult(id, {});
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
if (
|
|
111
|
+
method === "tools/list" ||
|
|
112
|
+
method === "tools/call" ||
|
|
113
|
+
method === "resources/list" ||
|
|
114
|
+
method === "resources/templates/list" ||
|
|
115
|
+
method === "prompts/list" ||
|
|
116
|
+
method === "completion/complete" ||
|
|
117
|
+
method === "logging/setLevel"
|
|
118
|
+
) {
|
|
119
|
+
return forwardToDocsie(message);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
return makeError(id, -32601, "Method not found");
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
const rl = readline.createInterface({
|
|
126
|
+
input: process.stdin,
|
|
127
|
+
crlfDelay: Infinity
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
rl.on("line", async (line) => {
|
|
131
|
+
if (!line.trim()) {
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
try {
|
|
136
|
+
const message = JSON.parse(line);
|
|
137
|
+
const response = await handleMessage(message);
|
|
138
|
+
if (response) {
|
|
139
|
+
writeMessage(response);
|
|
140
|
+
}
|
|
141
|
+
} catch (error) {
|
|
142
|
+
writeMessage(makeError(null, -32700, "Parse error", String(error?.message || error)));
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
rl.on("close", () => {
|
|
147
|
+
// Let in-flight async request handlers finish before Node exits naturally.
|
|
148
|
+
});
|
package/package.json
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "docsie-mcp",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Local stdio bridge for the hosted Docsie MCP server.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"homepage": "https://github.com/LikaloLLC/docsie-mcp#readme",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/LikaloLLC/docsie-mcp.git",
|
|
10
|
+
"directory": "mcp-packages/npm"
|
|
11
|
+
},
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/LikaloLLC/docsie-mcp/issues"
|
|
14
|
+
},
|
|
15
|
+
"bin": {
|
|
16
|
+
"docsie-mcp": "bin/docsie-mcp.js"
|
|
17
|
+
},
|
|
18
|
+
"publishConfig": {
|
|
19
|
+
"access": "public"
|
|
20
|
+
},
|
|
21
|
+
"files": [
|
|
22
|
+
"bin/",
|
|
23
|
+
"README.md"
|
|
24
|
+
],
|
|
25
|
+
"engines": {
|
|
26
|
+
"node": ">=18"
|
|
27
|
+
},
|
|
28
|
+
"scripts": {
|
|
29
|
+
"test": "node --test"
|
|
30
|
+
},
|
|
31
|
+
"keywords": [
|
|
32
|
+
"docsie",
|
|
33
|
+
"mcp",
|
|
34
|
+
"model-context-protocol",
|
|
35
|
+
"documentation",
|
|
36
|
+
"video-to-docs"
|
|
37
|
+
],
|
|
38
|
+
"license": "UNLICENSED"
|
|
39
|
+
}
|