Uses ESLint for code quality and linting standards in the development workflow
Built on Node.js runtime (18+) for MCP server execution and TypeScript compilation
Uses npm package manager for dependency management and build scripts
Uses Prettier for consistent code formatting across the TypeScript codebase
Uses SQLite with FTS5 full-text search capabilities for persistent storage of scratchpads and workflows, with optional Chinese word segmentation through jieba tokenization extensions
Implemented in TypeScript with strict type safety and comprehensive validation for all MCP tool parameters
Uses Vitest testing framework for comprehensive test coverage including database, MCP tools, and performance testing
Scratchpad MCP v2
A Model Context Protocol (MCP) server that provides shared scratchpad functionality for Claude Code sub-agents, enabling seamless context sharing and collaboration within workflows.
🚀 TL;DR / Try it now
⚠️ Important: always use start-mcp.sh
Why the startup script matters:
- Correct path resolution and database path handling
- Cross-directory support (works from any working directory)
- Proper loading of optional Chinese tokenization extensions
🚀 Quick Start
Prerequisites
- Node.js 18.0.0 or newer
- SQLite (FTS5 handled automatically)
Installation
Running as MCP Server
Environment Configuration
🧰 Available MCP Tools
create-workflow
- Create workflow containerslist-workflows
- List all workflowsget-latest-active-workflow
- Get the most recently updated active workflowupdate-workflow-status
- Activate/deactivate a workflowcreate-scratchpad
- Create a scratchpad within a workflowget-scratchpad
- Retrieve a scratchpad by IDappend-scratchpad
- Append content to an existing scratchpadtail-scratchpad
- Tail content, or setfull_content=true
to get full contentchop-scratchpad
- Remove lines from the end of a scratchpad (reverse of tail)list-scratchpads
- List scratchpads in a workflowsearch-scratchpads
- Full-text search with context-aware snippets (grep-like functionality, intelligent Chinese tokenization)extract-workflow-info
- Extract specific information from workflows using OpenAI models
🔗 Claude Code Integration
Prerequisites
- Node.js 18.0.0 or newer
- Claude Code CLI installed and configured
- Project built:
npm run build
⚠️ Critical configuration
Always use an absolute path to start-mcp.sh
to ensure correct path resolution and cross-directory compatibility.
Method 1: CLI installation (recommended)
Method 2: Manual configuration
Project-level .mcp.json
(recommended)
Global ~/.claude.json
❌ Invalid configuration examples (do not use)
Cross-project usage
Verification
Troubleshooting
- Server does not start: verify Node 18+, run
npm run build
, ensurestart-mcp.sh
is executable, use absolute path in MCP config - Chinese search returns no results: most likely running
dist/server.js
directly — switch tostart-mcp.sh
- Message "Simple 擴展載入失敗": normal when extensions are not installed; system falls back to FTS5/LIKE
- Tools not available: run
claude mcp list
, reload configuration, verify startup script path
Best practices
- Always use
start-mcp.sh
- Prefer absolute paths
- Verify Chinese tokenizer loading messages
- Commit a project-level
.mcp.json
for teams
🌐 Workflow Web Viewer
A standalone HTTP server to browse scratchpad workflows via a web UI.
Quick Start
Database path configuration
Priority order:
Features
- 🔍 Search & filter: full-text search across workflows and scratchpads
- 🎨 Syntax highlighting: Prism.js with automatic dark/light theme
- 📱 Responsive UI with organization and pagination
- ⚡ Live updates
🇨🇳 Optional Chinese Text Enhancement
Optional feature to improve Chinese search accuracy (the system works fine without it via FTS5/LIKE fallback).
Installation
- Create an
extensions
directory
- Download the extension and dictionaries for your platform
macOS
Linux
- Create the required symlink for jieba dictionaries (use absolute path)
- Use the automated installation script (includes proper symlinks)
- Verify
Note: even without extensions installed, all search features work (fallback to FTS5/LIKE).
🛠️ MCP Tools API
Workflow Management
create-workflow
Create a new workflow container.
list-workflows
List all workflows.
get-latest-active-workflow
Get the most recently updated active workflow.
update-workflow-status
Activate or deactivate a workflow.
Scratchpad Operations
create-scratchpad
Create a scratchpad within a workflow.
get-scratchpad
Retrieve a specific scratchpad.
append-scratchpad
Append content to an existing scratchpad.
tail-scratchpad
Tail content, or return full content with full_content=true
.
Parameter priority: full_content
> tail_size
> default (50 lines)
chop-scratchpad
Remove lines from the end of a scratchpad. Does not return content after completion.
list-scratchpads
List scratchpads with pagination and content control.
Content control priority: include_content
> preview_mode
> max_content_chars
Search & Discovery
search-scratchpads
Full-text search with automatic Chinese tokenization and graceful fallbacks. Supports context-aware search similar to grep -A -B -C.
Search intelligence: automatic detection → jieba → simple → FTS5 → LIKE; target <100ms. Context search provides grep-like functionality with line-based snippets.
AI Analysis
extract-workflow-info
Extract specific information from workflows using OpenAI's GPT models.
Prerequisites: Requires OPENAI_API_KEY
environment variable.
Supported Models: gpt-5-nano, gpt-5-mini, gpt-4o, gpt-4o-mini and other OpenAI models. GPT-5 models support the reasoning_effort
parameter for enhanced analysis quality.
Returns: Structured analysis based on the extraction prompt, including the model used and number of scratchpads processed.
📋 Usage Examples (more)
Basic Workflow
Integration with Claude Code (highlights)
- Multi-agent collaboration via workflows
- Context persistence across conversations
- Intelligent search for both Chinese and English content
- Project organization through workflows and project scopes
- Cross-directory support via the startup script
💻 Development Guide
Available Scripts
Project Structure
Testing Strategy
- Database layer: CRUD, FTS5, error and edge cases, Chinese tokenization
- MCP tools integration: 12 tools parameter validation, scenarios, protocol compliance
- Performance: FTS5 <100ms, 1MB content, concurrent access, tokenization performance
- Project scope: workflow isolation, cross-project restrictions
Code Quality Standards
- TypeScript strict mode (no
any
) - ESLint + Prettier
95% test coverage
- Targets: <100ms search, 1MB content
- Path resolution via the startup script
🔧 Advanced Configuration
Startup Script Features
Benefits: stable working directory, proper extension/dictionary loading, DB path setup, cross-directory support.
FTS5 Configuration
- Disabled automatically in test environments
- Tokenizer selection: simple/jieba/standard
- Fallback strategy: jieba → simple → FTS5 → LIKE
- Indexed fields: title and content (with triggers)
- Ranking: BM25
Database Optimization
- WAL mode, prepared statements, single connection with proper cleanup, smart tokenization
📊 Technical Specifications
Architecture
- Server: MCP over stdio
- Tools: 12 core tools with comprehensive parameter validation
- Database: SQLite with FTS5 full-text search, WAL mode, optional Chinese tokenization
- Extension layer: optional Chinese word segmentation with cross-directory support
Performance Characteristics
Metric | Target | Implementation |
---|---|---|
Search Response | <100ms | FTS5 indexing with prepared statements |
Chinese Search | <150ms | Jieba tokenization with fallback strategy |
Content Limit | 1MB per scratchpad | Validated at tool level |
Workflow Capacity | 50 scratchpads | Enforced by database constraints |
Concurrent Access | Thread-safe | SQLite WAL mode |
Cross-Directory | ✅ Supported | Via startup script path resolution |
Data Model
Environment Requirements
- Node.js 18+
- SQLite with FTS5
- Memory ~50MB
- Storage varies (1MB per scratchpad limit)
- Optional extensions: libsimple.dylib/.so for Chinese support
Dependencies
- Core:
@modelcontextprotocol/sdk
,better-sqlite3
- Dev:
typescript
,tsup
,vitest
,eslint
,prettier
🤝 Contributing
- Fork the repository
- Create a branch:
git checkout -b feature/amazing-feature
- Install deps:
npm install
- Build:
npm run build
- Test startup script:
./start-mcp.sh
- Make changes and add tests
- Run tests:
npm test
- Quality checks:
npm run typecheck && npm run lint
- Commit:
git commit -m 'feat: add amazing feature'
- Push:
git push origin feature/amazing-feature
- Open a PR
Development Standards
- New features must include tests; maintain >95% coverage
- Follow TypeScript strict mode
- Conventional Commits
- Update docs for API changes
- Use
start-mcp.sh
for manual testing
📄 License
MIT License (see LICENSE
)
📞 Support
- Issues: GitHub Issues for bug reports and feature requests
- Documentation: inline code docs and tests
- Performance: FTS5 target <100ms
- Chinese support: ensure tokenizer is loaded via the startup script
Remember: always use ./start-mcp.sh
to launch the MCP server. Running dist/server.js
directly causes path resolution and cross-directory compatibility issues.
This server cannot be installed
local-only server
The server can only run on the client's local machine because it depends on local resources.
Enables shared scratchpad functionality for Claude Code sub-agents with full-text search, workflow organization, and intelligent Chinese text tokenization. Supports seamless context sharing and collaboration across workflows with project scope isolation.
Related MCP Servers
- -securityAlicense-qualityFacilitates integration with the Cursor code editor by enabling real-time code indexing, analysis, and bi-directional communication with Claude, supporting concurrent sessions and automatic reconnection.Last updated -438MIT License
- -securityFlicense-qualityAllows Claude Code to offload AI coding tasks to Aider, reducing costs and enabling more control over which models handle specific coding tasks.Last updated -281
- -securityAlicense-qualityEnables multiple Claude Code instances to collaborate in real-time through channels, allowing AI agents to work together on projects without requiring local setup beyond Docker.Last updated -2MIT License
- -securityAlicense-qualityEnables Claude Code and other MCP-compatible tools to leverage MeshAI's multi-agent orchestration capabilities for code review, refactoring, debugging, documentation, architecture analysis, and feature development. Automatically selects appropriate AI agents based on task content and works with agents built on LangChain, CrewAI, AutoGen, and other frameworks.Last updated -MIT License