谷歌研究
STDIO提供谷歌搜索和网络研究功能的MCP服务器
提供谷歌搜索和网络研究功能的MCP服务器
A powerful Model Context Protocol (MCP) server that provides AI assistants with advanced web research capabilities, including Google search integration, intelligent content extraction, and multi-source synthesis.
The Google Research MCP Server now provides both search and research capabilities in a single unified server - no need to run separate instances!
Clone and Install
git clone https://github.com/your-org/google-research-mcp-server.git cd google-research-mcp-server npm install
Configure Environment
cp .env.example .env # Edit .env file with your Google API credentials nano .env # or use your preferred editor
Validate Configuration
npm run validate-config
Build and Start
npm run build npm start
Verify Server is Running
npm run health-check
# 1. Clone repository git clone https://github.com/your-org/google-research-mcp-server.git cd google-research-mcp-server # 2. Configure environment cp .env.example .env # Edit .env with your API keys # 3. Deploy with Docker docker-compose up -d # 4. Verify deployment docker-compose logs -f google-research-mcp npm run docker:health
For development with auto-rebuild:
# Terminal 1: Watch for changes and rebuild npm run dev # Terminal 2: Start server (after initial build) npm start
# Google API Configuration (Required) GOOGLE_API_KEY=your_google_api_key_here GOOGLE_SEARCH_ENGINE_ID=your_search_engine_id_here # Server Configuration (Optional) NODE_ENV=production LOG_LEVEL=info
# Performance Tuning SEARCH_CACHE_TTL_MINUTES=5 # Search result cache duration CONTENT_CACHE_TTL_MINUTES=30 # Content extraction cache duration MAX_CACHE_ENTRIES=100 # Maximum cache entries # Request Limits REQUEST_TIMEOUT_MS=30000 # Request timeout MAX_CONTENT_SIZE_MB=50 # Maximum content size CONCURRENT_REQUEST_LIMIT=10 # Concurrent request limit # Rate Limiting RATE_LIMIT_WINDOW_MS=60000 # Rate limit window RATE_LIMIT_MAX_REQUESTS=100 # Max requests per window
npm run validate-config
The server provides unified search and research capabilities in a single MCP server. Add to your MCP client configuration (e.g., Claude Desktop):
{ "mcpServers": { "google-research": { "command": "node", "args": ["path/to/google-research-mcp-server/dist/server.js"], "env": { "GOOGLE_API_KEY": "your_api_key", "GOOGLE_SEARCH_ENGINE_ID": "your_search_engine_id" } } } }
Alternative Configuration (with environment file):
{ "mcpServers": { "google-research": { "command": "npm", "args": ["start"], "cwd": "path/to/google-research-mcp-server" } } }
Note: This assumes you have a .env file configured in the project directory.
google_search - Search Google with advanced filtering options
Query: "climate change effects"
Options: site filter, date restrictions, language, result type
extract_webpage_content - Extract clean content from web pagesextract_multiple_webpages - Batch extract from multiple URLsstructured_content_extraction - Enhanced extraction with structure preservationsummarize_webpage - Generate webpage summariesresearch_topic - Comprehensive topic research with multiple sourcessynthesize_content - Combine multiple sources into coherent reportsenhanced_synthesis - Advanced synthesis with contradiction detectioncontextual_navigation - Smart web browsing following relevant links1. Search: google_search("renewable energy trends 2024")
2. Extract: extract_webpage_content(top_result_url)
3. Analyze: Multiple sources for comprehensive view
1. Research: research_topic("artificial intelligence in healthcare")
2. Synthesis: enhanced_synthesis(multiple_sources)
3. Export: Formatted report with citations
1. Search: Multiple queries for competitor information
2. Navigate: contextual_navigation(competitor_websites)
3. Synthesize: Compare and contrast findings
Error: Missing required environment variables: GOOGLE_API_KEY
Solution:
.env filenpm run validate-configError: Rate limit exceeded for search requests
Solution:
Error: Failed to extract content from webpage
Solution:
Warning: Memory usage high: 85%
Solution:
Container health check failing
Solution:
docker-compose logs -f google-research-mcpnpm run docker:healthError: Cannot find module 'dist/server.js'
Solution:
npm run builddist/ directory exists and contains compiled filesnpx tsc --noEmitrm -rf dist/ && npm run buildError: EACCES permission denied
Solution:
ls -la dist/server.jschmod +x dist/server.jsnode dist/server.js# Enable detailed logging (Non-Docker) export LOG_LEVEL=debug npm start # Enable detailed logging (Docker) docker-compose exec google-research-mcp sh -c "LOG_LEVEL=debug npm start" # Check system health npm run health-check # Monitor performance (Docker) docker-compose exec google-research-mcp npm run health-check
For production deployment without Docker:
# Install PM2 globally npm install -g pm2 # Start with PM2 pm2 start dist/server.js --name "google-research-mcp" # Monitor pm2 status pm2 logs google-research-mcp # Auto-restart on system reboot pm2 startup pm2 save
Create /etc/systemd/system/google-research-mcp.service:
[Unit] Description=Google Research MCP Server After=network.target [Service] Type=simple User=your-user WorkingDirectory=/path/to/google-research-mcp-server ExecStart=/usr/bin/node dist/server.js Restart=always RestartSec=10 Environment=NODE_ENV=production EnvironmentFile=/path/to/google-research-mcp-server/.env [Install] WantedBy=multi-user.target
Then:
sudo systemctl enable google-research-mcp sudo systemctl start google-research-mcp sudo systemctl status google-research-mcp
# Simple start npm start # With specific environment NODE_ENV=production LOG_LEVEL=info npm start # Background process nohup npm start > server.log 2>&1 &
# For high-volume usage SEARCH_CACHE_TTL_MINUTES=10 CONTENT_CACHE_TTL_MINUTES=60 MAX_CACHE_ENTRIES=200 # For memory-constrained environments SEARCH_CACHE_TTL_MINUTES=2 CONTENT_CACHE_TTL_MINUTES=15 MAX_CACHE_ENTRIES=50
# For faster responses REQUEST_TIMEOUT_MS=15000 MAX_CONTENT_SIZE_MB=25 CONCURRENT_REQUEST_LIMIT=5 # For comprehensive extraction REQUEST_TIMEOUT_MS=60000 MAX_CONTENT_SIZE_MB=100 CONCURRENT_REQUEST_LIMIT=15
# Check overall system health npm run health-check # Monitor with Docker docker-compose exec google-research-mcp npm run health-check
{ "status": "healthy", "timestamp": "2024-01-15T10:30:00Z", "environment": "production", "uptime": 3600000, "checks": { "googleSearch": { "status": "pass", "responseTime": 245 }, "contentExtraction": { "status": "pass", "responseTime": 567 }, "memory": { "status": "pass", "percentage": 45.2 } } }
/metrics (if enabled)# Update dependencies npm audit npm update # Security audit npm run audit:security # Dependency analysis npm run audit:dependencies # Container updates docker-compose pull docker-compose up -d
# View logs docker-compose logs -f google-research-mcp # Log rotation (configure in docker-compose.yml) docker-compose exec google-research-mcp logrotate -f /etc/logrotate.conf
# Install dependencies npm install # Start in development mode npm run dev # Build for production npm run build
src/
├── config/          # Configuration management
├── handlers/        # Tool request handlers
├── services/        # Core service implementations
├── tools/           # Tool definitions and schemas
├── types/           # TypeScript type definitions
├── utils/           # Utility functions
└── server.ts        # Main server entry point
This project is licensed under the MIT License - see the LICENSE file for details.
PRODUCTION_DEPLOYMENT.md for detailed deployment guideBuilt with ❤️ for AI-powered research workflows