Skip to main content
DeepWiki (by Cognition) exposes an MCP server that reads and answers questions about the documentation of any public GitHub repository. It is free, needs no authentication, and is the best first MCP integration to write — the only key you need is the one for your LLM.

Prerequisites

  • Python 3.10+
  • One LLM provider key. This tutorial uses Anthropic; any LiteLLM model with tool-calling support works.

Build it

1

Install swarms

2

Set your LLM key

Only your model provider needs a key. DeepWiki itself is open.
3

Write a system prompt that forces grounding

An agent with a research tool will still answer from memory unless you tell it not to. This prompt is the difference between a citation and a guess:
4

Point the agent at the server

mcp_url is the entire integration. On startup the agent connects, fetches the server’s tool list, and converts each tool into a function-calling schema the model can use.
5

Run a task

The complete script

What happens when you call run()

  1. Transport is detected from the URL scheme. An https:// URL uses streamable HTTP; you never configure this by hand.
  2. Tools are discovered. The agent asks the server what it exposes and converts each tool to an OpenAI-format function schema.
  3. The model chooses. It typically calls read_wiki_structure to see what exists, then read_wiki_contents or ask_question for the parts that matter.
  4. Results come back into the conversation, and the model writes its answer from them.

The smallest possible version

Strip the system prompt and you still have a working integration — useful for a first smoke test:

Troubleshooting

Two fixes, in order: say “use your tools” in the task, and put the instruction to retrieve before answering in the system prompt. Weaker models need both.
read_wiki_contents can return a lot of text. Raise the ceiling with mcp_timeout=120 on the Agent.
You are on mcp 2.x, which renamed it. Pin the 1.x line: pip install 'mcp>=1.28.1,<2.0.0'.

Next