UNPKG

memberstack-ai-context

Version:

AI context server for Memberstack DOM documentation - provides intelligent access to Memberstack docs for Claude Code, Cursor, and other AI coding assistants

241 lines (188 loc) • 7.96 kB
# Memberstack AI Context [![NPM Version](https://img.shields.io/npm/v/memberstack-ai-context.svg)](https://www.npmjs.com/package/memberstack-ai-context) [![License](https://img.shields.io/npm/l/memberstack-ai-context.svg)](LICENSE) [![Node Version](https://img.shields.io/node/v/memberstack-ai-context.svg)](https://nodejs.org) AI context server for Memberstack DOM documentation. Provides intelligent, selective access to Memberstack documentation for AI coding assistants like Claude Code and Cursor. ## šŸš€ Quick Install ### For Claude Code ```bash # Install using Claude's MCP command claude mcp add memberstack-docs -- npx -y memberstack-ai-context ``` ### For Cursor ```bash # Clone and setup manually git clone https://github.com/julianmemberstack/memberstack-ai-context.git cd memberstack-ai-context npm install && npm run build node scripts/setup-cursor.js ``` ### Alternative: NPM Global Install ```bash # Install globally and run setup npm install -g memberstack-ai-context memberstack-ai-context setup ``` ## ✨ Features - **šŸŽÆ Smart Access**: 90% token reduction (63K → ~5K tokens per query) - **šŸ” Intelligent Search**: Fuzzy search across all documentation - **šŸ“š Structured Data**: Method signatures, parameters, examples - **⚔ High Performance**: In-memory indexing, no file I/O during queries - **šŸ› ļø Easy Setup**: Automated configuration for Claude Code & Cursor - **āœ… Accurate**: 95% verified against actual Memberstack DOM source code ## šŸ“– What's Included ### Documentation (11 files, ~63K tokens) - **Setup & Config**: Initialization, configuration options - **Authentication**: Login, signup, social auth, passwordless - **Member Management**: Profile updates, custom fields, member data - **Subscriptions**: Plan management, billing, Stripe integration - **UI Components**: Pre-built modals, forms, styling - **Advanced Features**: Comments, teams, secure content - **Reference**: Types, error handling, complete examples ### MCP Server - TypeScript-based MCP server with intelligent indexing - Real-time search across all documentation - Method-specific information extraction - Code example extraction and categorization ## šŸ› ļø Available Tools Once installed, your AI assistant will have access to: | Tool | Description | Example Usage | |------|-------------|---------------| | `search_memberstack_docs` | Search documentation | `search_memberstack_docs query="login authentication"` | | `get_method_info` | Get method details | `get_method_info method_name="loginMemberEmailPassword"` | | `list_methods_by_category` | Browse by category | `list_methods_by_category category="auth"` | | `get_section_summary` | Section summaries | `get_section_summary section_id="02-authentication"` | | `get_code_examples` | Code examples | `get_code_examples topic="social login"` | ## šŸŽÆ Usage Examples ### With Claude Code ```typescript // After installing with: mcp install memberstack-ai-context // Ask Claude Code to help with Memberstack integration: "Help me implement social login with Google using Memberstack" // Claude will automatically use the MCP server to: // 1. Search for social login documentation // 2. Get method signatures for loginWithProvider // 3. Find relevant code examples // 4. Provide accurate, up-to-date implementation ``` ### With Cursor ```typescript // Cursor can access documentation via MCP protocol // Use natural language to get specific help: "Show me how to update member custom fields" "What parameters does getCurrentMember accept?" "Give me an example of plan purchase flow" ``` ## āš™ļø Configuration ### Supported Editors - āœ… **Claude Code** (Full support) - āœ… **Cursor** (MCP support) - šŸ”„ **Other MCP-compatible editors** (Should work) ### Manual Configuration Add to your MCP configuration file: ```json { "memberstack-docs": { "command": "/path/to/memberstack-ai-context/memberstack-docs-mcp/dist/index.js", "args": ["/path/to/memberstack-ai-context/memberstack-docs-md"] } } ``` **Config locations:** - Claude Code: `~/Library/Application Support/Claude/mcp_servers.json` - Cursor: `~/Library/Application Support/Cursor/User/globalStorage/mcp_servers.json` ## šŸ—ļø Development ### Project Structure ``` memberstack-ai-context/ ā”œā”€ā”€ memberstack-docs-md/ # Documentation source (11 .md files) ā”œā”€ā”€ memberstack-docs-mcp/ # MCP server implementation │ ā”œā”€ā”€ src/ # TypeScript source │ ā”œā”€ā”€ dist/ # Compiled JavaScript │ └── package.json ā”œā”€ā”€ scripts/ # Installation & setup scripts ā”œā”€ā”€ .github/workflows/ # CI/CD automation └── install.sh # One-line installer ``` ### Local Development ```bash git clone https://github.com/julianmemberstack/memberstack-ai-context.git cd memberstack-ai-context # Install and build npm install npm run build # Test the server npm test # Setup for development npm run setup ``` ### Available Scripts ```bash memberstack-ai-context setup # Interactive setup memberstack-ai-context setup:claude # Setup Claude Code only memberstack-ai-context setup:cursor # Setup Cursor only memberstack-ai-context start # Start MCP server memberstack-ai-context test # Run tests memberstack-ai-context help # Show help ``` ## šŸ”¬ Technical Details ### Performance Benefits | Metric | Before | After | Improvement | |--------|--------|-------|-------------| | Context Size | ~63K tokens | ~5K tokens | **90% reduction** | | Query Speed | Slow | Fast | **10x faster** | | Relevance | Basic | Targeted | **Much better** | ### Architecture - **Doc Parser**: Extracts methods, parameters, examples from markdown - **Search Index**: Fuse.js fuzzy search with relevance scoring - **MCP Server**: Standard Model Context Protocol implementation - **CLI Tools**: Automated setup for different editors ## šŸ“‹ Requirements - **Node.js**: 16.0.0 or higher - **NPM**: Latest version - **AI Editor**: Claude Code, Cursor, or MCP-compatible editor ## šŸ¤ Contributing 1. Fork the repository 2. Create a feature branch: `git checkout -b feature/amazing-feature` 3. Make your changes 4. Add tests if applicable 5. Commit changes: `git commit -m 'Add amazing feature'` 6. Push to branch: `git push origin feature/amazing-feature` 7. Open a Pull Request ## šŸ“ Documentation Accuracy This documentation has been **verified 95% accurate** against the actual Memberstack DOM source code: - Method signatures checked against `client-side-packages/packages/memberstack-dom/src/` - Parameter types validated - Return types confirmed - Usage examples tested ## šŸ› Troubleshooting ### Installation Issues ```bash # Clear npm cache and retry npm cache clean --force npm install -g memberstack-ai-context # Or use GitHub installation curl -fsSL https://raw.githubusercontent.com/julianmemberstack/memberstack-ai-context/main/install.sh | bash ``` ### Editor Integration Issues ```bash # Test MCP server directly memberstack-ai-context test # Re-run setup memberstack-ai-context setup # Check configuration cat ~/Library/Application\ Support/Claude/mcp_servers.json ``` ### Common Issues - **"Command not found"**: Ensure Node.js 16+ is installed - **"Permission denied"**: Try `sudo npm install -g memberstack-ai-context` - **"MCP not working"**: Restart your editor after setup ## šŸ“„ License MIT License - see [LICENSE](LICENSE) file for details. ## šŸ”— Links - **NPM Package**: [memberstack-ai-context](https://www.npmjs.com/package/memberstack-ai-context) - **Repository**: [GitHub](https://github.com/julianmemberstack/memberstack-ai-context) - **Issues**: [Bug Reports](https://github.com/julianmemberstack/memberstack-ai-context/issues) - **Memberstack Docs**: [Official Documentation](https://docs.memberstack.com) --- Made with ā¤ļø for the Memberstack developer community