Claude Code guide in three levels, Beginner to Advanced: hands-on lessons with checked exercises, every volatile fact cited to its source. Independent community guide.
JavaScript agent-skillsagentic-codingai-agentsanthropicanthropic-claudebest-practicesclaudeclaude-aiclaude-codeclaude-code-guideclaude-code-hooksclaude-code-pluginsclaude-code-skillsclaude-code-tutorialclaude-code-workflowsguidelearn-claude-codemcpsubagentstutorial
Consolidate MCP troubleshooting into main documentation
Wesam Abousaidd0ef5cf2abf8
diff --git a/README.md b/README.mdindex a6b21a9..36f6c33 100644--- a/README.md+++ b/README.md@@ -375,6 +375,11 @@ Hooks execute **arbitrary shell commands** on your system automatically and can### Model Context Protocol (MCP)+> **📚 Comprehensive MCP Documentation**+> For detailed setup, configuration, and usage of MCP servers:+> - **[MCP Servers Documentation](./mcp-servers/)** - Complete guide with prerequisites, installation, and individual server documentation (Serena, Sequential Thinking, Memory, Playwright)+> - **[Troubleshooting Guide](./mcp-servers/README.md#troubleshooting)** - Common issues and solutions+#### The Core Problem: Fragmentation and Inefficiencydiff --git a/mcp-servers/README.md b/mcp-servers/README.mdnew file mode 100644index 0000000..664bdb8--- /dev/null+++ b/mcp-servers/README.md@@ -0,0 +1,407 @@+# MCP Servers Documentation++## Overview++This directory contains comprehensive documentation for the four core Model Context Protocol (MCP) servers that enhance Claude Code's capabilities.++---++## Available Servers++| Server | Purpose | Key Features | Documentation |+|--------|---------|--------------|---------------|+| **Serena** | Semantic code intelligence | • Multi-language support (15+)<br>• Symbol-level navigation<br>• Project indexing<br>• Context-aware editing | [serena.md](./serena.md) |+| **Sequential Thinking** | Advanced reasoning | • Problem decomposition<br>• Multi-step planning<br>• Structured analysis<br>• Decision support | [sequential-thinking.md](./sequential-thinking.md) |+| **Memory** | Persistent context | • Cross-session memory<br>• Project preferences<br>• Historical context<br>• Knowledge retention | [memory.md](./memory.md) |+| **Playwright** | Browser automation | • Web scraping<br>• Automated testing<br>• Screenshot capture<br>• Device emulation | [playwright.md](./playwright.md) |++---++## Server Comparison++### By Use Case++#### Code Development+- **Serena**: Deep codebase understanding and navigation+- **Sequential Thinking**: Planning complex implementations+- **Memory**: Remember project patterns and preferences++#### Web Automation+- **Playwright**: Browser control and testing+- **Memory**: Store authentication and workflow preferences++#### Research & Analysis+- **Serena**: Analyze code structure and dependencies+- **Sequential Thinking**: Break down complex problems+- **Playwright**: Gather web data++---++## Server Synergies++### Powerful Combinations++**1. Serena + Sequential Thinking**+```+Use case: Complex refactoring projects+- Sequential Thinking breaks down the approach+- Serena navigates and modifies code intelligently+```++**2. Memory + All Servers**+```+Use case: Enhanced context awareness+- Memory stores project conventions+- Other servers leverage this knowledge+```++**3. Playwright + Memory**+```+Use case: Automated testing workflows+- Playwright executes browser automation+- Memory remembers test patterns and credentials+```++**4. All Four Together**+```+Use case: Full-stack development+- Serena for backend code intelligence+- Playwright for frontend testing+- Sequential Thinking for planning+- Memory for project knowledge+```++---++## Getting Started++### Prerequisites++Before installing MCP servers, ensure the following tools are installed:++| Tool | Required By | Installation |+|------|-------------|--------------|+| **Node.js & npx** | Sequential Thinking, Memory, Playwright | [nodejs.org](https://nodejs.org/) |+| **uv & uvx** | Serena | [Install uv](https://docs.astral.sh/uv/getting-started/installation/) |+| **Claude Code CLI** | All servers | [Claude Docs](https://docs.claude.com/en/docs/claude-code) |++#### Verify Prerequisites++Run the following commands to check installations:++```bash+node --version+npx --version+uv --version+uvx --version+claude --version+```++> **Note:** All commands should return version numbers. If any command fails, install the missing prerequisite.++### Installation++MCP servers can be installed in two scopes:+- **Global (`-s user`)**: Available across all projects (recommended for everyday use)+- **Local (`-s local`)**: Project-specific installations (useful for testing)++#### Global Installation (Recommended)++Install servers globally to use them across all your projects:++```bash+# Serena - Semantic code intelligence+claude mcp add serena -s user -- uvx --from git+https://github.com/oraios/serena serena start-mcp-server++# Sequential Thinking - Step-by-step reasoning+claude mcp add sequential-thinking -s user -- npx -y @modelcontextprotocol/server-sequential-thinking++# Memory - Persistent context across sessions+claude mcp add memory -s user -- npx -y @modelcontextprotocol/server-memory++# Playwright - Browser automation+claude mcp add playwright -s user -- npx -y @playwright/mcp@latest+```++#### Local Installation (Project-Specific)++Install servers for a specific project only:++```bash+# Serena+claude mcp add serena -s local -- uvx --from git+https://github.com/oraios/serena serena start-mcp-server++# Sequential Thinking+claude mcp add sequential-thinking -s local -- npx -y @modelcontextprotocol/server-sequential-thinking++# Memory+claude mcp add memory -s local -- npx -y @modelcontextprotocol/server-memory++# Playwright+claude mcp add playwright -s local -- npx -y @playwright/mcp@latest+```++#### Verify Installation++After installing MCP servers, verify they are connected:++```bash+claude mcp list+```++**Expected output:**++```+Checking MCP server health...+sequential-thinking: ✓ Connected+serena: ✓ Connected+memory: ✓ Connected+playwright: ✓ Connected+```++> **Tip:** If a server shows as disconnected, try removing and reinstalling it, or see the [Troubleshooting section](#troubleshooting).++### Server-Specific Documentation++- **[Serena](./serena.md)** - For code-heavy projects+- **[Sequential Thinking](./sequential-thinking.md)** - For complex problem-solving+- **[Memory](./memory.md)** - For persistent project knowledge+- **[Playwright](./playwright.md)** - For web automation needs++---++## Installation Scopes++### Global (`-s user`)+- Available across all projects+- Recommended for everyday use+- Single installation, universal access++### Local (`-s local`)+- Project-specific configuration+- Useful for testing+- Isolated from other projects++---++## Troubleshooting++Having issues with MCP server installation or connection? This section covers common problems and their solutions.++### General Troubleshooting++#### 1️⃣ Server Shows "Failed to connect"++**Step 1: Verify Prerequisites**++```bash+node --version+npx --version+uv --version+uvx --version+```++All commands should return version numbers. Install any missing prerequisites.++**Step 2: Remove and Reinstall Server**++```bash+claude mcp remove <server-name> -s user+claude mcp add <server-name> -s user -- <command>+```++**Step 3: Check Configuration File**++Check `~/.claude.json` (macOS/Linux) or `%USERPROFILE%\.claude.json` (Windows) for syntax errors.++**Step 4: Restart Claude Code**++```bash+claude+```++#### 2️⃣ "Command not found" Errors++| Error | Solution |+|-------|----------|+| `npx not found` | Install Node.js from [nodejs.org](https://nodejs.org/) |+| `uvx not found` | Install uv from [docs.astral.sh](https://docs.astral.sh/uv/getting-started/installation/) |+| `claude not found` | Install Claude Code CLI from [docs.claude.com](https://docs.claude.com/en/docs/claude-code) |++---++### Serena-Specific Issues++#### 3️⃣ Serena Connection Failures++**Verify uv Installation**++```bash+uv --version+uvx --version+```++**Test Serena Directly**++```bash+uvx --from git+https://github.com/oraios/serena serena --help+```++**Common Issues**++| Issue | Solution |+|-------|----------|+| Directory permission errors | Check read/write permissions, especially on Windows/WSL |+| Project path incorrect | Verify `--project` path is absolute and exists |+| Indexing fails | Ensure project contains valid source files |++**Reinstall Serena**++```bash+claude mcp remove serena -s user+claude mcp add serena -s user -- uvx --from git+https://github.com/oraios/serena serena start-mcp-server+```++---++### Playwright-Specific Issues++#### 4️⃣ Playwright Connection Failures++**Verify Node.js**++```bash+node --version+npx --version+```++**Test Playwright Directly**++```bash+npx @playwright/mcp@latest --help+```++**Install Missing Browser Binaries**++```bash+npx playwright install chromium+npx playwright install firefox+npx playwright install webkit+```++**Common Issues**++| Issue | Solution |+|-------|----------|+| Port conflicts | Check if another process is using the port |+| Browser not visible | Remove `--headless` flag or check display settings |+| Chrome not installed (Windows) | Install Google Chrome manually |+| Timeout errors | Increase timeout in configuration or check network |++**Reinstall Playwright**++```bash+claude mcp remove playwright -s user+claude mcp add playwright -s user -- npx -y @playwright/mcp@latest+```++---++### Sequential Thinking & Memory Issues++#### 5️⃣ Sequential Thinking / Memory Failures++Both servers require Node.js and `npx`. If they fail to connect:++**Verify Prerequisites**++```bash+node --version+npx --version+```++**Test Server Directly**++```bash+# Sequential Thinking+npx -y @modelcontextprotocol/server-sequential-thinking --help++# Memory+npx -y @modelcontextprotocol/server-memory --help+```++**Reinstall Server**++```bash+# Sequential Thinking+claude mcp remove sequential-thinking -s user+claude mcp add sequential-thinking -s user -- npx -y @modelcontextprotocol/server-sequential-thinking++# Memory+claude mcp remove memory -s user+claude mcp add memory -s user -- npx -y @modelcontextprotocol/server-memory+```++---++### Complete Reinstall++#### 6️⃣ Full Server Reinstallation++If a server repeatedly fails, perform a complete reinstall:++```bash+# Remove from both scopes+claude mcp remove <server-name> -s local+claude mcp remove <server-name> -s user++# Reinstall globally+claude mcp add <server-name> -s user -- <command>+```++---++### Verification++#### 7️⃣ Verify All Servers++After troubleshooting, always verify server status:++```bash+claude mcp list+```++Expected output:++```+Checking MCP server health...+sequential-thinking: ✓ Connected+serena: ✓ Connected+memory: ✓ Connected+playwright: ✓ Connected+```++---++### Important Notes++- **Restart Claude Code** after configuration changes+- **Prefer one scope per server**: Combining global and local installations may cause conflicts+- **Check logs** in `~/.claude/logs/` for detailed error messages+- **Update regularly**: Use `@latest` for npm packages to get the newest versions++---++### Still Having Issues?++If problems persist:+1. Check the [Claude Code GitHub Issues](https://github.com/anthropics/claude-code/issues)+2. Review server-specific documentation (links below)+3. Ensure all prerequisites are correctly installed+4. Try reinstalling Claude Code CLI itself++---++## Additional Resources++- [Main README](../README.md) - Complete Claude Code guidediff --git a/mcp-servers/memory.md b/mcp-servers/memory.mdnew file mode 100644index 0000000..2d2152b--- /dev/null+++ b/mcp-servers/memory.md@@ -0,0 +1,127 @@+# Memory MCP Server++## Overview++The **Memory** server allows Claude Code to **store and retrieve information across sessions**, providing persistent context, remembering project details, and maintaining user preferences.++---++## Installation++### 1️⃣ Global Installation (Recommended)++Install Memory globally for cross-project persistence:++```bash+claude mcp add memory -s user -- npx -y @modelcontextprotocol/server-memory+```++### Local Installation (Project-Specific)++For project-specific memory storage:++```bash+claude mcp add memory -s local -- npx -y @modelcontextprotocol/server-memory+```++---++## Usage++### 2️⃣ Using Memory in Claude Code++Once installed, Memory automatically stores and retrieves context from your sessions.++#### Example: Storing Information++```+"Remember that the current project uses TypeScript"+```++Claude stores this information for future reference.++#### Example: Retrieving Information++Later in the same or a new session:++```+"What programming language is used in the current project?"+```++Claude responds:++```+"TypeScript"+```++---++## Features++- **Persistent context**: Information persists across sessions+- **Project-specific notes**: Remember project details, conventions, and preferences+- **User preferences**: Store personal preferences and workflow habits+- **Seamless integration**: Works automatically with Claude Code+- **Cross-session memory**: Recall information from previous conversations++---++## Use Cases++- Remember project-specific coding conventions+- Store frequently used commands or configurations+- Maintain context about ongoing tasks+- Track decisions made in previous sessions+- Remember team preferences and guidelines++---++## Integration with Other Servers++Memory works seamlessly with other MCP servers:++- **With Serena**: Combines persistent memory with semantic code understanding+- **With Sequential Thinking**: Enhances reasoning with historical project context+- **With Playwright**: Remembers browser automation preferences and configurations++> **Tip:** Global installation enables memory sharing across all projects, while local installation keeps project memories separate.++---++## Verification++Verify Memory is connected:++```bash+claude mcp list+```++Expected output:++```+memory: npx -y @modelcontextprotocol/server-memory - ✓ Connected+```++---++## Best Practices++- Use **global installation** for cross-project memory and user preferences+- Use **local installation** for project-specific isolated memory+- Regularly test memory recall to ensure proper functioning+- Combine with Serena for enhanced project-aware context++---++## Troubleshooting++If Memory fails to connect:+1. Verify Node.js is installed: `node --version`+2. Check `npx` availability: `npx --version`+3. Remove and reinstall:+ ```bash+ claude mcp remove memory -s user+ claude mcp add memory -s user -- npx -y @modelcontextprotocol/server-memory+ ```++For more help, see the [Troubleshooting Guide](./README.md#troubleshooting).\ No newline at end of filediff --git a/mcp-servers/playwright.md b/mcp-servers/playwright.mdnew file mode 100644index 0000000..d263f81--- /dev/null+++ b/mcp-servers/playwright.md@@ -0,0 +1,206 @@+# Playwright MCP Server++## Overview++The **Playwright** server provides **browser automation capabilities** for Claude Code, enabling web interaction, scraping, testing, and structured accessibility-based navigation.++---++## Installation++### 1️⃣ Basic Installation++#### Global Installation (Recommended)++```bash+claude mcp add playwright -s user -- npx -y @playwright/mcp@latest+```++#### Local Installation (Project-Specific)++```bash+claude mcp add playwright -s local -- npx -y @playwright/mcp@latest+```++---++## Advanced Configuration++### 2️⃣ Configuration Options++#### Specify Browser Type++```bash+claude mcp add playwright -s user -- npx -y @playwright/mcp@latest --browser chrome+```++Available browsers: `chrome`, `firefox`, `webkit`, `msedge`++#### Enable Headless Mode++```bash+claude mcp add playwright -s user -- npx -y @playwright/mcp@latest --headless+```++> **Note:** Headless mode runs the browser without a visible window.++#### Block Specific Origins++```bash+claude mcp add playwright -s user -- npx -y @playwright/mcp@latest --blocked-origins "https://ads.example.com;https://tracking.example.com"+```++Use semicolons (`;`) to separate multiple origins.++#### Emulate Specific Device++```bash+claude mcp add playwright -s user -- npx -y @playwright/mcp@latest --device "iPhone 15"+```++---++## Configuration File++### 3️⃣ Using a JSON Configuration++For complex setups, use a configuration file:++#### Create `playwright-mcp-config.json`++```json+{+ "browser": {+ "browserName": "chromium",+ "isolated": true,+ "launchOptions": {+ "headless": false,+ "channel": "chrome"+ }+ }+}+```++#### Install with Configuration++```bash+claude mcp add playwright -s user -- npx -y @playwright/mcp@latest --config /path/to/playwright-mcp-config.json+```++---++## Usage++### 4️⃣ Using Playwright in Claude Code++#### Open a Browser++In a Claude session:++```+"Use playwright mcp to open a browser to example.com"+```++**Behavior:**+- Playwright uses the **accessibility tree** by default (fast, lightweight)+- A visible browser window can be controlled by Claude+- **Manual authentication**: Login through the browser; cookies persist for the session++#### View Available Tools++Type in Claude:++```+/mcp+```++Then select **playwright** to see available tools:++| Tool | Description |+|------|-------------|+| `playwright_navigate` | Navigate to URLs |+| `playwright_screenshot` | Capture screenshots |+| `playwright_click` | Click elements |+| `playwright_fill` | Fill form fields |+| `playwright_evaluate` | Execute JavaScript |+| `playwright_scroll` | Scroll page content |+| `playwright_select` | Select dropdown options |++---++## Features++- **Accessibility-first navigation**: Uses accessibility tree for fast, structured interaction+- **Browser automation**: Automate clicks, form fills, and navigation+- **Web scraping**: Extract data from websites programmatically+- **Screenshot capture**: Take screenshots for documentation or debugging+- **JavaScript execution**: Run custom scripts in the browser context+- **Device emulation**: Test on different devices and screen sizes+- **Origin blocking**: Block ads, trackers, or unwanted domains++---++## Verification++Verify Playwright is connected:++```bash+claude mcp list+```++Expected output:++```+playwright: npx -y @playwright/mcp@latest - ✓ Connected+```++---++## Best Practices++- Use **global installation** for consistent access across projects+- Enable **headless mode** for automated testing without GUI+- Use **device emulation** for responsive testing+- Block **tracking domains** to speed up page loads+- Configure via **JSON file** for complex, reusable setups++---++## Use Cases++- Automated web scraping for data collection+- Cross-browser testing for web applications+- Screenshot generation for documentation+- Form automation for testing workflows+- Accessibility testing with the accessibility tree+- Web data extraction for research or analysis++---++## Troubleshooting++If Playwright fails to connect:++1. **Verify Node.js installation:**+ ```bash+ node --version+ npx --version+ ```++2. **Test Playwright directly:**+ ```bash+ npx @playwright/mcp@latest --help+ ```++3. **Install missing browser binaries:**+ ```bash+ npx playwright install chromium+ ```++4. **Check for port conflicts** or firewall issues++5. **On Windows**, ensure Google Chrome is installed++6. **Verify headless setting**: If browser is not visible, ensure `--headless` is not set++For more help, see the [Troubleshooting Guide](./README.md#troubleshooting).\ No newline at end of filediff --git a/mcp-servers/sequential-thinking.md b/mcp-servers/sequential-thinking.mdnew file mode 100644index 0000000..56bf0f3--- /dev/null+++ b/mcp-servers/sequential-thinking.md@@ -0,0 +1,100 @@+# Sequential Thinking MCP Server++## Overview++The **Sequential Thinking** server helps Claude Code **break down complex problems into manageable steps**, improving reasoning and multi-step task execution.++---++## Installation++### 1️⃣ Global Installation (Recommended)++Install Sequential Thinking globally for use across all projects:++```bash+claude mcp add sequential-thinking -s user -- npx -y @modelcontextprotocol/server-sequential-thinking+```++### Local Installation (Project-Specific)++For project-specific installations:++```bash+claude mcp add sequential-thinking -s local -- npx -y @modelcontextprotocol/server-sequential-thinking+```++---++## Usage++### 2️⃣ Using Sequential Thinking in Claude Code++Once installed, Sequential Thinking integrates automatically into Claude sessions. It activates when you request step-by-step reasoning or task breakdown.++#### Example Usage++```+"Break down the task of building a REST API into sequential steps"+```++Claude will respond with structured, step-by-step instructions, leveraging Sequential Thinking for organized problem-solving.++---++## Features++- **Complex problem decomposition**: Breaks down large tasks into manageable steps+- **Structured reasoning**: Provides logical, sequential thought processes+- **Planning assistance**: Helps organize multi-step workflows+- **Automatic integration**: Works seamlessly without manual activation++---++## Verification++Verify Sequential Thinking is connected:++```bash+claude mcp list+```++Expected output:++```+sequential-thinking: npx -y @modelcontextprotocol/server-sequential-thinking - ✓ Connected+```++---++## Best Practices++- **Use for planning**: Ideal for task breakdown and project planning+- **Complex workflows**: Best suited for multi-step reasoning tasks+- **Global installation**: Recommended for consistent availability across projects+- **No configuration needed**: Works out of the box after installation++---++## Use Cases++- Breaking down large features into implementation steps+- Planning architectural changes+- Debugging complex issues systematically+- Creating structured documentation outlines+- Organizing multi-stage deployments++---++## Troubleshooting++If Sequential Thinking fails to connect:+1. Verify Node.js is installed: `node --version`+2. Check `npx` availability: `npx --version`+3. Remove and reinstall:+ ```bash+ claude mcp remove sequential-thinking -s user+ claude mcp add sequential-thinking -s user -- npx -y @modelcontextprotocol/server-sequential-thinking+ ```++For more help, see the [Troubleshooting Guide](./README.md#troubleshooting).\ No newline at end of filediff --git a/mcp-servers/serena.md b/mcp-servers/serena.mdnew file mode 100644index 0000000..c1960c1--- /dev/null+++ b/mcp-servers/serena.md@@ -0,0 +1,119 @@+# Serena MCP Server++## Overview++Serena provides **semantic code intelligence** for Claude Code, enabling project understanding, symbol-level navigation, and intelligent editing across multiple programming languages.++---++## Installation++### 1️⃣ Global Installation (Recommended)++Install Serena globally for use across all projects:++```bash+claude mcp add serena -s user -- uvx --from git+https://github.com/oraios/serena serena start-mcp-server+```++### Local Installation (Project-Specific)++For project-specific installations:++```bash+claude mcp add serena -s local -- uvx --from git+https://github.com/oraios/serena serena start-mcp-server+```++### Optional: Project Context Installation++To automatically link Serena to your current project:++```bash+claude mcp add serena -s user -- uvx --from git+https://github.com/oraios/serena serena start-mcp-server --context ide-assistant --project $(pwd)+```++> **Note:** Using `--project $(pwd)` makes it project-specific even with global scope.++---++## Usage++### 2️⃣ Activate a Project++Within your Claude Code session, activate the current directory as a project:++```+"Activate the current directory as project using serena"+```++This tells Serena to treat the current folder as the active project context.++### 3️⃣ Index a Project (Optional, Recommended)++Indexing preloads your project into Serena for faster symbol lookup and semantic code understanding:++```bash+uvx --from git+https://github.com/oraios/serena serena project index+```++#### When to Index++- Once during initial project setup+- After significant code changes (new files, major refactors)+- When experiencing slow symbol lookups++> **Tip:** Indexing significantly improves search speed and context-aware suggestions.++---++## Features++- **Multi-language support**: Works with 15+ programming languages+- **Symbol-level navigation**: Jump to definitions, find references+- **Intelligent editing**: Context-aware code modifications+- **Project understanding**: Semantic analysis of codebase structure+- **Memory integration**: Combines with Memory MCP to persist project knowledge++---++## Verification++Verify Serena is connected:++```bash+claude mcp list+```++Expected output:++```+serena: uvx --from git+https://github.com/oraios/serena serena start-mcp-server - ✓ Connected+```++---++## Prerequisites++- **uv** must be installed: [Installation Guide](https://docs.astral.sh/uv/getting-started/installation/)+- Check installation: `uv --version`++---++## Best Practices++- Use **global scope** for general-purpose access across projects+- Use **project context** (`--project $(pwd)`) for dedicated, project-specific workflows+- Index projects regularly for optimal performance+- Combine with Memory MCP for enhanced context retention++---++## Troubleshooting++If Serena fails to connect:+1. Verify `uv` is installed: `uv --version`+2. Test Serena directly: `uvx --from git+https://github.com/oraios/serena serena --help`+3. Check directory permissions+4. Verify project path is correct (if using `--project`)++For more help, see the [Troubleshooting Guide](./README.md#troubleshooting).\ No newline at end of file