UNPKG

@mseep/atlas-mcp-server

Version:

A Model Context Protocol (MCP) server for ATLAS, a Neo4j-powered task management system for LLM Agents - implementing a three-tier architecture (Projects, Tasks, Knowledge) to manage complex workflows.

132 lines (131 loc) 4.57 kB
import { ResourceTemplate } from "@modelcontextprotocol/sdk/server/mcp.js"; import { logger } from "../../utils/logger.js"; /** * Resource URIs for the Atlas MCP resources */ export const ResourceURIs = { // Project resources PROJECTS: "atlas://projects", PROJECT_TEMPLATE: "atlas://projects/{projectId}", // Task resources TASKS: "atlas://tasks", TASKS_BY_PROJECT: "atlas://projects/{projectId}/tasks", TASK_TEMPLATE: "atlas://tasks/{taskId}", // Knowledge resources KNOWLEDGE: "atlas://knowledge", KNOWLEDGE_BY_PROJECT: "atlas://projects/{projectId}/knowledge", KNOWLEDGE_TEMPLATE: "atlas://knowledge/{knowledgeId}" }; /** * Resource templates for the Atlas MCP resources */ export const ResourceTemplates = { // Project resource templates PROJECT: new ResourceTemplate(ResourceURIs.PROJECT_TEMPLATE, { list: () => ({ resources: [ { uri: ResourceURIs.PROJECTS, name: "All Projects", description: "List of all projects in the Atlas platform" } ] }) }), // Task resource templates TASK: new ResourceTemplate(ResourceURIs.TASK_TEMPLATE, { list: () => ({ resources: [ { uri: ResourceURIs.TASKS, name: "All Tasks", description: "List of all tasks in the Atlas platform" } ] }) }), TASKS_BY_PROJECT: new ResourceTemplate(ResourceURIs.TASKS_BY_PROJECT, { list: undefined }), // Knowledge resource templates KNOWLEDGE: new ResourceTemplate(ResourceURIs.KNOWLEDGE_TEMPLATE, { list: () => ({ resources: [ { uri: ResourceURIs.KNOWLEDGE, name: "All Knowledge", description: "List of all knowledge items in the Atlas platform" } ] }) }), KNOWLEDGE_BY_PROJECT: new ResourceTemplate(ResourceURIs.KNOWLEDGE_BY_PROJECT, { list: undefined }) }; /** * Convert Neo4j Project to Project Resource */ export function toProjectResource(project) { // Log the incoming project structure for debugging logger.debug('Converting project to resource:', { project }); // Ensure all fields are properly extracted const resource = { id: project.id, name: project.name, description: project.description, status: project.status, urls: project.urls || [], completionRequirements: project.completionRequirements, outputFormat: project.outputFormat, taskType: project.taskType, createdAt: project.createdAt, updatedAt: project.updatedAt }; logger.debug('Created project resource:', { resource }); return resource; } /** * Convert Neo4j Task (with added assignedToUserId) to Task Resource */ export function toTaskResource(task) { // Log the incoming task structure for debugging logger.debug('Converting task to resource:', { task }); const resource = { id: task.id, projectId: task.projectId, title: task.title, description: task.description, priority: task.priority, status: task.status, assignedTo: task.assignedToUserId, // Use assignedToUserId from the input object urls: task.urls || [], tags: task.tags || [], completionRequirements: task.completionRequirements, outputFormat: task.outputFormat, taskType: task.taskType, createdAt: task.createdAt, updatedAt: task.updatedAt }; logger.debug('Created task resource:', { resource }); return resource; } /** * Convert Neo4j Knowledge (with added domain/citations) to Knowledge Resource */ export function toKnowledgeResource(knowledge) { // Log the incoming knowledge structure for debugging logger.debug('Converting knowledge to resource:', { knowledge }); const resource = { id: knowledge.id, projectId: knowledge.projectId, text: knowledge.text, tags: knowledge.tags || [], domain: knowledge.domain || '', // Use domain from the input object, default to empty string if null citations: knowledge.citations || [], // Use citations from the input object createdAt: knowledge.createdAt, updatedAt: knowledge.updatedAt }; logger.debug('Created knowledge resource:', { resource }); return resource; }