Skip to main content
Glama
usage.md4.24 kB
# RAG Context MCP Server Usage Examples ## Basic Usage ### Storing Context When you want to save important information for later retrieval: ```json // Store user preferences { "tool": "setContext", "arguments": { "key": "user_preferences", "content": "User prefers TypeScript over JavaScript, uses VS Code with dark theme, and likes detailed code comments", "metadata": { "category": "preferences", "type": "development" } } } // Store project configuration { "tool": "setContext", "arguments": { "key": "project_nextjs_config", "content": "Next.js 14 project with App Router, TypeScript, Tailwind CSS, and Prisma ORM. Database is PostgreSQL hosted on Supabase.", "metadata": { "project": "my-saas-app", "category": "configuration" } } } // Store code patterns { "tool": "setContext", "arguments": { "key": "api_error_handling", "content": "All API routes should use try-catch blocks, return consistent error format: { error: string, code: number }, and log errors to Sentry", "metadata": { "category": "patterns", "type": "backend" } } } ``` ### Retrieving Context When you need to recall stored information: ```json // Find user preferences { "tool": "getContext", "arguments": { "query": "What are the user's coding preferences?", "limit": 3 } } // Find project setup details { "tool": "getContext", "arguments": { "query": "Next.js project configuration database setup", "limit": 5, "threshold": 0.7 } } // Find coding patterns { "tool": "getContext", "arguments": { "query": "How should API errors be handled?", "limit": 2 } } ``` ## Advanced Usage ### Storing Complex Technical Information ```json { "tool": "setContext", "arguments": { "key": "auth_implementation", "content": "Authentication uses NextAuth.js with JWT strategy. Providers: Google OAuth, GitHub OAuth. Session stored in httpOnly cookies. Middleware protects /api/* and /dashboard/* routes. User roles: admin, user, guest.", "metadata": { "project": "my-saas-app", "category": "authentication", "version": "1.0", "lastUpdated": "2024-01-15" } } } ``` ### Semantic Search Examples The vector store enables powerful semantic search capabilities: ```json // This will find authentication-related memories even with different wording { "tool": "getContext", "arguments": { "query": "How do users log in to the application?", "limit": 3 } } // This will find related concepts { "tool": "getContext", "arguments": { "query": "security measures for API endpoints", "limit": 5, "threshold": 0.6 } } ``` ## Best Practices 1. **Use Descriptive Keys**: Make keys self-documenting - Good: `project_auth_jwt_setup` - Bad: `auth1` 2. **Include Rich Metadata**: Add context that helps with organization ```json "metadata": { "project": "project-name", "category": "architecture|preferences|patterns|decisions", "date": "2024-01-15", "version": "1.0", "tags": ["api", "security", "backend"] } ``` 3. **Update Rather Than Duplicate**: Use the same key to update information ```json // Initial storage { "key": "database_schema", "content": "Users table with id, email, name" } // Later update { "key": "database_schema", "content": "Users table with id, email, name, created_at, updated_at. Posts table with id, user_id, title, content" } ``` 4. **Query Naturally**: Write queries as you would ask a colleague - "What database are we using?" - "How is authentication implemented?" - "What are the API design patterns?" ## Integration Tips ### For Development Workflows Store information about: - Development environment setup - Build and deployment processes - Testing strategies - Code review guidelines - Team conventions ### For Project Documentation Store: - Architecture decisions - API documentation - Database schemas - Integration details - Performance optimizations ### For Personal Preferences Remember: - Coding style preferences - Tool configurations - Keyboard shortcuts - Workflow optimizations - Learning goals

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/notbnull/mcp-rag-context'

If you have feedback or need assistance with the MCP directory API, please join our Discord server