@hvantoan/gemini-mcp-assistant
v1.0.0
Published
MCP Server for Gemini file attachment functionality
Readme
Gemini Coding Assistant MCP Server (TypeScript Version)
This is a reference version rewritten in TypeScript based on the original mcp-gemini-assistant project (Python).
The original project was developed by Peter Krueck. You can connect with the author on LinkedIn.
Introduction
This MCP Server allows Claude Code (and other MCP Clients) to consult Gemini for complex coding problems with full code context and conversation persistence.
Key Features
- Session Management: Maintain conversation context across multiple queries.
- File Attachments: Read and include actual code files in conversations.
- Hybrid Context: Combine text-based
code_contextwith file attachments. - Follow-up Questions: Ask follow-up questions without resending code context.
- Automatic Processing: Files are processed and formatted automatically.
- Session Expiry: Automatic cleanup of inactive sessions after 1 hour.
- Latest Model: Uses Gemini 2.5 Pro (or the latest configured version).
Requirements
- Node.js (v18 or higher)
- pnpm or npm
- Gemini API Key (get it at Google AI Studio)
Installation
Option 1: Install via npm (Recommended)
You can use the package directly via npx or install it globally.
npm install -g @hvantoan/gemini-mcp-assistantOption 2: Install from Source
Clone the repository:
git clone <your-repo-url> cd mcp-gemini-assistantInstall dependencies:
npm install # or pnpm installBuild the project:
npm run build # or pnpm buildConfigure environment variables: Create a
.envfile in the root directory and add your API Key:GEMINI_API_KEY=your_api_key_here
Configuration Guide
1. Configuration for Claude Desktop / Claude Code
To use with Claude Desktop or Claude Code, add the configuration to your claude_desktop_config.json file.
- Windows:
%APPDATA%\Claude\claude_desktop_config.json - macOS:
~/Library/Application Support/Claude/claude_desktop_config.json
If using npx (Recommended):
{
"mcpServers": {
"gemini-assistant": {
"command": "npx",
"args": [
"-y",
"@hvantoan/gemini-mcp-assistant"
],
"env": {
"GEMINI_API_KEY": "your_api_key_here",
"GEMINI_MODEL": "gemini-2.5-pro"
}
}
}
}If installed from source:
{
"mcpServers": {
"gemini-assistant": {
"command": "node",
"args": [
"C:/path/to/mcp-gemini-assistant/build/index.js"
],
"env": {
"GEMINI_API_KEY": "your_api_key_here",
"GEMINI_MODEL": "gemini-2.5-pro"
}
}
}
}Note: Replace C:/path/to/mcp-gemini-assistant/ with the absolute path to your project directory.
2. Configuration for GitHub Copilot
If you are using GitHub Copilot in an environment that supports MCP (e.g., via extension or experimental features), provide the server information as follows:
Using npx:
- Command:
npx - Arguments:
-y @hvantoan/gemini-mcp-assistant - Environment Variables:
GEMINI_API_KEY=[Your API Key]
Using Source:
- Command:
node - Arguments:
[Absolute path to build/index.js] - Environment Variables:
GEMINI_API_KEY=[Your API Key]
Usage
Once configured, you can use the following tools in the Claude or Copilot chat window:
consult_gemini
Start a new consultation session or continue an existing one.
problem_description: Description of the problem (required for new sessions).code_context: Relevant code (text format).attached_files: List of file paths to read.specific_question: Your specific question.session_id: Session ID to continue the conversation.
list_sessions
List active conversation sessions.
end_session
End a session to free up memory.
Publishing to npm
To publish this package to npm (as a scoped package):
- Login to npm:
npm login - Publish the package (use
--access publicfor the first publish if using a free account):npm publish --access public
This project is a TypeScript reference version, rewritten based on the structure and concepts of mcp-gemini-assistant.
