@archbee/mcp 1.0.1 → 1.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/README.md +7 -6
- package/package.json +1 -1
- package/src/index.ts +2 -7
- package/dist/index.js +0 -118
- package/dist/index.js.map +0 -1
package/README.md
CHANGED
|
@@ -31,10 +31,9 @@ Add this server to your `claude_desktop_config.json` or `.cursor/mcp.json`
|
|
|
31
31
|
### Environment Variables - base link
|
|
32
32
|
|
|
33
33
|
- `API_BASE`: Link to your Archbee portal
|
|
34
|
-
- `API_KEY`: Your Archbee API token for corresponding Space
|
|
35
34
|
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
Space must be public, with no access control (no password, jwt etc)
|
|
36
|
+
Just copy-paste the link to the archbee space.
|
|
38
37
|
|
|
39
38
|
```json
|
|
40
39
|
{
|
|
@@ -43,8 +42,7 @@ Your space must be published with that apiKey.
|
|
|
43
42
|
"command": "npx",
|
|
44
43
|
"args": ["-y", "@archbee/mcp"],
|
|
45
44
|
"env": {
|
|
46
|
-
"API_BASE": "https://your-docs.io/"
|
|
47
|
-
"API_KEY": "<api-key-for-your-docspace>"
|
|
45
|
+
"API_BASE": "https://your-docs.io/"
|
|
48
46
|
}
|
|
49
47
|
}
|
|
50
48
|
}
|
|
@@ -53,7 +51,10 @@ Your space must be published with that apiKey.
|
|
|
53
51
|
|
|
54
52
|
### Environment Variables - space id
|
|
55
53
|
|
|
56
|
-
Alternatively, you can set space id, which can also be used for internal spaces
|
|
54
|
+
Alternatively, you can set space id, which can also be used for internal spaces.
|
|
55
|
+
|
|
56
|
+
You can get an API token from Space Settings in Archbee app.
|
|
57
|
+
Your space must be published with that apiKey.
|
|
57
58
|
|
|
58
59
|
- `SPACE_ID`: Space id starting with `PUBLISHED-`
|
|
59
60
|
- `API_KEY`: Your Archbee API token for that Space
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -4,8 +4,8 @@ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'
|
|
|
4
4
|
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js'
|
|
5
5
|
import { z } from 'zod'
|
|
6
6
|
|
|
7
|
-
import axios from 'axios'
|
|
8
7
|
import { CallToolResult } from '@modelcontextprotocol/sdk/types'
|
|
8
|
+
import axios from 'axios'
|
|
9
9
|
|
|
10
10
|
// Create an MCP server
|
|
11
11
|
const server = new McpServer({
|
|
@@ -61,10 +61,6 @@ const processUrl = (urlInput: string): string | null => {
|
|
|
61
61
|
const callMcpApi = async (
|
|
62
62
|
params: Record<string, any>
|
|
63
63
|
): Promise<CallToolResult> => {
|
|
64
|
-
const headers = {
|
|
65
|
-
Authorization: `Bearer ${process.env.API_KEY}`,
|
|
66
|
-
}
|
|
67
|
-
|
|
68
64
|
const urlInput = process.env.API_BASE || ''
|
|
69
65
|
const docSpaceIdInput = process.env.SPACE_ID || ''
|
|
70
66
|
|
|
@@ -74,7 +70,7 @@ const callMcpApi = async (
|
|
|
74
70
|
}
|
|
75
71
|
}
|
|
76
72
|
|
|
77
|
-
if (!process.env.API_KEY) {
|
|
73
|
+
if (!process.env.API_KEY && !urlInput) {
|
|
78
74
|
return { content: [{ type: 'text', text: 'API key not set.' }] }
|
|
79
75
|
}
|
|
80
76
|
|
|
@@ -106,7 +102,6 @@ const callMcpApi = async (
|
|
|
106
102
|
} else {
|
|
107
103
|
const response = await axios.get(urlMcp, {
|
|
108
104
|
params,
|
|
109
|
-
headers,
|
|
110
105
|
})
|
|
111
106
|
dataText = JSON.stringify(response.data)
|
|
112
107
|
}
|
package/dist/index.js
DELETED
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
'use strict'
|
|
3
|
-
var __importDefault =
|
|
4
|
-
(this && this.__importDefault) ||
|
|
5
|
-
function (mod) {
|
|
6
|
-
return mod && mod.__esModule ? mod : { default: mod }
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(exports, '__esModule', { value: true })
|
|
9
|
-
const mcp_js_1 = require('@modelcontextprotocol/sdk/server/mcp.js')
|
|
10
|
-
const stdio_js_1 = require('@modelcontextprotocol/sdk/server/stdio.js')
|
|
11
|
-
const zod_1 = require('zod')
|
|
12
|
-
const axios_1 = __importDefault(require('axios'))
|
|
13
|
-
// Create an MCP server
|
|
14
|
-
const server = new mcp_js_1.McpServer({
|
|
15
|
-
name: 'Archbee MCP',
|
|
16
|
-
version: '1.0.0',
|
|
17
|
-
})
|
|
18
|
-
server.tool('get_all_docs', {}, async ({}) => {
|
|
19
|
-
const params = {
|
|
20
|
-
tool: 'get-all-docs',
|
|
21
|
-
}
|
|
22
|
-
return callMcpApi(params)
|
|
23
|
-
})
|
|
24
|
-
server.tool('get_doc', { docId: zod_1.z.string() }, async ({ docId }) => {
|
|
25
|
-
const params = {
|
|
26
|
-
tool: 'get-doc',
|
|
27
|
-
docId,
|
|
28
|
-
}
|
|
29
|
-
return callMcpApi(params)
|
|
30
|
-
})
|
|
31
|
-
server.tool('search_query', { query: zod_1.z.string() }, async ({ query }) => {
|
|
32
|
-
const params = {
|
|
33
|
-
tool: 'search-query',
|
|
34
|
-
query,
|
|
35
|
-
}
|
|
36
|
-
return callMcpApi(params)
|
|
37
|
-
})
|
|
38
|
-
server.tool('search_title', { query: zod_1.z.string() }, async ({ query }) => {
|
|
39
|
-
const params = {
|
|
40
|
-
tool: 'search-title',
|
|
41
|
-
query,
|
|
42
|
-
}
|
|
43
|
-
return callMcpApi(params)
|
|
44
|
-
})
|
|
45
|
-
const processUrl = (urlInput) => {
|
|
46
|
-
try {
|
|
47
|
-
const url = new URL(urlInput)
|
|
48
|
-
url.pathname = url.pathname.endsWith('/')
|
|
49
|
-
? url.pathname + 'mcp'
|
|
50
|
-
: url.pathname + '/mcp'
|
|
51
|
-
return url.toString()
|
|
52
|
-
} catch (error) {
|
|
53
|
-
return null
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
const callMcpApi = async (params) => {
|
|
57
|
-
const headers = {
|
|
58
|
-
Authorization: `Bearer ${process.env.API_KEY}`,
|
|
59
|
-
}
|
|
60
|
-
const urlInput = process.env.API_BASE || ''
|
|
61
|
-
const docSpaceIdInput = process.env.SPACE_ID || ''
|
|
62
|
-
if (!urlInput && !docSpaceIdInput) {
|
|
63
|
-
return {
|
|
64
|
-
content: [{ type: 'text', text: 'API base URL or docSpaceId not set.' }],
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
if (!process.env.API_KEY) {
|
|
68
|
-
return { content: [{ type: 'text', text: 'API key not set.' }] }
|
|
69
|
-
}
|
|
70
|
-
const urlMcp = urlInput
|
|
71
|
-
? processUrl(urlInput)
|
|
72
|
-
: 'https://app.archbee.com/api/public-mcp'
|
|
73
|
-
if (urlMcp === null) {
|
|
74
|
-
return {
|
|
75
|
-
content: [{ type: 'text', text: 'Invalid API base URL format.' }],
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
try {
|
|
79
|
-
let dataText = ''
|
|
80
|
-
if (docSpaceIdInput) {
|
|
81
|
-
params.docSpaceId = docSpaceIdInput
|
|
82
|
-
const rawAuth = `${docSpaceIdInput}~${process.env.API_KEY}`
|
|
83
|
-
const base64Auth = Buffer.from(rawAuth).toString('base64')
|
|
84
|
-
const response = await axios_1.default.post(urlMcp, params, {
|
|
85
|
-
headers: {
|
|
86
|
-
Authorization: `Bearer ${base64Auth}`,
|
|
87
|
-
'Content-Type': 'application/json',
|
|
88
|
-
},
|
|
89
|
-
})
|
|
90
|
-
dataText = JSON.stringify(response.data)
|
|
91
|
-
} else {
|
|
92
|
-
const response = await axios_1.default.get(urlMcp, {
|
|
93
|
-
params,
|
|
94
|
-
headers,
|
|
95
|
-
})
|
|
96
|
-
dataText = JSON.stringify(response.data)
|
|
97
|
-
}
|
|
98
|
-
return {
|
|
99
|
-
content: [{ type: 'text', text: dataText }],
|
|
100
|
-
}
|
|
101
|
-
} catch (error) {
|
|
102
|
-
return {
|
|
103
|
-
content: [
|
|
104
|
-
{
|
|
105
|
-
type: 'text',
|
|
106
|
-
text: `Error in mcp: ${error} ${urlMcp} ${params}`,
|
|
107
|
-
},
|
|
108
|
-
],
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
const main = async () => {
|
|
113
|
-
// Start receiving messages on stdin and sending messages on stdout
|
|
114
|
-
const transport = new stdio_js_1.StdioServerTransport()
|
|
115
|
-
await server.connect(transport)
|
|
116
|
-
}
|
|
117
|
-
main()
|
|
118
|
-
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;AAEA,oEAAmE;AACnE,wEAAgF;AAChF,6BAAuB;AAEvB,kDAAyB;AAGzB,uBAAuB;AACvB,MAAM,MAAM,GAAG,IAAI,kBAAS,CAAC;IAC3B,IAAI,EAAE,aAAa;IACnB,OAAO,EAAE,OAAO;CACjB,CAAC,CAAA;AAEF,MAAM,CAAC,IAAI,CAAC,cAAc,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE;IAC3C,MAAM,MAAM,GAAG;QACb,IAAI,EAAE,cAAc;KACrB,CAAA;IACD,OAAO,UAAU,CAAC,MAAM,CAAC,CAAA;AAC3B,CAAC,CAAC,CAAA;AAEF,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE,EAAE,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE;IAChE,MAAM,MAAM,GAAG;QACb,IAAI,EAAE,SAAS;QACf,KAAK;KACN,CAAA;IACD,OAAO,UAAU,CAAC,MAAM,CAAC,CAAA;AAC3B,CAAC,CAAC,CAAA;AAEF,MAAM,CAAC,IAAI,CAAC,cAAc,EAAE,EAAE,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE,EAAE,EAAE,KAAK,EAAE,EA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