An MCP (Model Context Protocol) server that enables sending prompts to Gemini 2.5 Pro with embedded file contents. This tool helps get second opinions or detailed code reviews by leveraging Gemini's large context window, allowing you to include entire folders of code for analysis while continuing to use other LLMs as your primary development tools.
# Clone the repository
git clone https://github.com/your-username/mcp-sage.git
cd mcp-sage
# Install dependencies
npm install
# Build the project
npm run build
Set the following environment variable:
GEMINI_API_KEY=your_api_key_here
After building the project, start the MCP server:
GEMINI_API_KEY=XXX node /path/to/this/repo/dist/index.js
The server provides two main tools:
This tool helps you get a second opinion from Gemini on your code or other content.
Parameters:
prompt
(string, required): The prompt to send to Geminipaths
(array of strings, required): List of file paths to include as contextExample JSON-RPC call:
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "second-opinion",
"arguments": {
"prompt": "Explain how this code works",
"paths": ["path/to/file1.js", "path/to/file2.js"]
}
}
}
This tool provides detailed code review with specific change suggestions formatted as SEARCH/REPLACE blocks.
Parameters:
instruction
(string, required): The specific changes or improvements neededpaths
(array of strings, required): List of file paths to include as contextExample JSON-RPC call:
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "expert-review",
"arguments": {
"instruction": "Add error handling to the function",
"paths": ["path/to/file1.js", "path/to/file2.js"]
}
}
}
Example response format:
<<<<<<< SEARCH
function getData() {
return fetch('/api/data')
.then(res => res.json());
}
=======
function getData() {
return fetch('/api/data')
.then(res => {
if (!res.ok) {
throw new Error(`HTTP error! Status: ${res.status}`);
}
return res.json();
})
.catch(error => {
console.error('Error fetching data:', error);
throw error;
});
}
>>>>>>> REPLACE
Test the functionality with the provided test scripts:
# Test the second-opinion tool
GEMINI_API_KEY=your_api_key_here node test/run-test.js
# Test the expert-review tool
GEMINI_API_KEY=your_api_key_here node test/test-expert.js
The server provides detailed monitoring information via MCP logging, including:
Example log entries:
To add this MCP server to Claude Code, run this command in your terminal:
claude mcp add-json "mcp-sage" '{"command":"node","args":["/path/to/this/repo/dist/index.js"]}'
See the official Claude Code MCP documentation for more details.
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 > Tools & Integrations and click "New MCP Server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"mcp-sage": {
"command": "node",
"args": [
"/path/to/this/repo/dist/index.js"
]
}
}
}
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 explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.config/Claude/claude_desktop_config.json
2. Add this to your configuration file:
{
"mcpServers": {
"mcp-sage": {
"command": "node",
"args": [
"/path/to/this/repo/dist/index.js"
]
}
}
}
3. Restart Claude Desktop for the changes to take effect