Skip to main content
Glama
Workspaces MCP

Workspaces MCP

by nazq
README.md
# ๐Ÿ  Workspaces MCP

**Intelligent workspace and context management for Claude Desktop**

A Model Context Protocol (MCP) server that automatically loads project context, manages workspaces, and provides shared instruction templates for enhanced Claude Desktop workflows.

[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![CI](https://github.com/nazq/workspaces_mcp/workflows/CI/badge.svg)](https://github.com/nazq/workspaces_mcp/actions)
[![Node.js](https://img.shields.io/badge/node-%3E%3D20.10.0-brightgreen)](https://nodejs.org/)
[![TypeScript](https://img.shields.io/badge/TypeScript-5.7-blue)](https://www.typescriptlang.org/)
[![Coverage](https://img.shields.io/badge/coverage-71.74%25-green)](#testing)

## โœจ Features

- **๐ŸŒ Auto-Loading Global Context** - Global instructions automatically load in every Claude session
- **๐Ÿ“ Smart Workspace Management** - Organize projects with automatic resource discovery
- **๐Ÿ”„ Shared Instruction Templates** - Reusable instructions for different project types
- **๐Ÿš€ DXT Distribution** - Official DXT packaging with one-click installation

## โšก Quick Start for Claude Desktop Users

**Just want to use this with Claude Desktop?** Follow these 3 simple steps:

### Step 1: Open Your Terminal

<details>
<summary><strong>๐ŸชŸ Windows</strong></summary>

1. Press `Windows key + R`
2. Type `powershell` and press Enter
3. A blue terminal window will open

</details>

<details>
<summary><strong>๐ŸŽ macOS</strong></summary>

1. Press `Cmd + Space` to open Spotlight
2. Type `Terminal` and press Enter
3. A terminal window will open

</details>

<details>
<summary><strong>๐Ÿง Linux</strong></summary>

1. Press `Ctrl + Alt + T`
2. Or search for "Terminal" in your applications
3. A terminal window will open

</details>

### Step 2: Run the Installation Script

Copy and paste the command for your operating system:

**Windows (PowerShell):**

```powershell
Invoke-WebRequest -Uri "https://raw.githubusercontent.com/nazq/mcp-core-tools/main/scripts/install_windows.ps1" -OutFile "install.ps1"; PowerShell -ExecutionPolicy Bypass -File install.ps1
```

**macOS:**

```bash
curl -fsSL https://raw.githubusercontent.com/nazq/mcp-core-tools/main/scripts/install_mac.sh | bash
```

**Linux:**

```bash
curl -fsSL https://raw.githubusercontent.com/nazq/mcp-core-tools/main/scripts/install_linux.sh | bash
```

This will:

- โœ… Install Node.js (if needed)
- โœ… Download and build the MCP server
- โœ… Configure Claude Desktop automatically
- โœ… Set up your workspace folders

### Step 3: Restart Claude Desktop

1. **Close Claude Desktop completely**
2. **Reopen Claude Desktop**
3. **Look for "๐ŸŒ Global Instructions"** in your resources panel
4. **Click it** to load your workspace context automatically

๐ŸŽ‰ **Done!** You now have intelligent workspace management in Claude Desktop.

**What happens next?** Claude will automatically load context from your `~/Documents/workspaces/SHARED_INSTRUCTIONS/GLOBAL.md` file in every session. You can edit this file to customize your global instructions.

---

## ๐Ÿ› ๏ธ Developer Quick Start

**Want to contribute or build from source?**

### Prerequisites

- [Node.js](https://nodejs.org/) โ‰ฅ20.10.0
- [Claude Desktop](https://claude.ai/desktop) application

### Build from Source

```bash
git clone https://github.com/nazq/workspaces_mcp.git
cd workspaces_mcp
npm ci
npm run dxt:package
# Install the generated .dxt file in Claude Desktop
```

## ๐Ÿ“– Usage

### Global Instructions

Global context automatically loads in every Claude session:

```bash
# Edit your global instructions (created automatically)
code ~/Documents/workspaces/SHARED_INSTRUCTIONS/GLOBAL.md
```

### Workspace Management

Use Claude's built-in tools:

- **`create_workspace`** - Set up new project workspace
- **`list_workspaces`** - See all your workspaces
- **`get_workspace_info`** - Get workspace details
- **`create_shared_instruction`** - Create reusable templates
- **`update_global_instructions`** - Update global context

### Workspace Structure

```
~/Documents/workspaces/
โ”œโ”€โ”€ SHARED_INSTRUCTIONS/
โ”‚   โ”œโ”€โ”€ GLOBAL.md              # Auto-loads in every session
โ”‚   โ”œโ”€โ”€ react-typescript.md    # Shared template
โ”‚   โ””โ”€โ”€ python-data.md         # Another template
โ”œโ”€โ”€ my-react-app/              # Your workspace
โ”‚   โ”œโ”€โ”€ README.md
โ”‚   โ”œโ”€โ”€ src/
โ”‚   โ””โ”€โ”€ package.json
โ””โ”€โ”€ data-analysis-project/     # Another workspace
    โ”œโ”€โ”€ analysis.py
    โ””โ”€โ”€ data.csv
```

## ๐Ÿ› ๏ธ Development

### Architecture

Built with a **5-layer architecture** for maintainability and testability. See [ARCH.md](ARCH.md) for detailed architecture documentation.

### Available Scripts

```bash
# Core workflow
npm run ci                    # Full CI pipeline (typecheck, lint, test, build)
npm run dxt:package          # Build + create DXT package
npm run dev                  # Development mode

# Quality checks
npm run typecheck            # TypeScript validation
npm run lint                 # ESLint validation
npm run format               # Prettier formatting
npm test                     # Run tests
```

### Building from Source

```bash
npm install
npm run build
npm test
```

## ๐Ÿงช Testing

Comprehensive test suite with 258 passing tests and 71.74% coverage:

- MCP Protocol Implementation
- Service Layer Business Logic
- File System Operations with Error Boundaries
- Transport Layer (STDIO/HTTP)
- CLI Functionality
- Security (Path traversal protection, input validation)

```bash
npm test                     # Run all tests
npm run test:coverage        # Coverage report
npm run test:integration     # Integration tests
```

## ๐Ÿ“ Configuration

### Environment Variables

- **`WORKSPACES_ROOT`** - Custom workspace directory (default: `~/Documents/workspaces`)
- **`WORKSPACES_LOG_LEVEL`** - Logging level (`debug`, `info`, `warn`, `error`, `fatal`)

### Claude Desktop Configuration

The DXT installer automatically configures Claude Desktop. Manual configuration example:

```json
{
  "mcpServers": {
    "workspaces-mcp": {
      "command": "node",
      "args": ["/path/to/server/dist/bin/server.js"],
      "env": {
        "WORKSPACES_ROOT": "/path/to/workspaces"
      }
    }
  }
}
```

**Config locations:**

- **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
- **Windows**: `%APPDATA%/Claude/claude_desktop_config.json`
- **Linux**: `~/.config/Claude/claude_desktop_config.json`

## ๐Ÿค Contributing

We welcome contributions! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.

1. Fork and clone the repository
2. Install dependencies: `npm install`
3. Create a branch: `git checkout -b feature/amazing-feature`
4. Make changes and add tests
5. Run: `npm run ci`
6. Commit: `git commit -m 'Add amazing feature'`
7. Push and open a Pull Request

## ๐Ÿ› Troubleshooting

### Common Issues

**Claude Desktop doesn't show resources:**

- Restart Claude Desktop after installation
- Check Node.js โ‰ฅ20.10.0 is installed
- Verify MCP server path in config

**Permission errors:**

- Run with appropriate permissions for config directory
- Check workspace directory permissions

**MCP server not found:**

- Build project: `npm run build`
- Verify server exists at `dist/bin/server.js`

### Getting Help

- ๐Ÿ“– [Documentation](docs/)
- ๐Ÿ’ฌ [Discussions](https://github.com/nazq/workspaces_mcp/discussions)
- ๐Ÿ› [Issues](https://github.com/nazq/workspaces_mcp/issues)

## ๐Ÿ“ License

MIT License - see [LICENSE](LICENSE) for details.

---

**Made with โค๏ธ for the Claude Desktop community**