create_project
Generate a new project with initial context, including name, description, technology stack, and current phase, to streamline project setup and maintain context in the MCP Project Context Server.
Instructions
Create a new project with initial context
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| currentPhase | Yes | Current project phase | |
| description | Yes | Project description | |
| name | Yes | Project name | |
| techStack | No |
Implementation Reference
- src/server.ts:45-87 (handler)The handler function for the create_project MCP tool. It invokes the ProjectStore to create a new project and returns a formatted response with the project ID or error message.async ({ name, description, techStack, currentPhase }) => { try { const project = await this.store.createProject({ name, description, status: "planning", techStack: techStack || { frontend: [], backend: [], database: [], infrastructure: [], tools: [], }, architecture: { observability: [], }, currentPhase, nextSteps: [], tasks: [], decisions: [], notes: [], }); return { content: [ { type: "text", text: `Project "${project.name}" created with ID: ${project.id}`, }, ], }; } catch (error) { return { content: [ { type: "text", text: `Error creating project: ${ error instanceof Error ? error.message : "Unknown error" }`, }, ], }; } }
- src/server.ts:27-43 (schema)Input schema for the create_project tool, defining parameters like name, description, techStack, and currentPhase using Zod.{ title: "Create Project", description: "Create a new project with initial context", inputSchema: { name: z.string().describe("Project name"), description: z.string().describe("Project description"), techStack: z .object({ frontend: z.array(z.string()).default([]), backend: z.array(z.string()).default([]), database: z.array(z.string()).default([]), infrastructure: z.array(z.string()).default([]), tools: z.array(z.string()).default([]), }) .optional(), currentPhase: z.string().describe("Current project phase"), },
- src/server.ts:26-88 (registration)Registration of the create_project tool with the MCP server, specifying name, schema, and handler function."create_project", { title: "Create Project", description: "Create a new project with initial context", inputSchema: { name: z.string().describe("Project name"), description: z.string().describe("Project description"), techStack: z .object({ frontend: z.array(z.string()).default([]), backend: z.array(z.string()).default([]), database: z.array(z.string()).default([]), infrastructure: z.array(z.string()).default([]), tools: z.array(z.string()).default([]), }) .optional(), currentPhase: z.string().describe("Current project phase"), }, }, async ({ name, description, techStack, currentPhase }) => { try { const project = await this.store.createProject({ name, description, status: "planning", techStack: techStack || { frontend: [], backend: [], database: [], infrastructure: [], tools: [], }, architecture: { observability: [], }, currentPhase, nextSteps: [], tasks: [], decisions: [], notes: [], }); return { content: [ { type: "text", text: `Project "${project.name}" created with ID: ${project.id}`, }, ], }; } catch (error) { return { content: [ { type: "text", text: `Error creating project: ${ error instanceof Error ? error.message : "Unknown error" }`, }, ], }; } } );
- src/storage/project-store.ts:28-48 (helper)Helper function in ProjectStore that generates ID, validates with ProjectContextSchema, and persists the project as JSON file.async createProject( projectData: Omit< ProjectContext, "id" | "createdAt" | "updatedAt" | "lastAccessedAt" > ): Promise<ProjectContext> { const now = new Date().toISOString(); const project: ProjectContext = { ...projectData, id: uuidv4(), createdAt: now, updatedAt: now, lastAccessedAt: now, }; const validated = ProjectContextSchema.parse(project); const filePath = path.join(this.projectsDir, `${project.id}.json`); await fs.writeJson(filePath, validated, { spaces: 2 }); return validated; }
- src/types/project-types.ts:34-79 (schema)Zod schema for ProjectContext type, used by the storage layer to validate project data before persisting.export const ProjectContextSchema = z.object({ id: z.string(), name: z.string(), description: z.string(), status: ProjectStatusSchema, techStack: z.object({ frontend: z.array(z.string()).default([]), backend: z.array(z.string()).default([]), database: z.array(z.string()).default([]), infrastructure: z.array(z.string()).default([]), tools: z.array(z.string()).default([]), }), architecture: z.object({ pattern: z.string().optional(), deploymentTarget: z.string().optional(), scalingStrategy: z.string().optional(), observability: z.array(z.string()).default([]), }), currentPhase: z.string(), nextSteps: z.array(z.string()).default([]), tasks: z.array(TaskSchema).default([]), decisions: z .array( z.object({ id: z.string(), decision: z.string(), reasoning: z.string(), timestamp: z.string(), impact: z.string().optional(), }) ) .default([]), notes: z .array( z.object({ id: z.string(), content: z.string(), timestamp: z.string(), category: z.string().optional(), }) ) .default([]), createdAt: z.string(), updatedAt: z.string(), lastAccessedAt: z.string(), });