@ecubelabs/atlassian-mcp 1.13.1 → 1.14.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/dist/index.js CHANGED
@@ -4,7 +4,7 @@ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
4
4
  import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
5
5
  import { registerJiraTools } from './jira-tools-register.js';
6
6
  import { registerConfluenceTools } from './confluence-tools-register.js';
7
- import { cleanupOldTempFiles } from './libs/response-formatter.js';
7
+ import { cleanupOldTempFiles, validateTempDir } from './libs/response-formatter.js';
8
8
  // Create server instance
9
9
  const server = new McpServer({
10
10
  name: 'atlassian',
@@ -14,6 +14,7 @@ registerJiraTools(server);
14
14
  registerConfluenceTools(server);
15
15
  // Start the server
16
16
  async function main() {
17
+ validateTempDir();
17
18
  cleanupOldTempFiles();
18
19
  const transport = new StdioServerTransport();
19
20
  await server.connect(transport);
@@ -1,18 +1,50 @@
1
- import { writeFileSync, readdirSync, statSync, unlinkSync } from 'node:fs';
1
+ import { writeFileSync, readdirSync, statSync, unlinkSync, accessSync, constants } from 'node:fs';
2
2
  import { tmpdir } from 'node:os';
3
3
  import { join } from 'node:path';
4
4
  import { randomUUID } from 'node:crypto';
5
5
  const DEFAULT_THRESHOLD = 20_000;
6
6
  const MAX_AGE_MS = 60 * 60 * 1000; // 1 hour
7
+ function getTempDir() {
8
+ return process.env.ATLASSIAN_MCP_TEMP_DIR || tmpdir();
9
+ }
10
+ export function validateTempDir() {
11
+ const customDir = process.env.ATLASSIAN_MCP_TEMP_DIR;
12
+ if (!customDir)
13
+ return;
14
+ try {
15
+ accessSync(customDir, constants.W_OK);
16
+ }
17
+ catch {
18
+ console.error(`[atlassian-mcp] Warning: ATLASSIAN_MCP_TEMP_DIR="${customDir}" is not accessible or writable. ` +
19
+ `Temp file writes may fail. Ensure the directory exists and has write permissions.`);
20
+ }
21
+ }
7
22
  export function formatToolResponse(data, options) {
8
23
  const text = typeof data === 'string' ? data : JSON.stringify(data);
9
24
  const threshold = options.threshold ?? DEFAULT_THRESHOLD;
10
25
  if (text.length <= threshold) {
11
26
  return { content: [{ type: 'text', text }] };
12
27
  }
28
+ const tempDir = getTempDir();
13
29
  const fileName = `atlassian-mcp-${options.toolName}-${Date.now()}-${randomUUID().slice(0, 8)}.json`;
14
- const filePath = join(tmpdir(), fileName);
15
- writeFileSync(filePath, text, 'utf-8');
30
+ const filePath = join(tempDir, fileName);
31
+ try {
32
+ writeFileSync(filePath, text, 'utf-8');
33
+ }
34
+ catch (error) {
35
+ const errMsg = error instanceof Error ? error.message : String(error);
36
+ const message = [
37
+ `Response too large (${text.length.toLocaleString()} chars) but failed to save temp file.`,
38
+ ``,
39
+ `Error: ${errMsg}`,
40
+ `Directory: ${tempDir}`,
41
+ ``,
42
+ `To fix this, use the Bash tool to run:`,
43
+ ` mkdir -p "${tempDir}" && chmod 755 "${tempDir}"`,
44
+ `Then retry the original request.`,
45
+ ].join('\n');
46
+ return { content: [{ type: 'text', text: message }] };
47
+ }
16
48
  const message = [
17
49
  `Response too large (${text.length.toLocaleString()} chars). Full data saved to temporary file.`,
18
50
  ``,
@@ -27,7 +59,7 @@ export function formatToolResponse(data, options) {
27
59
  }
28
60
  export function cleanupOldTempFiles() {
29
61
  try {
30
- const dir = tmpdir();
62
+ const dir = getTempDir();
31
63
  const files = readdirSync(dir).filter((f) => f.startsWith('atlassian-mcp-') && f.endsWith('.json'));
32
64
  const now = Date.now();
33
65
  for (const file of files) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ecubelabs/atlassian-mcp",
3
- "version": "1.13.1",
3
+ "version": "1.14.0",
4
4
  "bin": "./dist/index.js",
5
5
  "repository": {
6
6
  "url": "https://github.com/Ecube-Labs/skynet.git"