Gemini Documentation Assistant
STDIOMCP server enabling access to documentation using Gemini API with 2M token context window.
MCP server enabling access to documentation using Gemini API with 2M token context window.
This project implements an MCP server that enables access to documentation for various technologies using the Gemini API with its gigantic context window of 2M tokens. It should work for any client, but is targeted especially to the Roo/Cline environment.
This approach offers several advantages over simply browsing the web or using a search engine:
It also overcomes some problemmatic hurdles of traditional RAG systems:
There are some limitations, though:
can_x_be_done
: Check if a specific task can be done in a given technology.hints_for_problem
: Get hints for solving a specific problem.is_this_good_practice
: Check if a code snippet follows good practices.how_to_do_x
: Get examples and alternative approaches for a specific task.--verbose
flag).To install Gemini Docs Server for Claude Desktop automatically via Smithery:
npx -y @smithery/cli install @M-Gonzalo/cosa-sai --client claude
This MCP server is automatically started and managed by the client. To enable it, you need to configure it in your settings file (for example, ~/.config/Code/User/globalStorage/rooveterinaryinc.roo-cline/settings/cline_mcp_settings.json
). There's usually a button for opening up the settings file in the client.
Here's the configuration for this server:
{ "command": "bun", "args": [ "--watch", "path/to/repo/cosa-sai-mcp/src/index.ts", "--verbose" ], "env": { "GEMINI_API_KEY": "<your_gemini_api_key>" }, "disabled": false, "alwaysAllow": [ "can_x_be_done", "hints_for_problem", "is_this_good_practice", "how_to_do_x" ], "timeout": 60 // in seconds }
This MCP server requires a knowledge base of documentation to answer questions. You must manually procure this knowledge base, either by downloading a public repository, scraping a website, or using other methods.
An optional sanitation process can be performed to clean up the original documentation from styling and other unnecessary content.
Here are some basic tools for doing so. Better solutions are encouraged:
Naive Scrapper:
wget --mirror --convert-links --adjust-extension --page-requisites --no-parent --directory-prefix=./local_copy --no-verbose --show-progress $1
Quick and Dirty Conversor to Markdown-ish:
#!/bin/bash directory="${1:-.}" # Default to current directory if no argument is provided output_file="${2:-concatenated.md}" # Default output file name echo "Concatenating files in '$directory' into '$output_file'..." # Clear output file if it exists truncate -s 0 "$output_file" # Find all files (excluding directories) and process them find "$directory" -type f -name '*.html' | while IFS= read -r file; do echo "=== ${file#./} ===" >> "$output_file" cat "$file" \ | grep -v 'base64' \ | html2markdown >> "$output_file" echo -e "\n" >> "$output_file" done echo "Done! Output saved to '$output_file'"
This server provides the following tools:
docs
, prompt
, x
, technology
success
, data
docs
, prompt
, problem
, context
, environment
success
, data
docs
, prompt
, snippet
, context
success
, data
docs
, prompt
, x
, technology
success
, data
Contributions are welcome! Please follow these guidelines:
This project is licensed under the MIT License.
This is a very early version of the project, and it's likely to have bugs and limitations. Please report any issues you find, and feel free to suggest improvements or new features.