The Model Context Protocol (MCP) Gemini Thinking Server integrates with Google's Gemini API to provide analytical thinking capabilities. This specialized server breaks down complex problems into sequential steps, helps with planning and analysis, and adapts to problems where the full scope may not be initially clear.
Follow these steps to install and set up the Gemini Thinking Server:
# Clone the repository
git clone <repository-url>
# Install dependencies
npm install
# Build the project
npm run build
Before running the server, you need to configure your Gemini API key:
export GEMINI_API_KEY=your_api_key_here
Once configured, you can start the server with:
node dist/gemini-index.js
The geminithinking
tool accepts various parameters to control the thinking process:
Required parameters:
query
: The question or problem to analyzethoughtNumber
: Current thought step numbertotalThoughts
: Estimated total thoughts needednextThoughtNeeded
: Boolean indicating if another thought step is neededOptional parameters:
context
: Additional context informationapproach
: Suggested approach to the problempreviousThoughts
: Array of previous thoughts for contextthought
: Your current thinking step (if empty, will be generated by Gemini)isRevision
: Whether this revises previous thinkingrevisesThought
: Which thought is being reconsideredbranchFromThought
: Branching point thought numberbranchId
: Branch identifierneedsMoreThoughts
: If more thoughts are neededHere's a simple example request to analyze an urban transportation system:
{
"query": "How might we design a sustainable urban transportation system?",
"context": "The city has 500,000 residents and currently relies heavily on personal vehicles.",
"approach": "Consider environmental, economic, and social factors.",
"thoughtNumber": 1,
"totalThoughts": 5,
"nextThoughtNeeded": true
}
The server responds with a structured JSON object containing:
{
"thought": "The generated thought from Gemini",
"thoughtNumber": 1,
"totalThoughts": 5,
"nextThoughtNeeded": true,
"branches": [],
"thoughtHistoryLength": 1,
"metaComments": "Meta-commentary about the reasoning",
"confidenceLevel": 0.85,
"alternativePaths": ["Alternative approach 1", "Alternative approach 2"]
}
The server supports saving and resuming analysis sessions with these commands:
{
"sessionCommand": "save",
"sessionPath": "/path/to/save/session.json",
"query": "dummy",
"thoughtNumber": 1,
"totalThoughts": 1,
"nextThoughtNeeded": false
}
{
"sessionCommand": "load",
"sessionPath": "/path/to/load/session.json",
"query": "dummy",
"thoughtNumber": 1,
"totalThoughts": 1,
"nextThoughtNeeded": false
}
{
"sessionCommand": "getState",
"query": "dummy",
"thoughtNumber": 1,
"totalThoughts": 1,
"nextThoughtNeeded": false
}
The server includes several example clients that demonstrate different use cases:
# Run the session example
node dist/session-example.js
# Run the advanced filtering example
node dist/advanced-filtering-example.js
Other available examples include:
sample-client.js
)example-usage.js
)codebase-analysis-example.js
)To add this MCP server to Claude Code, run this command in your terminal:
claude mcp add-json "geminithinking" '{"command":"node","args":["dist/gemini-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": {
"geminithinking": {
"command": "node",
"args": [
"dist/gemini-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": {
"geminithinking": {
"command": "node",
"args": [
"dist/gemini-index.js"
]
}
}
}
3. Restart Claude Desktop for the changes to take effect