Gemini Thinking
STDIOGemini-powered MCP server for analytical thinking and sequential problem-solving
Gemini-powered MCP server for analytical thinking and sequential problem-solving
This is an implementation of the Model Context Protocol (MCP) that integrates with Google's Gemini API to provide analytical thinking capabilities without code generation.
The Gemini Thinking Server is a specialized MCP server that leverages Google's Gemini model to provide sequential thinking and problem-solving capabilities. It allows for:
# Clone the repository git clone <repository-url> # Install dependencies npm install # Build the project npm run build
Before running the server, you need to set up your Gemini API key:
export GEMINI_API_KEY=your_api_key_here
node dist/gemini-index.js
The geminithinking tool accepts the following parameters:
query (required): The question or problem to analyzecontext (optional): Additional context informationapproach (optional): Suggested approach to the problempreviousThoughts (optional): Array of previous thoughts for contextthought (optional): Your current thinking step (if empty, will be generated by Gemini)nextThoughtNeeded (required): Whether another thought step is neededthoughtNumber (required): Current thought numbertotalThoughts (required): Estimated total thoughts neededisRevision (optional): Whether this revises previous thinkingrevisesThought (optional): Which thought is being reconsideredbranchFromThought (optional): Branching point thought numberbranchId (optional): Branch identifierneedsMoreThoughts (optional): If more thoughts are neededThe tool also supports session management commands:
sessionCommand: Command to manage sessions ('save', 'load', 'getState')sessionPath: Path to save or load the session file (required for 'save' and 'load' 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 }
Here's an example of how to use the tool:
{ "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:
{ "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"] }
Several example clients are provided to demonstrate different use cases:
sample-client.js: Basic client exampleexample-usage.js: Specific usage examplecodebase-analysis-example.js: Example for codebase analysissession-example.js: Example demonstrating session persistenceadvanced-filtering-example.js: Example demonstrating advanced semantic filteringTo run the session example:
node dist/session-example.js
To run the advanced filtering example:
node dist/advanced-filtering-example.js
MIT