Skip to main content
GitMCP turns any public GitHub repository into its own MCP documentation server. You point the URL at an owner/repo and the agent gets tools to search and read that repository’s code and docs — nothing else. Free, no auth. Because the server is scoped to one project, this is the cleanest pattern for a documentation assistant: the agent cannot wander, and every answer traces to a file in that repo.

Prerequisites

  • Python 3.10+
  • A Google AI Studio key for Gemini. Swap model_name for any tool-calling model you already have a key for.

Build it

1

Install and set your key

2

Choose the repository

The repo is part of the URL, so make it a variable — that is the one thing you will change when you reuse this script.
3

Build the agent

Note the tool names the server advertises are repo-specific — fetch_swarms_documentation, not a generic fetch_docs. You do not need to know them; the agent discovers them.
4

Ask for something a docs bot should be good at

“Cite the file you found it in” is doing real work here — it turns an answer you have to trust into one you can check.

The complete script

Turning it into a support bot

The pattern generalizes with two changes: point the URL at your own repository, and give the agent a persona that knows it is answering users rather than reading code for itself.
max_loops=2 gives it room to search, read what it found, and then answer — one loop often is not enough when the first search misses.

DeepWiki or GitMCP?

Use GitMCP when the repository is decided before the question is asked.

Next