Skip to main content
Glama
aaronfeingold

MCP Project Context Server

list_projects

Retrieve all projects sorted by last access timestamp for easy reference and continuity in coding sessions within the MCP Project Context Server.

Instructions

List all projects ordered by last accessed

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Executes the list_projects tool: fetches all projects from storage, sorts by last accessed, formats into a markdown list, and returns as MCP content.
    async () => { try { const projects = await this.store.listProjects(); const projectList = projects .map( (p) => `- ${p.name} (${p.id}) - ${ p.status } - Last accessed: ${new Date( p.lastAccessedAt ).toLocaleDateString()}` ) .join("\n"); return { content: [ { type: "text", text: `Active Projects:\n${projectList || "No projects found"}`, }, ], }; } catch (error) { return { content: [ { type: "text", text: `Error listing projects: ${ error instanceof Error ? error.message : "Unknown error" }`, }, ], }; } }
  • Input schema (empty object), title, and description for the list_projects tool.
    { title: "List Projects", description: "List all projects ordered by last accessed", inputSchema: {}, },
  • src/server.ts:129-170 (registration)
    Registers the list_projects tool with MCP server, including schema and handler.
    this.server.registerTool( "list_projects", { title: "List Projects", description: "List all projects ordered by last accessed", inputSchema: {}, }, async () => { try { const projects = await this.store.listProjects(); const projectList = projects .map( (p) => `- ${p.name} (${p.id}) - ${ p.status } - Last accessed: ${new Date( p.lastAccessedAt ).toLocaleDateString()}` ) .join("\n"); return { content: [ { type: "text", text: `Active Projects:\n${projectList || "No projects found"}`, }, ], }; } catch (error) { return { content: [ { type: "text", text: `Error listing projects: ${ error instanceof Error ? error.message : "Unknown error" }`, }, ], }; } } );
  • Supporting method in ProjectStore that lists all project JSON files from storage directory, parses them, and sorts by lastAccessedAt descending.
    async listProjects(): Promise<ProjectContext[]> { const files = await fs.readdir(this.projectsDir); const projects: ProjectContext[] = []; for (const file of files) { if (file.endsWith(".json")) { const data = await fs.readJson(path.join(this.projectsDir, file)); projects.push(ProjectContextSchema.parse(data)); } } return projects.sort( (a, b) => new Date(b.lastAccessedAt).getTime() - new Date(a.lastAccessedAt).getTime() ); }

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