3.5 KiB
3.5 KiB
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:
{
"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:
- Completely quit Cursor (not just close the window)
- Reopen Cursor
- Wait a few seconds for MCP servers to initialize
3. Check MCP Server Logs
- Open Cursor
- Go to
View→Output - In the dropdown, select
MCP: project-*or look for shadcn-related logs - Check for any error messages
4. Test MCP Server Manually
Test if the shadcn MCP server can run independently:
cd code
npx shadcn@latest mcp
If you have a GitHub token (for higher rate limits):
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:
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:
{
"mcpServers": {
"shadcn": {
"command": "npx",
"args": ["shadcn@latest", "mcp"],
"cwd": "./code"
}
}
}
8. Check Cursor Settings
- Open Cursor Settings (Cmd+, on Mac)
- Search for "MCP" or "Model Context Protocol"
- Verify that MCP servers are enabled
- Check if there are any error indicators
Expected Tools
When working correctly, the shadcn MCP server should provide these tools:
get_project_registries- List available component registrieslist_items_in_registries- List components in registriessearch_items_in_registries- Search for componentsview_items_in_registries- View component detailsget_item_examples_from_registries- Get component examplesget_add_command_for_items- Get installation commandsget_audit_checklist- Get component audit checklist
Verification
To verify the MCP server is working:
- Ask the AI assistant to use shadcn MCP tools
- The assistant should be able to call functions like
get_project_registries - If tools are not available, the server is not properly connected
Next Steps
- Try moving the MCP configuration to workspace root
- Restart Cursor completely
- Check MCP server logs for errors
- Verify the shadcn CLI can run the MCP server manually
- If issues persist, check the shadcn documentation: https://ui.shadcn.com/docs/mcp