@archbee/mcp 1.0.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 ADDED
@@ -0,0 +1,74 @@
1
+ # Archbee MCP Server
2
+
3
+ This is a Model Context Protocol (MCP) server for interacting with the [Archbee API](https://docs.archbee.com/get-document). This server provides tools to read, search and list Archbee documents from your space using Large Language Models.
4
+
5
+ ### Tools
6
+
7
+ 1. get-doc
8
+ - Gets content of a document
9
+ - Input:
10
+ - id (string): Archbee id
11
+ - Returns: Content as markdown
12
+ 2. get-all-docs
13
+ - Gets content of all documents in space
14
+ - Returns: documents, as DocResponse\[]
15
+ 3. search-query
16
+ - Search docs by input query
17
+ - if query is empty, return all docs
18
+ - Input:
19
+ - query (string): text as part of documents to search
20
+ - Returns: documents containing query, as DocResponse\[]
21
+ 4. search-title
22
+ - Search docs by input title
23
+ - Input:
24
+ - query (string): text as part of titles to search
25
+ - Returns: documents with title containing query, as DocResponse\[]
26
+
27
+ ## Setup
28
+
29
+ Add this server to your `claude_desktop_config.json` or `.cursor/mcp.json`
30
+
31
+ ### Environment Variables - base link
32
+
33
+ - `API_BASE`: Link to your Archbee portal
34
+ - `API_KEY`: Your Archbee API token for corresponding Space
35
+
36
+ You can get an API token from Space Settings in Archbee app.
37
+ Your space must be published with that apiKey.
38
+
39
+ ```json
40
+ {
41
+ "mcpServers": {
42
+ "archbee": {
43
+ "command": "npx",
44
+ "args": ["-y", "archbee-mcp"],
45
+ "env": {
46
+ "API_BASE": "https://your-docs.io/mcp",
47
+ "API_KEY": "<api-key-for-your-docspace>"
48
+ }
49
+ }
50
+ }
51
+ }
52
+ ```
53
+
54
+ ### Environment Variables - space id
55
+
56
+ Alternatively, you can set space id, which can also be used for internal spaces:
57
+
58
+ - `SPACE_ID`: Space id starting with `PUBLISHED-`
59
+ - `API_KEY`: Your Archbee API token for that Space
60
+
61
+ ```json
62
+ {
63
+ "mcpServers": {
64
+ "archbee": {
65
+ "command": "npx",
66
+ "args": ["-y", "archbee-mcp"],
67
+ "env": {
68
+ "SPACE_ID": "<id-of-space>",
69
+ "API_KEY": "<api-key-of-space>"
70
+ }
71
+ }
72
+ }
73
+ }
74
+ ```
package/dist/index.js ADDED
@@ -0,0 +1,118 @@
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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;AAEA,oEAAmE;AACnE,wEAAgF;AAChF,6BAAuB;AAEv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EAAE;IACtB,mEAAmE;IACnE,MAAM,SAAS,GAAG,IAAI,+BAAoB,EAAE,CAAA;IAC5C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAA;AACjC,CAAC,CAAA;AAED,IAAI,EAAE,CAAA"}
package/package.json ADDED
@@ -0,0 +1,31 @@
1
+ {
2
+ "name": "@archbee/mcp",
3
+ "version": "1.0.0",
4
+ "description": "",
5
+ "main": "./dist/index.js",
6
+ "bin": {
7
+ "archbee-mcp": "./dist/index.js"
8
+ },
9
+ "scripts": {
10
+ "compile": "rm -rf ./dist && tsc",
11
+ "serve": "PORT=5001 npm run compile && PORT=5001 node ./dist/index.js",
12
+ "start": "PORT=5001 node ./dist/index.js",
13
+ "publish": "npm publish --access public"
14
+ },
15
+ "keywords": [
16
+ "mcp",
17
+ "modelcontextprotocol",
18
+ "server",
19
+ "archbee",
20
+ "claude",
21
+ "cursor",
22
+ "documentation",
23
+ "context"
24
+ ],
25
+ "dependencies": {
26
+ "@modelcontextprotocol/sdk": "^1.12.0",
27
+ "archbee-mcp": "^1.0.2",
28
+ "axios": "^1.9.0",
29
+ "zod": "^3.25.30"
30
+ }
31
+ }
package/src/index.ts ADDED
@@ -0,0 +1,135 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'
4
+ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js'
5
+ import { z } from 'zod'
6
+
7
+ import axios from 'axios'
8
+ import { CallToolResult } from '@modelcontextprotocol/sdk/types'
9
+
10
+ // Create an MCP server
11
+ const server = new McpServer({
12
+ name: 'Archbee MCP',
13
+ version: '1.0.0',
14
+ })
15
+
16
+ server.tool('get_all_docs', {}, async ({}) => {
17
+ const params = {
18
+ tool: 'get-all-docs',
19
+ }
20
+ return callMcpApi(params)
21
+ })
22
+
23
+ server.tool('get_doc', { docId: z.string() }, async ({ docId }) => {
24
+ const params = {
25
+ tool: 'get-doc',
26
+ docId,
27
+ }
28
+ return callMcpApi(params)
29
+ })
30
+
31
+ server.tool('search_query', { query: z.string() }, async ({ query }) => {
32
+ const params = {
33
+ tool: 'search-query',
34
+ query,
35
+ }
36
+ return callMcpApi(params)
37
+ })
38
+
39
+ server.tool('search_title', { query: z.string() }, async ({ query }) => {
40
+ const params = {
41
+ tool: 'search-title',
42
+ query,
43
+ }
44
+ return callMcpApi(params)
45
+ })
46
+
47
+ const processUrl = (urlInput: string): string | null => {
48
+ try {
49
+ const url = new URL(urlInput)
50
+
51
+ url.pathname = url.pathname.endsWith('/')
52
+ ? url.pathname + 'mcp'
53
+ : url.pathname + '/mcp'
54
+
55
+ return url.toString()
56
+ } catch (error) {
57
+ return null
58
+ }
59
+ }
60
+
61
+ const callMcpApi = async (
62
+ params: Record<string, any>
63
+ ): Promise<CallToolResult> => {
64
+ const headers = {
65
+ Authorization: `Bearer ${process.env.API_KEY}`,
66
+ }
67
+
68
+ const urlInput = process.env.API_BASE || ''
69
+ const docSpaceIdInput = process.env.SPACE_ID || ''
70
+
71
+ if (!urlInput && !docSpaceIdInput) {
72
+ return {
73
+ content: [{ type: 'text', text: 'API base URL or docSpaceId not set.' }],
74
+ }
75
+ }
76
+
77
+ if (!process.env.API_KEY) {
78
+ return { content: [{ type: 'text', text: 'API key not set.' }] }
79
+ }
80
+
81
+ const urlMcp = urlInput
82
+ ? processUrl(urlInput)
83
+ : 'https://app.archbee.com/api/public-mcp'
84
+
85
+ if (urlMcp === null) {
86
+ return {
87
+ content: [{ type: 'text', text: 'Invalid API base URL format.' }],
88
+ }
89
+ }
90
+
91
+ try {
92
+ let dataText: string = ''
93
+
94
+ if (docSpaceIdInput) {
95
+ params.docSpaceId = docSpaceIdInput
96
+ const rawAuth = `${docSpaceIdInput}~${process.env.API_KEY}`
97
+ const base64Auth = Buffer.from(rawAuth).toString('base64')
98
+
99
+ const response = await axios.post(urlMcp, params, {
100
+ headers: {
101
+ Authorization: `Bearer ${base64Auth}`,
102
+ 'Content-Type': 'application/json',
103
+ },
104
+ })
105
+ dataText = JSON.stringify(response.data)
106
+ } else {
107
+ const response = await axios.get(urlMcp, {
108
+ params,
109
+ headers,
110
+ })
111
+ dataText = JSON.stringify(response.data)
112
+ }
113
+
114
+ return {
115
+ content: [{ type: 'text', text: dataText }],
116
+ }
117
+ } catch (error) {
118
+ return {
119
+ content: [
120
+ {
121
+ type: 'text',
122
+ text: `Error in mcp: ${error} ${urlMcp} ${params}`,
123
+ },
124
+ ],
125
+ }
126
+ }
127
+ }
128
+
129
+ const main = async () => {
130
+ // Start receiving messages on stdin and sending messages on stdout
131
+ const transport = new StdioServerTransport()
132
+ await server.connect(transport)
133
+ }
134
+
135
+ main()
package/tsconfig.json ADDED
@@ -0,0 +1,15 @@
1
+ {
2
+ "compilerOptions": {
3
+ "esModuleInterop": true,
4
+ "module": "commonjs",
5
+ "noImplicitReturns": true,
6
+ "outDir": "dist",
7
+ "sourceMap": true,
8
+ "strict": true,
9
+ "target": "es2019",
10
+ "skipLibCheck": true,
11
+ "skipDefaultLibCheck": true
12
+ },
13
+ "compileOnSave": true,
14
+ "include": ["src"]
15
+ }