| name | ask-expert-consult-mcp-wisdom-cascade |
| description | AI-powered expert consultation MCP server for Claude Desktop and Cursor that connects developers to enriched guidance through OpenRouter models |
| triggers | ["consult an expert about this code problem","ask for expert guidance on this architecture","get wisdom cascade consultation for this issue","connect to OpenRouter expert agent for help","query the expert consultation MCP server","use ask-expert to analyze this code","get AI mentor feedback through wisdom cascade","request expert consult via MCP"] |
ask-expert-consult-mcp
Skill by ara.so — MCP Skills collection.
An MCP (Model Context Protocol) server that provides AI-powered expert consultation capabilities through OpenRouter's model routing. This server enables Claude Desktop, Cursor, and other MCP-compatible AI agents to request structured expert guidance, code reviews, and architectural advice by leveraging multiple AI models through a unified interface.
What It Does
The ask-expert-consult-mcp server acts as a bridge between your coding environment and OpenRouter's AI model ecosystem. It provides:
- Expert consultation requests with automatic domain categorization
- Multi-model AI routing for specialized guidance (frontend, backend, DevOps, etc.)
- Context enrichment that appends relevant documentation and patterns
- Structured response formats including code diffs, walkthroughs, and architecture suggestions
- Knowledge persistence through a local wisdom cache
- Multilingual query support with automatic language detection
Installation
Prerequisites
- Node.js 18+ or Python 3.10+
- OpenRouter API key (get one here)
- Claude Desktop or Cursor IDE with MCP support
Setup for Claude Desktop
- Clone and install the server:
git clone https://github.com/pakgik01/ask-expert-consult-mcp.git
cd ask-expert-consult-mcp
npm install
pip install -r requirements.txt
- Configure environment variables:
Create a .env file in the project root:
OPENROUTER_API_KEY=your_openrouter_api_key_here
WISDOM_DB_PATH=./wisdom_cache.db
DEFAULT_MODEL=anthropic/claude-3.5-sonnet
CONFIDENCE_THRESHOLD=0.75
- Add to Claude Desktop config:
Edit ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%/Claude/claude_desktop_config.json (Windows):
{
"mcpServers": {
"ask-expert-consult": {
"command": "node",
"args": ["/absolute/path/to/ask-expert-consult-mcp/src/index.js"],
"env": {
"OPENROUTER_API_KEY": "your_openrouter_api_key_here"
}
}
}
}
For Python implementation:
{
"mcpServers": {
"ask-expert-consult": {
"command": "python",
"args": ["/absolute/path/to/ask-expert-consult-mcp/src/server.py"],
"env": {
"OPENROUTER_API_KEY": "your_openrouter_api_key_here"
}
}
}
}
- Restart Claude Desktop to load the MCP server.
Setup for Cursor IDE
Add to your Cursor MCP settings (.cursor/mcp.json):
{
"mcpServers": {
"ask-expert-consult": {
"command": "node",
"args": ["/absolute/path/to/ask-expert-consult-mcp/src/index.js"],
"env": {
"OPENROUTER_API_KEY": "${OPENROUTER_API_KEY}"
}
}
}
}
Core MCP Tools
The server exposes the following MCP tools that AI agents can invoke:
1. ask_expert
Request expert guidance on a coding problem or architectural decision.
Parameters:
question (string, required): The query or problem description
code_snippet (string, optional): Relevant code context
domain (string, optional): Specific domain (frontend, backend, devops, database, security)
language (string, optional): Programming language or framework
difficulty (string, optional): junior, intermediate, senior
Example invocation:
const response = await callTool("ask_expert", {
question: "How do I prevent race conditions in this async function?",
code_snippet: `
async function updateUserBalance(userId, amount) {
const user = await db.users.findById(userId);
user.balance += amount;
await user.save();
}
`,
domain: "backend",
language: "javascript",
difficulty: "intermediate"
});
Response structure:
{
"guidance": "Detailed step-by-step solution...",
"code_diff": "Suggested code changes with before/after...",
"alternatives": ["Alternative approach 1", "Alternative approach 2"],
"confidence_score": 0.92,
"related_patterns": ["Transaction pattern", "Optimistic locking"],
"wisdom_id": "wsd_a7b3c9d2"
}
2. search_wisdom
Search previously answered questions in the local knowledge cache.
Parameters:
query (string, required): Search terms
domain (string, optional): Filter by domain
limit (number, optional): Maximum results (default: 5)
Example:
const cached = await callTool("search_wisdom", {
query: "race condition async javascript",
domain: "backend",
limit: 3
});
3. enrich_context
Enhance a code question with relevant documentation and patterns before asking.
Parameters:
code_snippet (string, required): Code to analyze
language (string, required): Programming language
include_docs (boolean, optional): Append official documentation excerpts
Example:
const enriched = await callTool("enrich_context", {
code_snippet: "const result = await fetch(url).then(r => r.json());",
language: "javascript",
include_docs: true
});
Usage Patterns
Pattern 1: Quick Code Review
When a user asks for code feedback:
const context = await callTool("enrich_context", {
code_snippet: userProvidedCode,
language: "javascript",
include_docs: false
});
const review = await callTool("ask_expert", {
question: "Please review this React component for best practices and potential issues",
code_snippet: context.enriched_code,
domain: "frontend",
language: "react"
});
Pattern 2: Architecture Consultation
For high-level design questions:
const cached = await callTool("search_wisdom", {
query: "microservices API gateway architecture",
domain: "backend"
});
if (cached.results.length > 0) {
} else {
const guidance = await callTool("ask_expert", {
question: "How should I structure a microservices API gateway for a Node.js backend?",
domain: "backend",
language: "nodejs",
difficulty: "senior"
});
}
Pattern 3: Multi-Domain Consultation
For complex questions spanning multiple domains:
const frontendAdvice = await callTool("ask_expert", {
question: "Optimize this React component rendering",
code_snippet: reactCode,
domain: "frontend"
});
const backendAdvice = await callTool("ask_expert", {
question: "Optimize this database query",
code_snippet: sqlQuery,
domain: "database"
});
Configuration Options
Environment Variables
OPENROUTER_API_KEY=sk-or-v1-...
DEFAULT_MODEL=anthropic/claude-3.5-sonnet
FRONTEND_MODEL=anthropic/claude-3-opus
BACKEND_MODEL=openai/gpt-4-turbo
DATABASE_MODEL=anthropic/claude-3.5-sonnet
CONFIDENCE_THRESHOLD=0.75
WISDOM_DB_PATH=./wisdom_cache.db
MAX_CONTEXT_LENGTH=8000
CACHE_TTL_DAYS=90
AUTO_TRANSLATE=true
ANONYMIZE_AFTER_DAYS=90
RETAIN_RAW_RESPONSES=false
Model Routing Configuration
Create a wisdom.config.json for advanced model routing:
{
"domainModels": {
"frontend": "anthropic/claude-3-opus",
"backend": "openai/gpt-4-turbo",
"devops": "anthropic/claude-3.5-sonnet",
"database": "anthropic/claude-3.5-sonnet",
"security": "openai/gpt-4-turbo",
"general": "anthropic/claude-3.5-sonnet"
},
"fallbackModel": "anthropic/claude-3-haiku",
"maxRetries": 2,
"timeout": 30000
}
Real-World Examples
Example 1: Debugging Async Issue
const response = await callTool("ask_expert", {
question: "This async function returns undefined instead of waiting for the promise",
code_snippet: `
function getData() {
return fetch('/api/data')
.then(res => res.json());
}
async function processData() {
const data = getData(); // Missing await!
console.log(data); // Logs Promise, not data
}
`,
domain: "backend",
language: "javascript",
difficulty: "junior"
});
Example 2: Security Review
const response = await callTool("ask_expert", {
question: "Review this authentication implementation for security vulnerabilities",
code_snippet: `
app.post('/login', (req, res) => {
const { username, password } = req.body;
const user = db.query('SELECT * FROM users WHERE username = ? AND password = ?',
[username, password]);
if (user) {
req.session.userId = user.id;
res.json({ success: true });
}
});
`,
domain: "security",
language: "javascript",
difficulty: "intermediate"
});
Example 3: Performance Optimization
const response = await callTool("ask_expert", {
question: "This query is slow on large datasets. How can I optimize it?",
code_snippet: `
SELECT u.*, p.*, c.*
FROM users u
LEFT JOIN posts p ON u.id = p.user_id
LEFT JOIN comments c ON p.id = c.post_id
WHERE u.created_at > '2024-01-01'
ORDER BY u.created_at DESC;
`,
domain: "database",
language: "sql",
difficulty: "intermediate"
});
Troubleshooting
Server Not Appearing in Claude Desktop
- Check config path: Ensure absolute paths in
claude_desktop_config.json
- Verify API key: Test key at https://openrouter.ai/
- Check logs:
tail -f ~/Library/Logs/Claude/mcp*.log
- Restart Claude: Completely quit and reopen
"Model not found" Errors
Low Confidence Scores
If responses frequently have low confidence (<0.75):
- Provide more code context in
code_snippet
- Specify the
domain explicitly
- Enrich context first with
enrich_context tool
- Lower
CONFIDENCE_THRESHOLD in config (not recommended)
Slow Response Times
- Reduce
MAX_CONTEXT_LENGTH to decrease token processing
- Use faster models for non-critical queries:
claude-3-haiku, gpt-3.5-turbo
- Check OpenRouter status: https://status.openrouter.ai/
Cache Not Persisting
- Verify
WISDOM_DB_PATH is writable
- Check disk space for SQLite database
- Ensure server process has file permissions
Advanced Usage
Custom Model Selection Per Query
Override the default model for specific queries:
const response = await callTool("ask_expert", {
question: "Explain quantum computing algorithms",
domain: "general",
model: "openai/gpt-4-turbo-preview"
});
Batch Wisdom Search
Search multiple domains simultaneously:
const domains = ["frontend", "backend", "database"];
const results = await Promise.all(
domains.map(domain =>
callTool("search_wisdom", {
query: "authentication best practices",
domain: domain,
limit: 2
})
)
);
Export Wisdom Cache
To backup or share your accumulated wisdom:
sqlite3 wisdom_cache.db .dump > wisdom_backup.sql
node scripts/export-wisdom.js --format json --output wisdom.json
Integration with Other MCPs
Combine with complementary MCP servers:
{
"mcpServers": {
"ask-expert-consult": { },
"filesystem": { },
"web-search": { }
}
}
Then chain tools:
const codeFile = await callTool("read_file", { path: "src/app.js" });
const docs = await callTool("web_search", { query: "express.js best practices" });
const advice = await callTool("ask_expert", {
question: "Review this Express.js app",
code_snippet: codeFile.content,
domain: "backend"
});
Resources