MCP Documentation Server Usage Guide
December 4, 2024 ยท View on GitHub
MCP Functions
The server provides the following MCP functions:
search_documentation
interface SearchParams {
query: string; // Required: Search query
framework?: string; // Optional: Framework name
version?: string; // Optional: Framework version
}
Example:
{
"query": "React hooks guide",
"framework": "react",
"version": "18"
}
analyze_code
interface CodeAnalysisParams {
code: string; // Required: Code to analyze
language: string; // Required: Programming language
framework?: string; // Optional: Framework name
}
Example:
{
"code": "function test() { ... }",
"language": "javascript",
"framework": "react"
}
get_status
No parameters required. Returns server status and metrics.
get_system_metrics
No parameters required. Returns detailed system metrics.
Rate Limiting
- Search: 100 requests per minute
- Analysis: 100 requests per minute
Caching
- Search results: 1 hour
- Analysis results: 24 hours
Using with Claude Desktop
- Configure Claude Desktop:
{
"mcpServers": {
"documentation": {
"command": "npx",
"args": ["-y", "mcp-documentation-server"],
"env": {
"BRAVE_API_KEY": "<YOUR_API_KEY>"
}
}
}
}
- Example prompts:
Claude, search documentation for React hooks best practices
Claude, analyze this code for performance issues:
function slowFunction() { ... }
Monitoring
Check server status:
curl http://localhost:3000/status
Get system metrics:
curl http://localhost:3000/metrics
Error Handling
The server returns standardized error responses:
{
"success": false,
"error": {
"code": "ERROR_CODE",
"message": "Error description"
}
}
Common error codes:
- VALIDATION_ERROR: Invalid parameters
- RATE_LIMIT_EXCEEDED: Too many requests
- SEARCH_ERROR: Error during search
- ANALYSIS_ERROR: Error during code analysis
Environment Variables
BRAVE_API_KEY: Required. Your Brave Search API keyPORT: Optional. Server port (default: 3000)UPDATE_INTERVAL: Optional. Update interval in ms (default: 3600000)CACHE_DURATION: Optional. Cache duration in ms (default: 86400000)DEBUG: Optional. Enable debug mode (default: false)LOG_LEVEL: Optional. Logging level (default: info)
Development
- Clone and install:
git clone https://github.com/yourusername/mcp-documentation-server.git
cd mcp-documentation-server
npm install
- Run tests:
npm test
- Start development server:
npm run dev
- Build for production:
npm run build
npm start