Cosa-SAI (Gemini Docs) MCP server

Loads entire documentation sets directly into Gemini's 2M token context window, eliminating traditional RAG limitations for comprehensive technology documentation access and specialized problem-solving tools.
Back to servers
Provider
M Gonzalo
Release date
Feb 27, 2025
Language
TypeScript
Stats
13 stars

This MCP server allows you to access and query technology documentation using Gemini API's large context window. It acts as a powerful documentation assistant that can provide comprehensive answers by leveraging the entire specification for a technology, rather than just returning search snippets.

Installation

Using Smithery (Recommended)

Install the Gemini Docs Server for Claude Desktop automatically via Smithery:

npx -y @smithery/cli install @M-Gonzalo/cosa-sai --client claude

Manual Configuration

After installation, you need to configure the server in your client settings file. For Claude/Roo clients, this is typically located at: ~/.config/Code/User/globalStorage/rooveterinaryinc.roo-cline/settings/cline_mcp_settings.json

Add the following configuration:

{
  "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
}

Make sure to:

  • Replace <your_gemini_api_key> with your actual Gemini API key
  • Update the path to the repository location on your system

Preparing Documentation

The server requires a knowledge base of documentation to function properly. You need to manually gather this documentation through one of these methods:

Basic Web Scraping

Use this simple command to mirror a documentation website:

wget --mirror --convert-links --adjust-extension --page-requisites --no-parent --directory-prefix=./local_copy --no-verbose --show-progress $1

Converting to Markdown

After scraping, you can convert HTML files to a more usable format:

#!/bin/bash

directory="${1:-.}"  # Default to current directory if no argument is provided
output_file="${2:-concatenated.md}"  # Default output file name

# Clear output file if it exists
truncate -s 0 "$output_file"

# Find all files 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

Using the Server

The MCP server provides four main tools for interacting with documentation:

Checking Capability

Use can_x_be_done to determine if a specific task can be accomplished with a technology:

{
  "tool": "can_x_be_done",
  "input": {
    "docs": "documentation content",
    "prompt": "your prompt",
    "x": "the task to check",
    "technology": "the technology name"
  }
}

Getting Problem-Solving Hints

Use hints_for_problem to receive guidance on specific problems:

{
  "tool": "hints_for_problem",
  "input": {
    "docs": "documentation content",
    "prompt": "your prompt",
    "problem": "description of the problem",
    "context": "contextual information",
    "environment": "details about your environment"
  }
}

Checking Best Practices

Use is_this_good_practice to evaluate code quality:

{
  "tool": "is_this_good_practice",
  "input": {
    "docs": "documentation content",
    "prompt": "your prompt",
    "snippet": "code to evaluate",
    "context": "context of the code"
  }
}

Learning How to Implement Features

Use how_to_do_x to learn different approaches for implementing a feature:

{
  "tool": "how_to_do_x",
  "input": {
    "docs": "documentation content",
    "prompt": "your prompt",
    "x": "what you want to accomplish",
    "technology": "the technology name"
  }
}

Limitations

  • Not real-time: Documentation is static and won't automatically update with new features or changes
  • Context window constraints: Despite Gemini's large 2M token window, some comprehensive documentation might not fit entirely
  • Performance: Due to the large amount of documentation being processed, responses might be slow, especially for the first query

How to add this MCP server to Cursor

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.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "cursor-rules-mcp": {
            "command": "npx",
            "args": [
                "-y",
                "cursor-rules-mcp"
            ]
        }
    }
}

Adding an MCP server to a project

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.

How to use the MCP server

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 explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later