@aashari/mcp-server-atlassian-confluence
Version:
Node.js/TypeScript MCP server for Atlassian Confluence. Provides tools enabling AI systems (LLMs) to list/get spaces & pages (content formatted as Markdown) and search via CQL. Connects AI seamlessly to Confluence knowledge bases using the standard MCP in
181 lines (180 loc) • 5.52 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.SpacesResponseSchema = exports.SpaceDetailedSchema = exports.OptionalCollectionSchema = exports.SpaceSchema = exports.SpacePropertySchema = exports.LabelSchema = exports.SpaceRoleAssignmentSchema = exports.SpacePermissionAssignmentSchema = exports.OperationSchema = exports.OptionalFieldLinksSchema = exports.OptionalFieldMetaSchema = exports.PermissionSubjectSchema = exports.SpaceLinksSchema = exports.SpaceIconSchema = exports.SpaceDescriptionSchema = exports.ContentRepresentationSchema = exports.SpaceStatusSchema = exports.SpaceTypeSchema = void 0;
/**
* Types for Atlassian Confluence Spaces API
*/
const zod_1 = require("zod");
/**
* Zod schemas for Atlassian Confluence Spaces API responses
*/
/**
* Space type enum schema
*/
exports.SpaceTypeSchema = zod_1.z.enum([
'global',
'personal',
'collaboration',
'knowledge_base',
]);
/**
* Space status enum schema
*/
exports.SpaceStatusSchema = zod_1.z.enum(['current', 'archived']);
/**
* Space sort order enum schema
*/
// Unused schema - commented out
// export const SpaceSortOrderSchema = z.enum([
// 'id',
// '-id',
// 'name',
// '-name',
// 'key',
// '-key'
// ]);
/**
* Content representation schema
*/
exports.ContentRepresentationSchema = zod_1.z.object({
representation: zod_1.z.string(),
value: zod_1.z.string(),
});
/**
* Space description schema
*/
exports.SpaceDescriptionSchema = zod_1.z
.object({
plain: exports.ContentRepresentationSchema.optional(),
view: exports.ContentRepresentationSchema.optional(),
})
.nullable();
/**
* Space icon schema
*/
exports.SpaceIconSchema = zod_1.z
.object({
path: zod_1.z.string().optional(),
apiDownloadLink: zod_1.z.string().optional(),
})
.nullable();
/**
* Space links schema
*/
exports.SpaceLinksSchema = zod_1.z.object({
webui: zod_1.z.string().optional(),
base: zod_1.z.string().optional(),
next: zod_1.z.string().optional(),
});
/**
* Permission subject schema
*/
exports.PermissionSubjectSchema = zod_1.z.object({
type: zod_1.z.enum(['user', 'group']),
identifier: zod_1.z.string(),
});
/**
* Optional field metadata schema
*/
exports.OptionalFieldMetaSchema = zod_1.z.object({
count: zod_1.z.number().optional(),
});
/**
* Optional field links schema
*/
exports.OptionalFieldLinksSchema = zod_1.z.object({
self: zod_1.z.string().optional(),
next: zod_1.z.string().optional(),
});
/**
* Operation schema (for permissions)
*/
exports.OperationSchema = zod_1.z.object({
key: zod_1.z.string().optional(),
target: zod_1.z.string().optional(),
targetType: zod_1.z.string(),
});
/**
* Space permission assignment schema
*/
exports.SpacePermissionAssignmentSchema = zod_1.z.object({
id: zod_1.z.string(),
subject: exports.PermissionSubjectSchema,
operation: exports.OperationSchema,
});
/**
* Space role assignment schema
*/
exports.SpaceRoleAssignmentSchema = zod_1.z.object({
id: zod_1.z.string(),
role: zod_1.z.string(),
subject: exports.PermissionSubjectSchema,
});
/**
* Label schema
*/
exports.LabelSchema = zod_1.z.object({
id: zod_1.z.string(),
name: zod_1.z.string(),
prefix: zod_1.z.string().optional(),
});
/**
* Space property schema
*/
exports.SpacePropertySchema = zod_1.z.object({
id: zod_1.z.string(),
key: zod_1.z.string(),
value: zod_1.z.any(), // Could be any JSON value
version: zod_1.z
.object({
number: zod_1.z.number(),
message: zod_1.z.string().optional(),
minorEdit: zod_1.z.boolean().optional(),
authorId: zod_1.z.string().optional(),
})
.optional(),
});
/**
* Base Space schema (common fields between basic and detailed spaces)
*/
exports.SpaceSchema = zod_1.z.object({
id: zod_1.z.string(),
key: zod_1.z.string(),
name: zod_1.z.string(),
type: exports.SpaceTypeSchema,
status: exports.SpaceStatusSchema,
authorId: zod_1.z.string(),
createdAt: zod_1.z.string(),
homepageId: zod_1.z.string().nullable(),
description: exports.SpaceDescriptionSchema.optional(),
icon: exports.SpaceIconSchema.optional(),
_links: exports.SpaceLinksSchema,
currentActiveAlias: zod_1.z.string().optional(),
spaceOwnerId: zod_1.z.string().optional(),
});
/**
* Optional collection schema - used for labels, properties, operations, etc.
*/
const OptionalCollectionSchema = (itemSchema) => zod_1.z.object({
results: zod_1.z.array(itemSchema),
meta: exports.OptionalFieldMetaSchema,
_links: exports.OptionalFieldLinksSchema,
});
exports.OptionalCollectionSchema = OptionalCollectionSchema;
/**
* Detailed Space schema with additional properties
*/
exports.SpaceDetailedSchema = exports.SpaceSchema.extend({
labels: (0, exports.OptionalCollectionSchema)(exports.LabelSchema).optional(),
properties: (0, exports.OptionalCollectionSchema)(exports.SpacePropertySchema).optional(),
operations: (0, exports.OptionalCollectionSchema)(exports.OperationSchema).optional(),
permissions: (0, exports.OptionalCollectionSchema)(exports.SpacePermissionAssignmentSchema).optional(),
roleAssignments: (0, exports.OptionalCollectionSchema)(exports.SpaceRoleAssignmentSchema).optional(),
});
/**
* Paginated response schema for spaces
*/
exports.SpacesResponseSchema = zod_1.z.object({
results: zod_1.z.array(exports.SpaceSchema),
_links: exports.SpaceLinksSchema.optional(),
});