by nuin
A high-performance, modern JavaScript implementation of the Alliance of Genome Resources MCP server with advanced natural language query capabilities and cross-entity search.
This server now features a sophisticated natural language processing engine that understands:
"breast cancer genes AND DNA repair NOT p53"
This JavaScript implementation offers significant improvements over the Python version:
Enhanced AGR MCP Server (JavaScript)
āāā High-Performance HTTP Client (Axios)
ā āāā Connection Pooling
ā āāā Request/Response Interceptors
ā āāā Automatic Retry Logic
ā
āāā Intelligent Caching Layer (NodeCache)
ā āāā Configurable TTL per endpoint
ā āāā Memory-efficient storage
ā āāā Automatic cleanup
ā
āāā Rate Limiting System
ā āāā Per-endpoint rate tracking
ā āāā Sliding window algorithm
ā āāā Automatic throttling
ā
āāā Enhanced Logging (Pino)
ā āāā Structured JSON output
ā āāā Pretty console formatting
ā āāā Performance tracking
ā
āāā Advanced Validation
āāā Gene ID format validation
āāā Sequence validation
āāā Input sanitization
# Install globally from npm npm install -g agr-mcp-server-enhanced # Start the server agr-mcp-server # Or use the natural language server agr-mcp-natural # Or start interactive chat agr-chat
# Clone the repository git clone https://github.com/nuin/agr-mcp-server-js.git cd agr-mcp-server-js # Install dependencies and validate setup npm run setup # Start the server npm start # Or start with development logging npm run dev
# Complete development setup npm run setup # Run with hot reload and debugging npm run dev # Run tests npm test # Run with coverage npm run test:coverage # Lint and format code npm run lint:fix npm run format
search_genes
- Advanced gene search with natural language supportget_gene_info
- Comprehensive gene informationget_gene_diseases
- Disease associations and modelssearch_diseases
- Disease search with filtered resultsget_gene_expression
- Expression data across tissuesfind_orthologs
- Cross-species orthology analysisblast_sequence
- BLAST search with auto-detectionget_species_list
- Supported model organismscomplex_search
- Natural language cross-entity search with relationshipsfaceted_search
- Multi-filter advanced search with aggregationsget_cache_stats
- Real-time performance metricsclear_cache
- Cache management (dev/testing)The Enhanced AGR MCP Server now supports advanced Boolean queries with natural language processing:
# Find DNA repair genes in breast cancer, excluding p53 npm run query complex "breast cancer genes in human AND DNA repair NOT p53" # Returns: 6,021 genes (XRCC3, XRCC1, RAD50, ERCC1, etc.)
# Find genes related to insulin OR glucose in mouse npm run query complex "insulin OR glucose in mouse" # Returns: 28 genes (Insl5, Igfbp7, Irs3, Ide, etc.)
# Find BRCA1 genes specifically in humans npm run query complex "BRCA1 in human" # Returns: 29 human-specific BRCA1-related genes
// Using complex_search tool with MCP { "tool": "complex_search", "arguments": { "query": "breast cancer genes in human AND DNA repair NOT p53", "limit": 5 } } // Species and process filtering { "tool": "search_genes", "arguments": { "query": "tumor suppressor genes in mouse involved in apoptosis", "limit": 10 } }
// Search across genes, diseases, and phenotypes simultaneously { "tool": "complex_search", "arguments": { "query": "insulin resistance genes and diabetes diseases in human", "limit": 10 } }
// Multi-dimensional filtering { "tool": "faceted_search", "arguments": { "genes": ["BRCA1", "BRCA2", "TP53"], "diseases": ["breast cancer", "ovarian cancer"], "processes": ["DNA repair", "apoptosis"], "species": "Homo sapiens", "chromosome": "17", "limit": 20 } }
"breast cancer genes in human AND DNA repair NOT p53"
- 6,021 results"insulin OR glucose in mouse"
- 28 results"BRCA1 in human"
- 29 results"kinase genes in mouse involved in signaling"
- Species + process filtering"tumor suppressor NOT p53 in zebrafish"
- Exclusion queries"transcription factors NOT zinc finger in fly"
ā
"diabetes genes on chromosome 11 in human"
ā
"tumor suppressor genes involved in apoptosis NOT p53"
ā
"insulin genes and diabetes diseases"
ā Returns genes + related diseases"BRCA1 orthologs and cancer associations"
ā Cross-species + disease links"DNA repair genes and associated phenotypes"
ā Genes + phenotype relationships{ "tool": "get_gene_info", "arguments": { "gene_id": "HGNC:1100" } }
{ "tool": "blast_sequence", "arguments": { "sequence": "ATCGATCGATCGATCG", "max_target_seqs": 20 } }
{ "tool": "get_cache_stats", "arguments": {} }
# Logging level export LOG_LEVEL=debug # Custom timeouts export API_TIMEOUT=30000 # Cache settings export CACHE_TTL=300 export CACHE_MAX_KEYS=1000
The server automatically configures itself with optimal settings:
# Build Docker image npm run docker:build # Run in container npm run docker:run # Or use docker-compose docker-compose up -d
Metric | Python Version | JavaScript Version | Improvement |
---|---|---|---|
Cold Start | ~800ms | ~450ms | 44% faster |
API Response | ~200ms | ~120ms | 40% faster |
Memory Usage | ~45MB | ~28MB | 38% less |
Cache Hit Rate | ~65% | ~89% | 37% better |
Error Recovery | Basic | Advanced | Exponential backoff |
Input Validation | Limited | Comprehensive | Type safety |
# Run comprehensive tests npm test # Run with coverage reporting npm run test:coverage # Performance benchmarking npm run benchmark # Code quality checks npm run lint npm run validate # Health check npm run health-check
# Install globally for easy setup npm install -g .
Then configure Claude Desktop:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%/Claude/claude_desktop_config.json
*Configuration content*
*Configuration content*
Replace <PROJECT_PATH>
with the absolute path to your cloned repository.
With the enhanced complex query system, Claude can now handle sophisticated genomic questions:
The server provides comprehensive monitoring:
// Real-time performance metrics { "cache": { "keys": 156, "hits": 1240, "misses": 180, "hitRate": "87.3%" }, "rateLimits": { "/search": [timestamps...], "/gene": [timestamps...] }, "uptime": 3600.5, "memoryUsage": "28.4MB" }
# Install PM2 npm install -g pm2 # Start with PM2 pm2 start src/agr-server-enhanced.js --name agr-mcp-server # Monitor processes pm2 monit # View logs pm2 logs agr-mcp-server
# Built-in health check npm run health-check # Custom monitoring script node scripts/monitor.js
/docs
npm run health-check
npm run benchmark
Enhanced JavaScript Implementation Complete
Ready for immediate deployment as a faster, more reliable alternative to the Python version!
No version information available
0 contributors