A local LLM knows nothing about my GitHub. Give it an MCP server that does, and it can answer "How many open source projects does kagitha-dev have? Explain them."
GithubAgent (HOST) ──► GithubMCPClient (CLIENT) ──stdio──► GithubMCPServer (SERVER) ──HTTPS──► api.github.com
LLM loop + Ollama list tools / call tool 3 tools live data
| Layer | Class | What it does |
|---|---|---|
| Host | org.example.host.GithubAgent |
Ep 4's SimpleAgent loop. Only tools() and run() changed: they ask the MCP client. |
| Client | org.example.client.GithubMCPClient |
Starts the server jar, lists tools, calls a tool. Has its own main to test without an LLM. |
| Server | org.example.server.GithubMCPServer |
Three tools, each a live call to the GitHub REST API. |
Tools
| Tool | Returns |
|---|---|
repo_count |
How many public repos kagitha-dev has |
repo_names |
One repo name per line |
repo_descriptions |
name (language): description per repo |
Run
You need Java 21, Maven, and Ollama with qwen3.5:4b pulled.
mvn clean package # builds target/GithubMCP-1.0-SNAPSHOT.jar (the server)
# 1. Client -> Server only (no LLM)
java -cp target/GithubMCP-1.0-SNAPSHOT.jar org.example.client.GithubMCPClient
# 2. Host -> Client -> Server (with the LLM)
java -cp target/GithubMCP-1.0-SNAPSHOT.jar org.example.host.GithubAgent
java -cp target/GithubMCP-1.0-SNAPSHOT.jar org.example.host.GithubAgent "Which of my projects are about MCP?"Run from the project folder: the client starts the server with java -jar target/GithubMCP-1.0-SNAPSHOT.jar.
Optional: export GITHUB_TOKEN=... raises GitHub's limit from 60 to 5000 requests per hour.
Public repos need no token.
Why the server logs to stderr
With the stdio transport, the server's stdout is the wire to the client. Anything printed there
breaks the JSON-RPC messages, so every log line in the server uses System.err.