|
| 1 | +# IDE Integration Guide for UseHooks MCP Server |
| 2 | + |
| 3 | +This guide explains how to integrate the UseHooks MCP server with popular IDEs like VSCode and Windsurf IDE. |
| 4 | + |
| 5 | +## Overview |
| 6 | + |
| 7 | +The UseHooks MCP server provides access to React hooks from usehooks.io through the Model Context Protocol (MCP). This allows AI assistants in your IDE to browse, search, and fetch React hooks with detailed implementation code and examples. |
| 8 | + |
| 9 | +## Prerequisites |
| 10 | + |
| 11 | +- Node.js 16.0.0 or higher |
| 12 | +- npm or pnpm package manager |
| 13 | +- VSCode or Windsurf IDE with MCP support |
| 14 | + |
| 15 | +## Installation |
| 16 | + |
| 17 | +### Global Installation (Recommended) |
| 18 | + |
| 19 | +```bash |
| 20 | +npm install -g mcp-usehooks |
| 21 | +``` |
| 22 | + |
| 23 | +### Local Installation |
| 24 | + |
| 25 | +```bash |
| 26 | +npm install mcp-usehooks |
| 27 | +``` |
| 28 | + |
| 29 | +## IDE Configuration |
| 30 | + |
| 31 | +### VSCode Integration |
| 32 | + |
| 33 | +#### Method 1: Using Claude Desktop Extension |
| 34 | + |
| 35 | +1. Install the Claude Desktop extension in VSCode |
| 36 | +2. Open VSCode settings (Cmd/Ctrl + ,) |
| 37 | +3. Search for "MCP" or "Claude" |
| 38 | +4. Add the following MCP server configuration: |
| 39 | + |
| 40 | +```json |
| 41 | +{ |
| 42 | + "claude.mcpServers": { |
| 43 | + "usehooks": { |
| 44 | + "command": "mcp-usehooks", |
| 45 | + "args": [], |
| 46 | + "env": {} |
| 47 | + } |
| 48 | + } |
| 49 | +} |
| 50 | +``` |
| 51 | + |
| 52 | +#### Method 2: Using Cline Extension (formerly Claude Dev) |
| 53 | + |
| 54 | +1. Install the Cline extension in VSCode |
| 55 | +2. Open the extension settings |
| 56 | +3. Navigate to MCP Servers configuration |
| 57 | +4. Add a new server with: |
| 58 | + - **Name**: `usehooks` |
| 59 | + - **Command**: `mcp-usehooks` |
| 60 | + - **Args**: `[]` (empty array) |
| 61 | + |
| 62 | +#### Method 3: Manual Configuration File |
| 63 | + |
| 64 | +Create or edit your MCP configuration file (usually `~/.config/claude-desktop/claude_desktop_config.json`): |
| 65 | + |
| 66 | +```json |
| 67 | +{ |
| 68 | + "mcpServers": { |
| 69 | + "usehooks": { |
| 70 | + "command": "mcp-usehooks", |
| 71 | + "args": [] |
| 72 | + } |
| 73 | + } |
| 74 | +} |
| 75 | +``` |
| 76 | + |
| 77 | +### Windsurf IDE Integration |
| 78 | + |
| 79 | +#### Using Built-in MCP Support |
| 80 | + |
| 81 | +1. Open Windsurf IDE |
| 82 | +2. Go to Settings → Extensions → MCP Servers |
| 83 | +3. Click "Add New Server" |
| 84 | +4. Configure the server: |
| 85 | + - **Server Name**: `UseHooks` |
| 86 | + - **Command**: `mcp-usehooks` |
| 87 | + - **Arguments**: Leave empty or `[]` |
| 88 | + - **Working Directory**: Leave default |
| 89 | + |
| 90 | +#### Alternative Configuration |
| 91 | + |
| 92 | +If Windsurf uses a configuration file, add this to your MCP config: |
| 93 | + |
| 94 | +```json |
| 95 | +{ |
| 96 | + "servers": { |
| 97 | + "usehooks": { |
| 98 | + "command": "mcp-usehooks", |
| 99 | + "args": [], |
| 100 | + "env": {} |
| 101 | + } |
| 102 | + } |
| 103 | +} |
| 104 | +``` |
| 105 | + |
| 106 | +## Local Development Setup |
| 107 | + |
| 108 | +If you're working with the source code locally: |
| 109 | + |
| 110 | +1. Clone the repository: |
| 111 | +```bash |
| 112 | +git clone https://github.com/small-lab-io/usehooks.io.git |
| 113 | +cd usehooks.io/packages/usehooks-mcp |
| 114 | +``` |
| 115 | + |
| 116 | +2. Install dependencies: |
| 117 | +```bash |
| 118 | +npm install |
| 119 | +``` |
| 120 | + |
| 121 | +3. Use the local path in your IDE configuration: |
| 122 | +```json |
| 123 | +{ |
| 124 | + "usehooks": { |
| 125 | + "command": "node", |
| 126 | + "args": ["/path/to/usehooks.io/packages/usehooks-mcp/mcp_usehooks_server.js"] |
| 127 | + } |
| 128 | +} |
| 129 | +``` |
| 130 | + |
| 131 | +## Verification |
| 132 | + |
| 133 | +To verify the integration is working: |
| 134 | + |
| 135 | +1. Restart your IDE after configuration |
| 136 | +2. Open a chat with your AI assistant |
| 137 | +3. Ask questions like: |
| 138 | + - "Show me available React hooks" |
| 139 | + - "Search for storage-related hooks" |
| 140 | + - "Get details about the use-counter hook" |
| 141 | + |
| 142 | +## Available Commands |
| 143 | + |
| 144 | +Once integrated, your AI assistant can use these tools: |
| 145 | + |
| 146 | +- **list_hooks**: List all available React hooks, optionally filtered by category |
| 147 | +- **search_hooks**: Search hooks by keyword in name, title, or description |
| 148 | +- **get_hook**: Get detailed information about a specific hook with implementation code |
| 149 | +- **get_categories**: Get all available hook categories |
| 150 | + |
| 151 | +## Troubleshooting |
| 152 | + |
| 153 | +### Common Issues |
| 154 | + |
| 155 | +1. **Command not found**: Ensure `mcp-usehooks` is installed globally or use the full path |
| 156 | +2. **Permission denied**: Check file permissions and ensure Node.js is properly installed |
| 157 | +3. **Server not starting**: Verify Node.js version (16.0.0+) and dependencies are installed |
| 158 | + |
| 159 | +### Debug Mode |
| 160 | + |
| 161 | +Run the server manually to check for errors: |
| 162 | + |
| 163 | +```bash |
| 164 | +# Global installation |
| 165 | +mcp-usehooks |
| 166 | + |
| 167 | +# Local installation |
| 168 | +npx mcp-usehooks |
| 169 | + |
| 170 | +# From source |
| 171 | +node mcp_usehooks_server.js |
| 172 | +``` |
| 173 | + |
| 174 | +### Logs |
| 175 | + |
| 176 | +Check your IDE's MCP server logs for connection issues. Most IDEs provide MCP server status in their settings or developer tools. |
| 177 | + |
| 178 | +## Configuration Options |
| 179 | + |
| 180 | +### Environment Variables |
| 181 | + |
| 182 | +You can configure the server behavior using environment variables: |
| 183 | + |
| 184 | +```json |
| 185 | +{ |
| 186 | + "usehooks": { |
| 187 | + "command": "mcp-usehooks", |
| 188 | + "args": [], |
| 189 | + "env": { |
| 190 | + "DEBUG": "true", |
| 191 | + "CACHE_TTL": "300" |
| 192 | + } |
| 193 | + } |
| 194 | +} |
| 195 | +``` |
| 196 | + |
| 197 | +### Custom Port (if needed) |
| 198 | + |
| 199 | +Some configurations might require specifying a port: |
| 200 | + |
| 201 | +```json |
| 202 | +{ |
| 203 | + "usehooks": { |
| 204 | + "command": "mcp-usehooks", |
| 205 | + "args": ["--port", "3001"] |
| 206 | + } |
| 207 | +} |
| 208 | +``` |
| 209 | + |
| 210 | +## Support |
| 211 | + |
| 212 | +If you encounter issues: |
| 213 | + |
| 214 | +1. Check the [GitHub Issues](https://github.com/small-lab-io/usehooks.io/issues) |
| 215 | +2. Create a new issue with: |
| 216 | + - Your IDE and version |
| 217 | + - Configuration used |
| 218 | + - Error messages or logs |
| 219 | + - Steps to reproduce |
| 220 | + |
| 221 | +## Contributing |
| 222 | + |
| 223 | +Contributions to improve IDE integration are welcome! Please submit pull requests or issues on the [GitHub repository](https://github.com/small-lab-io/usehooks.io). |
0 commit comments