peta-desk
CLAUDE.md9 starsChanged 12 months agoMITView on GitHub
This is a Model Context Protocol (MCP) Desktop Application built with Electron. The project has evolved from a distributed multi-service architecture to an integrated architecture where MCP services run directly within the Electron main process, eliminating external Node.js dependencies in production. Key architectural features: - Integrated MCP Service - MCP functionality built directly into Electron main process (electron/mcp-service.js) - IPC Communication - Replaces HTTP requests for better performance - Next.js Frontend - React-based UI with TailwindCSS, exported to static files…
- Installs packages
In this repositoryOne other file it gives its agents.
- AGENTS.mdAGENTS.md
The file
We split this CLAUDE.md into the rules it gives an agent
8 rules. About 0 are common, 2 are distinctive, and 6 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 78
No external HTTP servers required
- Distinctive: line 121
Extra Resources: No longer includes gateway/host folders (integrated architecture)
- Very specific: line 131
Add tool definition to availableTools array in electron/mcp-service.js
- Very specific: line 136
Create component in appropriate route group under frontend/app/
- Very specific: line 137
Update navigation in frontend/components/dashboard-sidebar.tsx if needed
- Very specific: line 141
Add handler in electron/mcp-service.js using ipcMain.handle()
- Very specific: line 143
Use in frontend via window.electronAPI
- Very specific: line 156
Use Chinese mirror: --registry=https://registry.npmmirror.com
≈ “Common” is an estimate: at least 1 in 5 of the 29,248 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Project Overview
This is a Model Context Protocol (MCP) Desktop Application built with Electron. The project has evolved from a distributed multi-service architecture to an integrated architecture where MCP services run directly within the Electron main process, eliminating external Node.js dependencies in production.
Key architectural features:
- Integrated MCP Service - MCP functionality built directly into Electron main process (
electron/mcp-service.js) - IPC Communication - Replaces HTTP requests for better performance
- Next.js Frontend - React-based UI with TailwindCSS, exported to static files for Electron
- Zero Runtime Dependencies - Packaged app requires no system Node.js
Key Development Commands
First-Time Setup
# Install all dependencies (uses Chinese npm mirror for faster installs)
node install-deps.js
# Build frontend static files (required before running Electron)
cd frontend && npm run build && cd ..Development Mode
# Primary development command - starts integrated Electron app
npm run dev
# or
node start-dev.js
# Alternative: Manual script with detailed logging
./run-manual.shBuilding & Packaging
# Production build (recommended - includes path fixes)
./build-production.sh
# Development build without code signing
./build-nosign.sh
# or
export CSC_IDENTITY_AUTO_DISCOVERY=false && npm run build
# Platform-specific builds
npm run build:mac
npm run build:win
npm run build:linuxTesting & Validation
# Frontend type checking and linting
cd frontend && npm run type-check
cd frontend && npm run lint
# Test dynamic port allocation
./test-port-fix.shArchitecture & Key Components
Integrated Service Architecture
The application uses an integrated architecture where MCP services run within the Electron main process:
- Electron Main Process (
electron/main.js):- Manages application lifecycle and window creation
- Integrates MCP service directly (no external processes)
- Handles command-line arguments and single instance lock
- Manages tray icon and biometric authentication
- MCP Service (
electron/mcp-service.js):- Built-in tools: echo, getSystemInfo, getCurrentTime
- IPC handlers for: getHosts, registerHost, invokeTool, heartbeat
- Self-registers as internal host on startup
- No external HTTP servers required
- Frontend Communication:
- Uses IPC (Inter-Process Communication) via preload script
window.electronAPIexposes MCP operations to renderer- Replaces axios HTTP calls with IPC for better performance
Frontend Architecture
- Framework: Next.js 15 with App Router, React 19
- UI Components: shadcn/ui built on Radix UI primitives
- Styling: TailwindCSS with custom animations
- Form Handling: React Hook Form with Zod validation
- Static Export: Built to
frontend/out/for Electron integration
Route Structure
frontend/app/
├── (dashboard)/ # Main app pages (client-management, backup, settings)
├── (onboarding)/ # Onboarding flow (welcome, mcp-setup, permissions)
├── quick-panel/ # Quick access panel interface
└── components/
├── ui/ # shadcn/ui components
└── common/ # Shared componentsImportant Implementation Details
Path Resolution
The app intelligently handles paths between development and production:
- Development: Uses relative paths from project root
- Production: Uses
process.resourcesPathfor bundled resources - Key function:
getResourcePath()in electron/main.js
Biometric Authentication
Platform-specific biometric support:
- macOS: TouchID via
node-ms-passport - Windows: Windows Hello via
win-hello - Implementation:
electron/biometric-auth.js
Build Configuration
- Next.js: Static export with
output: 'export'innext.config.mjs - Electron Builder: Configured in
electron-builder.yml - TypeScript: Strict mode enabled with path aliases (@/)
- Extra Resources: No longer includes gateway/host folders (integrated architecture)
State Management
- Lock Context: Security state management (
frontend/contexts/lock-context.tsx) - Service Status: Real-time MCP service monitoring
- Client Management: Backup/restore functionality with encryption
Adding New Features
To add a new MCP tool:
- Add tool definition to
availableToolsarray inelectron/mcp-service.js - Implement handler in
executeTool()method - Tool is automatically available via IPC
To add a new frontend page:
- Create component in appropriate route group under
frontend/app/ - Update navigation in
frontend/components/dashboard-sidebar.tsxif needed - Rebuild frontend:
cd frontend && npm run build
To modify IPC communication:
- Add handler in
electron/mcp-service.jsusingipcMain.handle() - Expose method in
electron/preload.jsviacontextBridge - Use in frontend via
window.electronAPI
Known Issues & Solutions
Port Conflicts
- Solution: Dynamic port allocation via
get-portlibrary - Test with:
./test-port-fix.sh
Build Issues on macOS
- Missing code signing: Use
./build-nosign.shor setCSC_IDENTITY_AUTO_DISCOVERY=false - Window not showing after build: Use
./build-production.sh(includes path fixes)
NPM Install Timeouts
- Use Chinese mirror:
--registry=https://registry.npmmirror.com - Or use automated script:
node install-deps.js
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

