@apo100l/mcp-conf-server 0.0.0-stage → 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/LICENSE +21 -0
- package/README.md +72 -2
- package/build/browser-auth.d.ts +38 -0
- package/build/browser-auth.d.ts.map +1 -0
- package/build/browser-auth.js +148 -0
- package/build/browser-auth.js.map +1 -0
- package/build/index.d.ts +3 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +91 -0
- package/build/index.js.map +1 -0
- package/build/version.d.ts +2 -0
- package/build/version.d.ts.map +1 -0
- package/build/version.js +9 -0
- package/build/version.js.map +1 -0
- package/package.json +55 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Edrich Rocha
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,73 @@
|
|
|
1
|
-
#
|
|
1
|
+
# mcp-conf-server
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
MCP server for self-hosted Confluence Server / Data Center, based on [mcp-jira-server](https://github.com/apo100l/mcp-jira-server). Uses Confluence REST API and stdio transport. Requires Node.js 22+.
|
|
4
|
+
|
|
5
|
+
## Install and run
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
npm install
|
|
9
|
+
npm test
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
Configure your MCP client (replace the absolute path and environment values):
|
|
13
|
+
|
|
14
|
+
```json
|
|
15
|
+
{
|
|
16
|
+
"mcpServers": {
|
|
17
|
+
"confluence": {
|
|
18
|
+
"command": "node",
|
|
19
|
+
"args": ["/absolute/path/mcp-conf-server/build/index.js"],
|
|
20
|
+
"env": {
|
|
21
|
+
"CONFLUENCE_BASE_URL": "https://confluence.example.com",
|
|
22
|
+
"CONFLUENCE_PAT": "your-personal-access-token"
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Include a context path in the base URL when needed, e.g. `https://example.com/confluence`. Cloud API-token authentication is not implemented.
|
|
30
|
+
|
|
31
|
+
Alternatively set `CONFLUENCE_COOKIE`, or `CONFLUENCE_AUTH_MODE=browser` for SSO through installed Chrome. Call `conf_browser_login`, complete sign-in, then retry. Browser options: `CONFLUENCE_BROWSER_LOGIN_URL`, `CONFLUENCE_BROWSER_PROFILE`, `CONFLUENCE_BROWSER_CHANNEL`. Browser profile defaults to `~/.mcp-conf-server/chrome-profile`; protect it as a credential.
|
|
32
|
+
|
|
33
|
+
## Tools
|
|
34
|
+
|
|
35
|
+
- Browser login and authentication status; current user.
|
|
36
|
+
- CQL search, list spaces, get space.
|
|
37
|
+
- Read, create, update and trash pages; list child pages.
|
|
38
|
+
- Read/add comments, read/add labels.
|
|
39
|
+
|
|
40
|
+
All tool names use the `conf_` prefix. List tools to inspect exact input schemas. Bodies use Confluence storage XHTML. Updates require `currentVersion` obtained from `conf_get_page`; conflicts are surfaced without retry. List/search operations return one page and preserve pagination metadata; use `start` and `limit` for subsequent pages. Server permissions still apply.
|
|
41
|
+
|
|
42
|
+
## Validation
|
|
43
|
+
|
|
44
|
+
`npm test` checks TypeScript and builds the executable. Real-instance authentication and write operations require a configured Confluence instance and have not been tested by this project bootstrap.
|
|
45
|
+
|
|
46
|
+
API reference: https://developer.atlassian.com/server/confluence/rest/latest/
|
|
47
|
+
|
|
48
|
+
MIT license; retains the upstream license attribution.
|
|
49
|
+
|
|
50
|
+
## Publishing to npm
|
|
51
|
+
|
|
52
|
+
The `.github/workflows/publish.yml` workflow publishes `@apo100l/mcp-conf-server` on version tags (`v*.*.*`) or manual dispatch. It installs dependencies, verifies tag/version agreement, runs checks, inspects package contents, and publishes publicly using npm trusted publishing (OIDC).
|
|
53
|
+
|
|
54
|
+
In npm package settings, configure a GitHub Actions trusted publisher:
|
|
55
|
+
|
|
56
|
+
- Owner: `apo100l`
|
|
57
|
+
- Repository: `mcp-conf-server`
|
|
58
|
+
- Workflow filename: `publish.yml`
|
|
59
|
+
- Environment: leave empty
|
|
60
|
+
- Allow publishing
|
|
61
|
+
|
|
62
|
+
If the package does not yet exist on npm, publish its first version locally with an authorized npm account (`npm login`, then `npm publish --access public`), then configure the trusted publisher. No `NPM_TOKEN` repository secret is needed for subsequent workflow releases.
|
|
63
|
+
|
|
64
|
+
For the next release:
|
|
65
|
+
|
|
66
|
+
```sh
|
|
67
|
+
npm run release:patch
|
|
68
|
+
git push origin main --follow-tags
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
For an initial tag matching the existing version, use `git tag v0.1.0` and `git push origin v0.1.0` only if that version has not already been published. Published npm versions cannot be overwritten; manual dispatch also attempts to publish the version in `package.json`.
|
|
72
|
+
|
|
73
|
+
Reference: https://docs.npmjs.com/trusted-publishers/
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export interface BrowserAuthConfig {
|
|
2
|
+
baseUrl: string;
|
|
3
|
+
loginUrl?: string;
|
|
4
|
+
profileDir?: string;
|
|
5
|
+
channel?: string;
|
|
6
|
+
headless?: boolean;
|
|
7
|
+
userAgent?: string;
|
|
8
|
+
validationTtlMs?: number;
|
|
9
|
+
}
|
|
10
|
+
export interface BrowserAuthStatus {
|
|
11
|
+
authenticated: boolean;
|
|
12
|
+
browserOpened: boolean;
|
|
13
|
+
profileDir: string;
|
|
14
|
+
statusCode?: number;
|
|
15
|
+
message: string;
|
|
16
|
+
}
|
|
17
|
+
export declare class BrowserAuthenticationRequiredError extends Error {
|
|
18
|
+
constructor(message: string);
|
|
19
|
+
}
|
|
20
|
+
export declare class BrowserAuthProvider {
|
|
21
|
+
readonly profileDir: string;
|
|
22
|
+
private readonly baseUrl;
|
|
23
|
+
private readonly loginUrl;
|
|
24
|
+
private readonly channel;
|
|
25
|
+
private readonly headless;
|
|
26
|
+
private readonly userAgent?;
|
|
27
|
+
private readonly validationTtlMs;
|
|
28
|
+
private contextPromise;
|
|
29
|
+
private lastValidatedAt;
|
|
30
|
+
constructor(config: BrowserAuthConfig);
|
|
31
|
+
getCookieHeader(): Promise<string>;
|
|
32
|
+
openLogin(): Promise<BrowserAuthStatus>;
|
|
33
|
+
getStatus(useCache?: boolean): Promise<BrowserAuthStatus>;
|
|
34
|
+
close(): Promise<void>;
|
|
35
|
+
private getContext;
|
|
36
|
+
private getOrCreatePage;
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=browser-auth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browser-auth.d.ts","sourceRoot":"","sources":["../src/browser-auth.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE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node:path';
|
|
3
|
+
import { chromium } from 'playwright-core';
|
|
4
|
+
export class BrowserAuthenticationRequiredError extends Error {
|
|
5
|
+
constructor(message) {
|
|
6
|
+
super(message);
|
|
7
|
+
this.name = 'BrowserAuthenticationRequiredError';
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
export class BrowserAuthProvider {
|
|
11
|
+
profileDir;
|
|
12
|
+
baseUrl;
|
|
13
|
+
loginUrl;
|
|
14
|
+
channel;
|
|
15
|
+
headless;
|
|
16
|
+
userAgent;
|
|
17
|
+
validationTtlMs;
|
|
18
|
+
contextPromise = null;
|
|
19
|
+
lastValidatedAt = 0;
|
|
20
|
+
constructor(config) {
|
|
21
|
+
this.baseUrl = config.baseUrl.replace(/\/$/, '');
|
|
22
|
+
// Confluence root may answer 401 without redirecting to SSO; /login.action starts the SSO flow.
|
|
23
|
+
this.loginUrl = config.loginUrl || `${this.baseUrl}/login.action`;
|
|
24
|
+
this.profileDir = config.profileDir || join(homedir(), '.mcp-conf-server', 'chrome-profile');
|
|
25
|
+
this.channel = config.channel || 'chrome';
|
|
26
|
+
this.headless = config.headless ?? false;
|
|
27
|
+
this.userAgent = config.userAgent;
|
|
28
|
+
this.validationTtlMs = config.validationTtlMs ?? 60_000;
|
|
29
|
+
}
|
|
30
|
+
async getCookieHeader() {
|
|
31
|
+
const status = await this.getStatus(true);
|
|
32
|
+
if (!status.authenticated) {
|
|
33
|
+
await this.openLogin();
|
|
34
|
+
throw new BrowserAuthenticationRequiredError('Confluence browser session is not authenticated. Sign in in the opened browser window, then retry the Confluence request.');
|
|
35
|
+
}
|
|
36
|
+
const context = await this.getContext();
|
|
37
|
+
const cookies = await context.cookies(this.baseUrl);
|
|
38
|
+
if (cookies.length === 0) {
|
|
39
|
+
throw new BrowserAuthenticationRequiredError('No Confluence cookies were found in the persistent browser profile. Run conf_browser_login and sign in.');
|
|
40
|
+
}
|
|
41
|
+
return cookies.map(({ name, value }) => `${name}=${value}`).join('; ');
|
|
42
|
+
}
|
|
43
|
+
async openLogin() {
|
|
44
|
+
const context = await this.getContext();
|
|
45
|
+
const page = await this.getOrCreatePage(context);
|
|
46
|
+
await page.goto(this.loginUrl, { waitUntil: 'domcontentloaded', timeout: 30_000 });
|
|
47
|
+
await page.bringToFront();
|
|
48
|
+
this.lastValidatedAt = 0;
|
|
49
|
+
const status = await this.getStatus(false);
|
|
50
|
+
if (status.authenticated) {
|
|
51
|
+
return {
|
|
52
|
+
...status,
|
|
53
|
+
browserOpened: true,
|
|
54
|
+
message: 'Confluence browser session is authenticated and ready.',
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
return {
|
|
58
|
+
...status,
|
|
59
|
+
browserOpened: true,
|
|
60
|
+
message: 'Browser opened. Complete Confluence/SSO sign-in, then call conf_browser_auth_status or retry the Confluence request.',
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
async getStatus(useCache = true) {
|
|
64
|
+
const context = await this.getContext();
|
|
65
|
+
const now = Date.now();
|
|
66
|
+
if (useCache && this.lastValidatedAt > 0 && now - this.lastValidatedAt < this.validationTtlMs) {
|
|
67
|
+
return {
|
|
68
|
+
authenticated: true,
|
|
69
|
+
browserOpened: true,
|
|
70
|
+
profileDir: this.profileDir,
|
|
71
|
+
message: 'Confluence browser session was recently validated.',
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
try {
|
|
75
|
+
const response = await context.request.get(`${this.baseUrl}/rest/api/user/current`, {
|
|
76
|
+
headers: {
|
|
77
|
+
Accept: 'application/json',
|
|
78
|
+
...(this.userAgent ? { 'User-Agent': this.userAgent } : {}),
|
|
79
|
+
},
|
|
80
|
+
timeout: 20_000,
|
|
81
|
+
});
|
|
82
|
+
const contentType = response.headers()['content-type'] || '';
|
|
83
|
+
const user = contentType.includes('application/json') ? await response.json() : null;
|
|
84
|
+
const authenticated = response.ok() && !!user && user.type !== 'anonymous' && !!(user.username || user.userKey || user.accountId);
|
|
85
|
+
if (authenticated) {
|
|
86
|
+
this.lastValidatedAt = now;
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
this.lastValidatedAt = 0;
|
|
90
|
+
}
|
|
91
|
+
return {
|
|
92
|
+
authenticated,
|
|
93
|
+
browserOpened: true,
|
|
94
|
+
profileDir: this.profileDir,
|
|
95
|
+
statusCode: response.status(),
|
|
96
|
+
message: authenticated
|
|
97
|
+
? 'Confluence browser session is authenticated.'
|
|
98
|
+
: 'Confluence browser session requires sign-in.',
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
catch (error) {
|
|
102
|
+
this.lastValidatedAt = 0;
|
|
103
|
+
return {
|
|
104
|
+
authenticated: false,
|
|
105
|
+
browserOpened: true,
|
|
106
|
+
profileDir: this.profileDir,
|
|
107
|
+
message: `Could not validate Confluence browser session: ${error instanceof Error ? error.message : String(error)}`,
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
async close() {
|
|
112
|
+
const contextPromise = this.contextPromise;
|
|
113
|
+
this.contextPromise = null;
|
|
114
|
+
this.lastValidatedAt = 0;
|
|
115
|
+
if (contextPromise) {
|
|
116
|
+
const context = await contextPromise;
|
|
117
|
+
await context.close();
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
async getContext() {
|
|
121
|
+
if (this.contextPromise) {
|
|
122
|
+
const existingContext = await this.contextPromise;
|
|
123
|
+
if (existingContext.browser()?.isConnected()) {
|
|
124
|
+
return existingContext;
|
|
125
|
+
}
|
|
126
|
+
this.contextPromise = null;
|
|
127
|
+
this.lastValidatedAt = 0;
|
|
128
|
+
}
|
|
129
|
+
if (!this.contextPromise) {
|
|
130
|
+
this.contextPromise = chromium.launchPersistentContext(this.profileDir, {
|
|
131
|
+
channel: this.channel,
|
|
132
|
+
headless: this.headless,
|
|
133
|
+
userAgent: this.userAgent,
|
|
134
|
+
viewport: null,
|
|
135
|
+
args: ['--no-first-run'],
|
|
136
|
+
}).catch((error) => {
|
|
137
|
+
this.contextPromise = null;
|
|
138
|
+
throw error;
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
return await this.contextPromise;
|
|
142
|
+
}
|
|
143
|
+
async getOrCreatePage(context) {
|
|
144
|
+
const pages = context.pages();
|
|
145
|
+
return pages[0] || context.newPage();
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
//# sourceMappingURL=browser-auth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browser-auth.js","sourceRoot":"","sources":["../src/browser-auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAwB,MAAM,iBAAiB,CAAC;AAoBjE,MAAM,OAAO,kCAAmC,SAAQ,KAAK;IAC3D,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,oCAAoC,CAAC;IACnD,CAAC;CACF;AAED,MAAM,OAAO,mBAAmB;IACrB,UAAU,CAAS;IAEX,OAAO,CAAS;IAChB,QAAQ,CAAS;IACjB,OAAO,CAAS;IAChB,QAAQ,CAAU;IAClB,SAAS,CAAU;IACnB,eAAe,CAAS;IACjC,cAAc,GAAmC,IAAI,CAAC;IACtD,eAAe,GAAG,CAAC,CAAC;IAE5B,YAAY,MAAyB;QACnC,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QACjD,gGAAgG;QAChG,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC,QAAQ,IAAI,GAAG,IAAI,CAAC,OAAO,eAAe,CAAC;QAClE,IAAI,CAAC,UAAU,GAAG,MAAM,CAAC,UAAU,IAAI,IAAI,CAAC,OAAO,EAAE,EAAE,kBAAkB,EAAE,gBAAgB,CAAC,CAAC;QAC7F,IAAI,CAAC,OAAO,GAAG,MAAM,C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,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|
package/build/index.js
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
3
|
+
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
4
|
+
import { CallToolRequestSchema, ListToolsRequestSchema } from '@modelcontextprotocol/sdk/types.js';
|
|
5
|
+
import axios from 'axios';
|
|
6
|
+
import { BrowserAuthProvider } from './browser-auth.js';
|
|
7
|
+
import { packageVersion } from './version.js';
|
|
8
|
+
const base = process.env.CONFLUENCE_BASE_URL?.replace(/\/+$/, '');
|
|
9
|
+
let browser;
|
|
10
|
+
function authBrowser() {
|
|
11
|
+
if (!base)
|
|
12
|
+
throw new Error('Set CONFLUENCE_BASE_URL');
|
|
13
|
+
if (process.env.CONFLUENCE_AUTH_MODE !== 'browser')
|
|
14
|
+
throw new Error('Set CONFLUENCE_AUTH_MODE=browser');
|
|
15
|
+
return browser ??= new BrowserAuthProvider({ baseUrl: base, loginUrl: process.env.CONFLUENCE_BROWSER_LOGIN_URL, profileDir: process.env.CONFLUENCE_BROWSER_PROFILE, channel: process.env.CONFLUENCE_BROWSER_CHANNEL || 'chrome' });
|
|
16
|
+
}
|
|
17
|
+
async function api(method, path, params, data) {
|
|
18
|
+
if (!base)
|
|
19
|
+
throw new Error('Set CONFLUENCE_BASE_URL including the context path, if any');
|
|
20
|
+
const headers = { Accept: 'application/json' };
|
|
21
|
+
if (process.env.CONFLUENCE_AUTH_MODE === 'browser')
|
|
22
|
+
headers.Cookie = await authBrowser().getCookieHeader();
|
|
23
|
+
else if (process.env.CONFLUENCE_COOKIE)
|
|
24
|
+
headers.Cookie = process.env.CONFLUENCE_COOKIE;
|
|
25
|
+
else if (process.env.CONFLUENCE_PAT)
|
|
26
|
+
headers.Authorization = `Bearer ${process.env.CONFLUENCE_PAT}`;
|
|
27
|
+
else
|
|
28
|
+
throw new Error('Set CONFLUENCE_PAT, CONFLUENCE_COOKIE or CONFLUENCE_AUTH_MODE=browser');
|
|
29
|
+
const response = await axios.request({ method, url: `${base}/rest/api/${path}`, params, data, headers, timeout: 30000, maxRedirects: 0 });
|
|
30
|
+
if (response.status !== 204 && !String(response.headers['content-type']).includes('application/json'))
|
|
31
|
+
throw new Error('Expected JSON; check authentication and base URL');
|
|
32
|
+
return response.data || { success: true };
|
|
33
|
+
}
|
|
34
|
+
const str = { type: 'string' };
|
|
35
|
+
const paging = { start: { type: 'integer', minimum: 0, default: 0 }, limit: { type: 'integer', minimum: 1, maximum: 100, default: 25 } };
|
|
36
|
+
const tools = [];
|
|
37
|
+
const handlers = new Map();
|
|
38
|
+
function tool(name, description, properties, required, handler, write = false) {
|
|
39
|
+
tools.push({ name: `conf_${name}`, description, inputSchema: { type: 'object', properties, required, additionalProperties: false }, annotations: { readOnlyHint: !write, destructiveHint: write, idempotentHint: !write, openWorldHint: true } });
|
|
40
|
+
handlers.set(`conf_${name}`, handler);
|
|
41
|
+
}
|
|
42
|
+
const id = (s) => encodeURIComponent(s);
|
|
43
|
+
const page = (a) => ({ start: a.start ?? 0, limit: a.limit ?? 25 });
|
|
44
|
+
tool('browser_login', 'Open browser for Confluence SSO sign-in', {}, [], async () => authBrowser().openLogin());
|
|
45
|
+
tool('browser_auth_status', 'Check browser authentication', {}, [], async () => authBrowser().getStatus(false));
|
|
46
|
+
tool('get_current_user', 'Get authenticated user', {}, [], async () => api('GET', 'user/current'));
|
|
47
|
+
tool('search', 'Search content using CQL; returns one page with pagination metadata', { cql: str, ...paging }, ['cql'], async (a) => api('GET', 'content/search', { cql: a.cql, ...page(a), expand: 'space,version' }));
|
|
48
|
+
tool('get_spaces', 'List spaces (one page)', paging, [], async (a) => api('GET', 'space', page(a)));
|
|
49
|
+
tool('get_space', 'Get space details', { spaceKey: str }, ['spaceKey'], async (a) => api('GET', `space/${id(a.spaceKey)}`, { expand: 'description.plain,homepage' }));
|
|
50
|
+
tool('get_page', 'Read page with storage XHTML body, version and ancestors', { pageId: str }, ['pageId'], async (a) => api('GET', `content/${id(a.pageId)}`, { expand: 'body.storage,version,space,ancestors' }));
|
|
51
|
+
tool('get_children', 'List child pages (one page)', { pageId: str, ...paging }, ['pageId'], async (a) => api('GET', `content/${id(a.pageId)}/child/page`, page(a)));
|
|
52
|
+
tool('create_page', 'Create page; body must be Confluence storage XHTML', { spaceKey: str, title: str, body: str, parentId: str }, ['spaceKey', 'title', 'body'], async (a) => api('POST', 'content', undefined, { type: 'page', title: a.title, space: { key: a.spaceKey }, ...(a.parentId ? { ancestors: [{ id: a.parentId }] } : {}), body: { storage: { value: a.body, representation: 'storage' } } }), true);
|
|
53
|
+
tool('update_page', 'Update page using the current version returned by get_page. Conflicts are returned without retry.', { pageId: str, title: str, body: str, currentVersion: { type: 'integer', minimum: 1 } }, ['pageId', 'title', 'body', 'currentVersion'], async (a) => api('PUT', `content/${id(a.pageId)}`, undefined, { id: a.pageId, type: 'page', title: a.title, version: { number: a.currentVersion + 1 }, body: { storage: { value: a.body, representation: 'storage' } } }), true);
|
|
54
|
+
tool('delete_page', 'Move a page to trash', { pageId: str }, ['pageId'], async (a) => api('DELETE', `content/${id(a.pageId)}`), true);
|
|
55
|
+
tool('get_comments', 'List page comments (one page)', { pageId: str, ...paging }, ['pageId'], async (a) => api('GET', `content/${id(a.pageId)}/child/comment`, { ...page(a), expand: 'body.storage,version' }));
|
|
56
|
+
tool('add_comment', 'Add comment using storage XHTML', { pageId: str, body: str }, ['pageId', 'body'], async (a) => api('POST', 'content', undefined, { type: 'comment', container: { id: a.pageId, type: 'page' }, body: { storage: { value: a.body, representation: 'storage' } } }), true);
|
|
57
|
+
tool('get_labels', 'List labels (one page)', { pageId: str, ...paging }, ['pageId'], async (a) => api('GET', `content/${id(a.pageId)}/label`, page(a)));
|
|
58
|
+
tool('add_label', 'Add global label', { pageId: str, label: str }, ['pageId', 'label'], async (a) => api('POST', `content/${id(a.pageId)}/label`, undefined, { prefix: 'global', name: a.label }), true);
|
|
59
|
+
const server = new Server({ name: 'mcp-conf-server', version: packageVersion }, { capabilities: { tools: {} } });
|
|
60
|
+
server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools }));
|
|
61
|
+
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
62
|
+
try {
|
|
63
|
+
const definition = tools.find(t => t.name === request.params.name);
|
|
64
|
+
const handler = handlers.get(request.params.name);
|
|
65
|
+
if (!definition || !handler)
|
|
66
|
+
throw new Error('Unknown tool');
|
|
67
|
+
const args = request.params.arguments ?? {};
|
|
68
|
+
const schema = definition.inputSchema;
|
|
69
|
+
for (const key of schema.required ?? [])
|
|
70
|
+
if (!(key in args))
|
|
71
|
+
throw new Error(`Missing ${key}`);
|
|
72
|
+
for (const [key, value] of Object.entries(args)) {
|
|
73
|
+
const prop = schema.properties[key];
|
|
74
|
+
if (!prop)
|
|
75
|
+
throw new Error(`Unknown argument ${key}`);
|
|
76
|
+
if (prop.type === 'string' && (typeof value !== 'string' || !value.trim()))
|
|
77
|
+
throw new Error(`${key} must be a nonempty string`);
|
|
78
|
+
if (prop.type === 'integer' && (typeof value !== 'number' || !Number.isInteger(value) || value < prop.minimum || (prop.maximum && value > prop.maximum)))
|
|
79
|
+
throw new Error(`Invalid ${key}`);
|
|
80
|
+
}
|
|
81
|
+
return { content: [{ type: 'text', text: JSON.stringify(await handler(args), null, 2) }] };
|
|
82
|
+
}
|
|
83
|
+
catch (e) {
|
|
84
|
+
const message = axios.isAxiosError(e) ? `Confluence request failed${e.response ? ` (HTTP ${e.response.status})` : ''}` : e instanceof Error ? e.message : 'Request failed';
|
|
85
|
+
return { isError: true, content: [{ type: 'text', text: message }] };
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
for (const signal of ['SIGINT', 'SIGTERM'])
|
|
89
|
+
process.once(signal, async () => { await browser?.close(); await server.close(); process.exit(0); });
|
|
90
|
+
server.connect(new StdioServerTransport()).catch(() => { console.error('Failed to start Confluence MCP server'); process.exit(1); });
|
|
91
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,qBAAqB,EAAE,sBAAsB,EAAQ,MAAM,oCAAoC,CAAC;AACzG,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,mBAAmB,EAAE,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AAClE,IAAI,OAAwC,CAAC;AAC7C,SAAS,WAAW;IAClB,IAAI,CAAC,IAAI;QAAE,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IACtD,IAAI,OAAO,CAAC,GAAG,CAAC,oBAAoB,KAAK,SAAS;QAAE,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC;IACxG,OAAO,OAAO,KAAK,IAAI,mBAAmB,CAAC,EAAC,OAAO,EAAC,IAAI,EAAE,QAAQ,EAAC,OAAO,CAAC,GAAG,CAAC,4BAA4B,EAAE,UAAU,EAAC,OAAO,CAAC,GAAG,CAAC,0BAA0B,EAAE,OAAO,EAAC,OAAO,CAAC,GAAG,CAAC,0BAA0B,IAAI,QAAQ,EAAC,CAAC,CAAC;AAC/N,CAAC;AACD,KAAK,UAAU,GAAG,CAAC,MAAa,EAAE,IAAW,EAAE,MAAc,EAAE,IAAY;IACzE,IAAI,CAAC,IAAI;QAAE,MAAM,IAAI,KAAK,CAAC,4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AC,CAAC,KAAK,CAAC,GAAE,EAAE,GAAC,OAAO,CAAC,KAAK,CAAC,uCAAuC,CAAC,CAAC,CAAA,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAA,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,cAAc,QAAsB,CAAC"}
|
package/build/version.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { readFileSync } from 'node:fs';
|
|
2
|
+
import { fileURLToPath } from 'node:url';
|
|
3
|
+
const packageUrl = new URL('../package.json', import.meta.url);
|
|
4
|
+
const packageJson = JSON.parse(readFileSync(fileURLToPath(packageUrl), 'utf8'));
|
|
5
|
+
if (typeof packageJson.version !== 'string') {
|
|
6
|
+
throw new Error('package.json does not contain a valid version');
|
|
7
|
+
}
|
|
8
|
+
export const packageVersion = packageJson.version;
|
|
9
|
+
//# sourceMappingURL=version.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC,iBAAiB,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC/D,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,aAAa,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC,CAA0B,CAAC;AAEzG,IAAI,OAAO,WAAW,CAAC,OAAO,KAAK,QAAQ,EAAE,CAAC;IAC5C,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAC;AACnE,CAAC;AAED,MAAM,CAAC,MAAM,cAAc,GAAG,WAAW,CAAC,OAAO,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,57 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@apo100l/mcp-conf-server",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "MCP server for Confluence Data Center with PAT, cookie and browser SSO authentication",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "build/index.js",
|
|
7
|
+
"bin": {
|
|
8
|
+
"mcp-conf-server": "build/index.js"
|
|
9
|
+
},
|
|
10
|
+
"scripts": {
|
|
11
|
+
"build": "tsc",
|
|
12
|
+
"check": "tsc --noEmit",
|
|
13
|
+
"test": "npm run check && npm run build",
|
|
14
|
+
"watch": "tsc --watch",
|
|
15
|
+
"prepare": "npm run build",
|
|
16
|
+
"prepublishOnly": "npm test",
|
|
17
|
+
"dev": "tsx src/index.ts",
|
|
18
|
+
"release:patch": "npm version patch -m \"chore(release): v%s\"",
|
|
19
|
+
"release:minor": "npm version minor -m \"chore(release): v%s\"",
|
|
20
|
+
"release:major": "npm version major -m \"chore(release): v%s\""
|
|
21
|
+
},
|
|
22
|
+
"keywords": [
|
|
23
|
+
"mcp",
|
|
24
|
+
"confluence",
|
|
25
|
+
"self-hosted"
|
|
26
|
+
],
|
|
27
|
+
"author": "edrich13",
|
|
28
|
+
"license": "MIT",
|
|
29
|
+
"repository": {
|
|
30
|
+
"type": "git",
|
|
31
|
+
"url": "https://github.com/apo100l/mcp-conf-server.git"
|
|
32
|
+
},
|
|
33
|
+
"homepage": "https://github.com/apo100l/mcp-conf-server#readme",
|
|
34
|
+
"bugs": {
|
|
35
|
+
"url": "https://github.com/apo100l/mcp-conf-server/issues"
|
|
36
|
+
},
|
|
37
|
+
"dependencies": {
|
|
38
|
+
"@modelcontextprotocol/sdk": "^1.30.0",
|
|
39
|
+
"axios": "^1.20.0",
|
|
40
|
+
"playwright-core": "^1.63.0"
|
|
41
|
+
},
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"@types/node": "^22.10.2",
|
|
44
|
+
"tsx": "^4.19.2",
|
|
45
|
+
"typescript": "^5.7.2"
|
|
46
|
+
},
|
|
47
|
+
"files": [
|
|
48
|
+
"build/**/*",
|
|
49
|
+
"README.md",
|
|
50
|
+
"LICENSE"
|
|
51
|
+
],
|
|
52
|
+
"publishConfig": {
|
|
53
|
+
"access": "public",
|
|
54
|
+
"provenance": true,
|
|
55
|
+
"registry": "https://registry.npmjs.org/"
|
|
56
|
+
}
|
|
57
|
+
}
|