register_project
Register project directories to enable Claude Code Connector access for planning, spec storage, and CLI invocation across development interfaces.
Instructions
Register a project directory for Claude Code Connector access
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Human-readable project name | |
| rootPath | Yes | Absolute path to project root | |
| id | No | Optional unique ID (auto-generated if not provided) | |
| specPaths | No | Relative paths for spec/doc storage |
Implementation Reference
- src/tools/register_project.ts:13-67 (handler)The main handler function that implements the register_project tool. Validates input arguments, checks path existence, generates project ID if needed, creates a Project object, persists it using ProjectManager, and returns success response.export async function registerProject(args: RegisterProjectArgs): Promise<{ success: boolean; projectId: string; message: string; }> { const projectManager = new ProjectManager(); // 1. Validate arguments if (!args.name || !args.rootPath) { throw new MCPError( ErrorCode.INVALID_ARGUMENTS, 'Name and rootPath are required' ); } // 3. Validate path exists const exists = await projectManager.validateProjectPath(args.rootPath); if (!exists) { throw new MCPError( ErrorCode.INVALID_PATH, `Project path does not exist or is not a directory: ${args.rootPath}`, "Please create the directory first or check the path." ); } // 4. Generate ID if not provided const id = args.id || generateId(args.name); if (!id) { throw new MCPError(ErrorCode.INVALID_ARGUMENTS, "Could not generate valid ID from name"); } const now = new Date().toISOString(); const project: Project = { id, name: args.name, rootPath: args.rootPath, specPaths: args.specPaths || ['docs/', 'specs/'], claudeStatePath: '.claude/', active: true, created: now, lastAccessed: now }; // 2. Check if project already exists (handled inside addProject) // 5. Save to projects.json await projectManager.addProject(project); // 6. Return success return { success: true, projectId: id, message: `Project '${args.name}' registered successfully at ${args.rootPath}` }; }
- src/models/types.ts:78-83 (schema)TypeScript interface defining the input arguments for the register_project tool.export interface RegisterProjectArgs { name: string; rootPath: string; id?: string; specPaths?: string[]; }
- src/index.ts:57-68 (registration)MCP tool registration in the ListTools handler, defining the name, description, and input schema for 'register_project'.name: 'register_project', description: 'Register a project directory for Claude Code Connector access', inputSchema: { type: 'object', properties: { name: { type: 'string', description: 'Human-readable project name' }, rootPath: { type: 'string', description: 'Absolute path to project root' }, id: { type: 'string', description: 'Optional unique ID (auto-generated if not provided)' }, specPaths: { type: 'array', items: { type: 'string' }, description: 'Relative paths for spec/doc storage' }, }, required: ['name', 'rootPath'], },
- src/index.ts:121-124 (registration)Tool execution routing in the CallToolRequest handler, dispatching to the registerProject function for 'register_project'.case 'register_project': return { content: [{ type: 'text', text: JSON.stringify(await registerProject(args as unknown as RegisterProjectArgs), null, 2) }] };
- src/tools/register_project.ts:6-10 (helper)Helper function to generate a project ID from the project name by sanitizing it.function generateId(name: string): string { return name .toLowerCase() .replace(/[^a-z0-9]+/g, '-') .replace(/^-|-$/g, '');