Skip to main content
Glama
aaronfeingold

MCP Project Context Server

get_project_context

Retrieve detailed project context and current state from the MCP server to maintain continuity, reduce repetitive explanations, and streamline coding sessions by accessing essential project information.

Instructions

Get comprehensive project context and current state

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectIdYesProject ID

Implementation Reference

  • src/server.ts:91-126 (registration)
    Registration of the 'get_project_context' tool including inline handler and schema. The handler fetches context from ContextManager and wraps it in MCP response format.
    this.server.registerTool( "get_project_context", { title: "Get Project Context", description: "Get comprehensive project context and current state", inputSchema: { projectId: z.string().describe("Project ID"), }, }, async ({ projectId }) => { try { const context = await this.contextManager.getCurrentContext( projectId ); return { content: [ { type: "text", text: context, }, ], }; } catch (error) { return { content: [ { type: "text", text: `Error getting project context: ${ error instanceof Error ? error.message : "Unknown error" }`, }, ], }; } } );
  • The handler function for the tool, which calls ContextManager.getCurrentContext and returns the formatted text or error.
    async ({ projectId }) => { try { const context = await this.contextManager.getCurrentContext( projectId ); return { content: [ { type: "text", text: context, }, ], }; } catch (error) { return { content: [ { type: "text", text: `Error getting project context: ${ error instanceof Error ? error.message : "Unknown error" }`, }, ], }; } }
  • Tool metadata including title, description, and input schema (projectId: string).
    { title: "Get Project Context", description: "Get comprehensive project context and current state", inputSchema: { projectId: z.string().describe("Project ID"), },
  • Helper method that constructs the detailed markdown-formatted project context from project data, tasks, sessions, and decisions.
    async getCurrentContext(projectId: string): Promise<string> { const project = await this.store.getProject(projectId); if (!project) { return "Project not found"; } const recentSessions = await this.store.getProjectSessions(projectId); const lastSession = recentSessions[0]; return ` # Project: ${project.name} ## Current Status: ${project.status} ${project.description} ## Current Phase: ${project.currentPhase} ## Tech Stack: - Frontend: ${project.techStack.frontend.join(", ") || "Not specified"} - Backend: ${project.techStack.backend.join(", ") || "Not specified"} - Database: ${project.techStack.database.join(", ") || "Not specified"} - Infrastructure: ${ project.techStack.infrastructure.join(", ") || "Not specified" } ## Active Tasks (${ project.tasks.filter((t) => t.status !== "completed").length }): ${ project.tasks .filter((t) => t.status !== "completed") .map( (t) => `- [${t.status.toUpperCase()}] ${t.title} (Priority: ${t.priority})` ) .join("\n") || "No active tasks" } ## Next Steps: ${ project.nextSteps.map((step) => `- ${step}`).join("\n") || "No next steps defined" } ## Last Session Summary: ${ lastSession ? ` - Goals: ${lastSession.goals.join(", ")} - Achievements: ${lastSession.achievements.join(", ")} - Blockers: ${lastSession.blockers.join(", ")} - Next Session Plan: ${lastSession.nextSession.join(", ")} ` : "No previous sessions" } ## Recent Decisions: ${ project.decisions .slice(0, 3) .map( (d) => `- ${d.decision} (${new Date(d.timestamp).toLocaleDateString()})` ) .join("\n") || "No recent decisions" } `.trim(); }

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/aaronfeingold/mcp-project-context'

If you have feedback or need assistance with the MCP directory API, please join our Discord server