# Shadcn MCP Server Troubleshooting Guide ## Current Status - ✅ MCP configuration file exists at: `code/.cursor/mcp.json` (original) - ✅ MCP configuration file created at: `.cursor/mcp.json` (workspace root) - **FIXED** - ✅ Configuration looks correct - ✅ shadcn CLI is installed (version 3.5.1) - ⚠️ **ACTION REQUIRED**: Restart Cursor to load the MCP server ## Configuration Found The MCP configuration file at `code/.cursor/mcp.json` contains: ```json { "mcpServers": { "shadcn": { "command": "npx", "args": ["shadcn@latest", "mcp"] } } } ``` ## Troubleshooting Steps ### 1. ✅ FIXED: MCP Configuration Location **Issue Found**: The MCP configuration was in `code/.cursor/mcp.json`, but Cursor looks for it at the workspace root. **Fix Applied**: Configuration has been copied to `.cursor/mcp.json` at the workspace root. **Next Step**: Restart Cursor completely to load the MCP server. ### 2. Restart Cursor After any configuration changes: 1. Completely quit Cursor (not just close the window) 2. Reopen Cursor 3. Wait a few seconds for MCP servers to initialize ### 3. Check MCP Server Logs 1. Open Cursor 2. Go to `View` → `Output` 3. In the dropdown, select `MCP: project-*` or look for shadcn-related logs 4. Check for any error messages ### 4. Test MCP Server Manually Test if the shadcn MCP server can run independently: ```bash cd code npx shadcn@latest mcp ``` If you have a GitHub token (for higher rate limits): ```bash npx shadcn@latest mcp --github-api-key YOUR_GITHUB_TOKEN ``` ### 5. Verify Project Structure Ensure `components.json` exists and is properly configured: - Location: `code/components.json` - Should reference the correct paths for your project ### 6. Check Node.js and npm Ensure you have the required versions: ```bash node --version # Should be v18 or higher npm --version npx --version ``` ### 7. Alternative Configuration If the current configuration doesn't work, try specifying the full path: ```json { "mcpServers": { "shadcn": { "command": "npx", "args": ["shadcn@latest", "mcp"], "cwd": "./code" } } } ``` ### 8. Check Cursor Settings 1. Open Cursor Settings (Cmd+, on Mac) 2. Search for "MCP" or "Model Context Protocol" 3. Verify that MCP servers are enabled 4. Check if there are any error indicators ## Expected Tools When working correctly, the shadcn MCP server should provide these tools: 1. `get_project_registries` - List available component registries 2. `list_items_in_registries` - List components in registries 3. `search_items_in_registries` - Search for components 4. `view_items_in_registries` - View component details 5. `get_item_examples_from_registries` - Get component examples 6. `get_add_command_for_items` - Get installation commands 7. `get_audit_checklist` - Get component audit checklist ## Verification To verify the MCP server is working: 1. Ask the AI assistant to use shadcn MCP tools 2. The assistant should be able to call functions like `get_project_registries` 3. If tools are not available, the server is not properly connected ## Next Steps 1. Try moving the MCP configuration to workspace root 2. Restart Cursor completely 3. Check MCP server logs for errors 4. Verify the shadcn CLI can run the MCP server manually 5. If issues persist, check the shadcn documentation: https://ui.shadcn.com/docs/mcp ## Additional Resources - [Shadcn MCP Documentation](https://ui.shadcn.com/docs/mcp) - [Cursor MCP Setup Guide](https://docs.cursor.com/context/model-context-protocol)