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
Markdown
# Memberstack AI Context
[](https://www.npmjs.com/package/memberstack-ai-context)
[](LICENSE)
[](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