This MCP server implementation provides a powerful AI-powered research assistant that leverages Gemini LLMs and web scraping to conduct deep, iterative research on any topic. The server integrates with the Model Context Protocol for seamless incorporation into AI agent ecosystems.
Before setting up the MCP server, ensure you have:
Clone the repository:
git clone [your-repo-link-here]
Install dependencies:
npm install
Configure environment variables:
Create a .env.local
file in the project root with your API keys:
GEMINI_API_KEY="your_gemini_key"
FIRECRAWL_KEY="your_firecrawl_key"
# Optional: For self-hosted Firecrawl
# FIRECRAWL_BASE_URL=http://localhost:3002
Build the project:
npm run build
To launch the MCP server, run:
node --env-file .env.local dist/mcp-server.js
You can invoke the deep-research
tool from any MCP-compatible agent with these parameters:
query
(string, required): Your research questiondepth
(number, optional, 1-5): How deep the research should go (default: moderate)breadth
(number, optional, 1-5): How wide the research should be (default: moderate)existingLearnings
(string[], optional): Previous findings to guide researchconst mcp = new ModelContextProtocolClient(); // Assuming MCP client is initialized
async function invokeDeepResearchTool() {
try {
const result = await mcp.invoke("deep-research", {
query: "Explain the principles of blockchain technology",
depth: 2,
breadth: 4
});
if (result.isError) {
console.error("MCP Tool Error:", result.content[0].text);
} else {
console.log("Research Report:\n", result.content[0].text);
console.log("Sources:\n", result.metadata.sources);
}
} catch (error) {
console.error("MCP Invoke Error:", error);
}
}
invokeDeepResearchTool();
For standalone usage without MCP integration:
npm run start "your research query"
Example:
npm run start "what are latest developments in ai research agents"
For interactive testing and debugging:
npx @modelcontextprotocol/inspector node --env-file .env.local dist/mcp-server.js
The deep-research tool follows an iterative process:
The system incorporates robust validation:
The latest version includes significant improvements:
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"cursor-rules-mcp": {
"command": "npx",
"args": [
"-y",
"cursor-rules-mcp"
]
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.