fossick-mcp 0.1.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. fossick_mcp-0.1.2/.github/workflows/publish.yml +37 -0
  2. fossick_mcp-0.1.2/.github/workflows/test.yml +54 -0
  3. fossick_mcp-0.1.2/.gitignore +17 -0
  4. fossick_mcp-0.1.2/.python-version +1 -0
  5. fossick_mcp-0.1.2/AGENTS.md +9 -0
  6. fossick_mcp-0.1.2/CLAUDE.md +146 -0
  7. fossick_mcp-0.1.2/LICENSE +21 -0
  8. fossick_mcp-0.1.2/PKG-INFO +233 -0
  9. fossick_mcp-0.1.2/README.md +214 -0
  10. fossick_mcp-0.1.2/pyproject.toml +55 -0
  11. fossick_mcp-0.1.2/src/fossick/__init__.py +0 -0
  12. fossick_mcp-0.1.2/src/fossick/__main__.py +9 -0
  13. fossick_mcp-0.1.2/src/fossick/cache.py +74 -0
  14. fossick_mcp-0.1.2/src/fossick/github_client.py +292 -0
  15. fossick_mcp-0.1.2/src/fossick/hints.py +92 -0
  16. fossick_mcp-0.1.2/src/fossick/server.py +57 -0
  17. fossick_mcp-0.1.2/src/fossick/tools/__init__.py +11 -0
  18. fossick_mcp-0.1.2/src/fossick/tools/_common.py +425 -0
  19. fossick_mcp-0.1.2/src/fossick/tools/_tree_sitter.py +255 -0
  20. fossick_mcp-0.1.2/src/fossick/tools/find_symbol.py +557 -0
  21. fossick_mcp-0.1.2/src/fossick/tools/get_file.py +140 -0
  22. fossick_mcp-0.1.2/src/fossick/tools/list_tags.py +129 -0
  23. fossick_mcp-0.1.2/src/fossick/tools/repo_tree.py +186 -0
  24. fossick_mcp-0.1.2/src/fossick/tools/search_code.py +244 -0
  25. fossick_mcp-0.1.2/src/fossick/tools/search_packages.py +213 -0
  26. fossick_mcp-0.1.2/src/fossick/tools/search_repos.py +784 -0
  27. fossick_mcp-0.1.2/tests/__init__.py +0 -0
  28. fossick_mcp-0.1.2/tests/integration/__init__.py +0 -0
  29. fossick_mcp-0.1.2/tests/integration/conftest.py +22 -0
  30. fossick_mcp-0.1.2/tests/integration/helpers.py +36 -0
  31. fossick_mcp-0.1.2/tests/integration/test_tools_errors.py +104 -0
  32. fossick_mcp-0.1.2/tests/integration/test_tools_smoke.py +164 -0
  33. fossick_mcp-0.1.2/tests/test_registration.py +126 -0
  34. fossick_mcp-0.1.2/tests/unit/__init__.py +0 -0
  35. fossick_mcp-0.1.2/tests/unit/test_cache.py +127 -0
  36. fossick_mcp-0.1.2/tests/unit/test_common.py +85 -0
  37. fossick_mcp-0.1.2/tests/unit/test_error_classification.py +370 -0
  38. fossick_mcp-0.1.2/tests/unit/test_github_client_auth.py +136 -0
  39. fossick_mcp-0.1.2/tests/unit/test_hints.py +124 -0
  40. fossick_mcp-0.1.2/tests/unit/test_query_validation.py +396 -0
  41. fossick_mcp-0.1.2/tests/unit/test_search_packages_github_url.py +114 -0
  42. fossick_mcp-0.1.2/tests/unit/test_search_repos_merge.py +754 -0
  43. fossick_mcp-0.1.2/uv.lock +1124 -0
@@ -0,0 +1,37 @@
1
+ name: publish
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - "v*"
7
+
8
+ jobs:
9
+ publish:
10
+ name: Build and publish to PyPI
11
+ runs-on: ubuntu-latest
12
+ environment: pypi
13
+ permissions:
14
+ contents: read # Required for actions/checkout
15
+ id-token: write # Required for trusted publishing (OIDC)
16
+ steps:
17
+ - uses: actions/checkout@v4
18
+
19
+ - name: Install uv
20
+ uses: astral-sh/setup-uv@v4
21
+ with:
22
+ enable-cache: true
23
+
24
+ - name: Set up Python
25
+ run: uv python install 3.11
26
+
27
+ - name: Install dependencies
28
+ run: uv sync --group dev
29
+
30
+ - name: Run tests
31
+ run: uv run pytest -m "not live" -v
32
+
33
+ - name: Build
34
+ run: uv build
35
+
36
+ - name: Publish to PyPI
37
+ run: uv publish --trusted-publishing always
@@ -0,0 +1,54 @@
1
+ name: test
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ schedule:
8
+ - cron: "0 6 * * *"
9
+ workflow_dispatch:
10
+
11
+ jobs:
12
+ unit:
13
+ name: unit + registration
14
+ runs-on: ubuntu-latest
15
+ steps:
16
+ - uses: actions/checkout@v4
17
+
18
+ - name: Install uv
19
+ uses: astral-sh/setup-uv@v4
20
+ with:
21
+ enable-cache: true
22
+
23
+ - name: Set up Python
24
+ run: uv python install 3.11
25
+
26
+ - name: Install dependencies
27
+ run: uv sync --group dev
28
+
29
+ - name: Run unit + registration tests
30
+ run: uv run pytest -m "not live" -v
31
+
32
+ integration:
33
+ name: live integration
34
+ runs-on: ubuntu-latest
35
+ # Only run on main, schedule, or manual dispatch — not on every PR.
36
+ if: github.event_name == 'push' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
37
+ steps:
38
+ - uses: actions/checkout@v4
39
+
40
+ - name: Install uv
41
+ uses: astral-sh/setup-uv@v4
42
+ with:
43
+ enable-cache: true
44
+
45
+ - name: Set up Python
46
+ run: uv python install 3.11
47
+
48
+ - name: Install dependencies
49
+ run: uv sync --group dev
50
+
51
+ - name: Run live integration tests
52
+ env:
53
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
54
+ run: uv run pytest -m live -v
@@ -0,0 +1,17 @@
1
+ # Python-generated files
2
+ __pycache__/
3
+ *.py[oc]
4
+ build/
5
+ dist/
6
+ wheels/
7
+ *.egg-info
8
+
9
+ # Virtual environments
10
+ .venv
11
+
12
+ # Local AI/editor config — kept off the public repo
13
+ .claude/
14
+ .mcp.json
15
+
16
+ # Private benchmarks and eval harness — kept locally, not in the public repo
17
+ benchmarks/
@@ -0,0 +1 @@
1
+ 3.11
@@ -0,0 +1,9 @@
1
+ # AGENTS.md
2
+
3
+ Agent instructions for **fossick-mcp**. This file is the universal entry point for AI coding agents (Claude Code, Cursor, OpenHands, Aider, etc.).
4
+
5
+ The full project instructions — architecture, file layout, key patterns, test recipes, and conventions — live in [`CLAUDE.md`](./CLAUDE.md).
6
+
7
+ Claude Code resolves the `@` import below automatically at load time. For other agents that don't recognize the `@` syntax, open `CLAUDE.md` directly.
8
+
9
+ @CLAUDE.md
@@ -0,0 +1,146 @@
1
+ # CLAUDE.md
2
+
3
+ Project instructions for AI coding agents working on **fossick-mcp**. Covers what the project is, how it's organized, and the recipes for common tasks.
4
+
5
+ ## Table of contents
6
+
7
+ 1. [What fossick is](#what-fossick-is)
8
+ 2. [Stack](#stack)
9
+ 3. [Repository layout](#repository-layout)
10
+ 4. [Key patterns](#key-patterns)
11
+ 5. [Tools](#tools)
12
+ 6. [Hints system](#hints-system)
13
+ 7. [Adding a new tool](#adding-a-new-tool)
14
+ 8. [Tests](#tests)
15
+ 9. [Rate limits](#rate-limits)
16
+ 10. [Conventions](#conventions)
17
+
18
+ ## What fossick is
19
+
20
+ Discovery-focused MCP server for finding and evaluating new libraries, frameworks, and packages to adopt in new projects. Seven tools covering the "starting a project, need to pick the right dependency" workflow, spanning GitHub (200M+ repos), PyPI, and npm.
21
+
22
+ **NOT for code archaeology** — git history, blame, PR tracking, version diffing. Reach for `git` / `gh` CLI via Bash instead.
23
+
24
+ The name comes from the Australian/NZ verb _fossick_ — "to prospect or rummage for gems" — which is what the tool does: sift 200M+ repos down to the handful worth evaluating.
25
+
26
+ ## Stack
27
+
28
+ - **Python 3.11+**, pinned via `.python-version`
29
+ - **`uv`** for package management and builds
30
+ - **FastMCP** (`mcp >= 1.26`) with stdio transport
31
+ - **`httpx`** for async GitHub API calls
32
+ - **Pydantic** for settings
33
+ - **`tree-sitter`** for AST-based symbol search
34
+
35
+ ## Repository layout
36
+
37
+ ```
38
+ src/fossick/
39
+ server.py — FastMCP instance, instructions, lifespan, tool imports
40
+ github_client.py — Async httpx client, auth, rate limits, retry
41
+ cache.py — In-memory TTL cache with LRU eviction
42
+ hints.py — Rule-based next-step suggestion engine
43
+ tools/ — One file per tool
44
+ tools/_common.py — Shared helpers (split_repo, http_error_to_tool_error)
45
+ tools/_tree_sitter.py — AST queries for find_symbol
46
+
47
+ tests/
48
+ unit/ — No network. Classifier branches, cache, hints, etc.
49
+ integration/ — Live, pinned to modelcontextprotocol/python-sdk@v1.14.0
50
+ test_registration.py — Schema + registration smoke for all 7 tools
51
+ ```
52
+
53
+ ## Key patterns
54
+
55
+ - **Server singleton.** `mcp` in `server.py` is the single FastMCP instance. Tool files import it and register via `@mcp.tool()`.
56
+ - **Client singleton.** `get_client()` in `github_client.py` lazily creates one shared `GitHubClient`. Token resolved from `GH_TOKEN`, `GITHUB_TOKEN`, or `GITHUB_PERSONAL_ACCESS_TOKEN` env vars, with `gh auth token` as a fallback.
57
+ - **Lifespan management.** The httpx client is created on startup and closed on shutdown via the `_lifespan()` context manager in `server.py`.
58
+ - **Rate-limit awareness.** Separate buckets for Search API (30/min) and Core API (5000/hr). Reads `X-RateLimit-*` headers and sleeps when exhausted.
59
+ - **Retry with backoff.** Exponential backoff on `403`/`429`/`502`/`503`, max 3 attempts.
60
+ - **TTL cache.** Search results: 120s. Branch content: 300s. SHA-pinned content: 3600s. Trees: 600s.
61
+ - **Tool annotations.** Every tool is marked `readOnlyHint=True, destructiveHint=False, idempotentHint=True`. This tells clients they're safe to auto-approve.
62
+ - **Error classification.** Tools wrap their body in `try/except Exception` and call `http_error_to_tool_error(e, tool="...", repo=..., path=..., ref=..., query=...)` from `tools/_common.py`. The helper classifies the httpx exception (401 / 403 rate-limit vs perm / 404 with tool-specific chain hints / 422 / 5xx / network) and returns a `ToolError` with an LLM-actionable message that names the next fossick tool to chain to. **Never raise a bare `ToolError(f"Error: {e}")`** — it drops the HTTP status and produces retry loops.
63
+ - **No `from __future__ import annotations`** in tool files. FastMCP needs runtime type introspection for JSON Schema generation.
64
+
65
+ ## Tools
66
+
67
+ Seven tools, grouped by role in the discovery workflow.
68
+
69
+ ### Find candidates
70
+ - **`search_repos`** — Discover libraries by topic, stars, language, trending. Accepts a `queries=[...]` list for multi-phrasing recall. `GET /search/repositories`.
71
+ - **`search_packages`** — Direct PyPI/npm lookup by package name. External APIs, no GitHub rate limit.
72
+
73
+ ### Evaluate a candidate
74
+ - **`repo_tree`** — Browse a repo's layout with depth and glob filtering. `GET /repos/{o}/{r}/git/trees/{sha}?recursive=1`.
75
+ - **`get_file`** — Read specific files at any ref. `GET /repos/{o}/{r}/contents/{path}`.
76
+ - **`find_symbol`** — Locate a class/function/type definition via tree-sitter AST queries. `GET /search/code` plus local AST parsing of up to 15 files.
77
+ - **`list_tags`** — Check freshness and recent releases. `GET /repos/{o}/{r}/tags` or `/releases`.
78
+
79
+ ### Real-world usage
80
+ - **`search_code`** — Full-text code search across all of GitHub. Supports `repo:`, `language:`, `path:`, boolean operators, and regex. `GET /search/code` with text-match headers.
81
+
82
+ ### Param conventions
83
+ - Optional string params use `str = ""` (not `str | None`) so FastMCP generates clean JSON Schema types.
84
+ - Optional int params use `int = 0`.
85
+ - Convenience params (`repo`, `language`, `path`) are appended as GitHub search qualifiers to the query string.
86
+ - All tools return `str` — formatted text with hints appended.
87
+
88
+ ## Hints system
89
+
90
+ Every tool response ends with suggested next steps generated by `hints.py`. Rules are defined as `(tool_name, condition_fn, template, priority)` tuples. The top 3 hints are appended as a markdown section. Templates use real values from the result (file paths, repo names, etc.) so the agent can act on them directly without extra reasoning.
91
+
92
+ The hints are load-bearing — they're how the agent learns the discovery workflow without extra prompting. When you add a new tool, write hint rules that point the agent toward the next sensible step.
93
+
94
+ ## Adding a new tool
95
+
96
+ 1. Create `src/fossick/tools/my_tool.py`.
97
+ 2. Import `mcp` from `fossick.server`, `get_client` from `fossick.github_client`, and `http_error_to_tool_error` (plus `split_repo` if the tool takes a `repo`) from `fossick.tools._common`.
98
+ 3. Decorate with:
99
+ ```python
100
+ @mcp.tool(annotations=ToolAnnotations(
101
+ readOnlyHint=True,
102
+ destructiveHint=False,
103
+ idempotentHint=True,
104
+ openWorldHint=True,
105
+ ))
106
+ ```
107
+ 4. The tool function must be `async`, return `str`, and wrap its body in:
108
+ ```python
109
+ try:
110
+ ...
111
+ except Exception as e:
112
+ raise http_error_to_tool_error(e, tool="my_tool", ...)
113
+ ```
114
+ passing whatever context (`repo`, `path`, `ref`, `query`) is available.
115
+ 5. Add hint rules in `hints.py`.
116
+ 6. Import the module in `server.py`.
117
+ 7. Add a smoke test in `tests/integration/test_tools_smoke.py`. If the tool has a tool-specific 404 chain hint, add an error test in `tests/integration/test_tools_errors.py`.
118
+
119
+ ## Tests
120
+
121
+ ```bash
122
+ uv run pytest # unit + registration (no network)
123
+ uv run pytest -m live # live integration tests against real GitHub
124
+ ```
125
+
126
+ Three layers:
127
+
128
+ - **`unit/`** — no network. Cache, hints, token resolution, `split_repo`, and `http_error_to_tool_error` (every classifier branch with fabricated `httpx.HTTPStatusError` instances).
129
+ - **`test_registration.py`** — schema and registration smoke for all 7 tools.
130
+ - **`integration/`** — `live`-marked, hits real GitHub pinned against `modelcontextprotocol/python-sdk@v1.14.0`. Auto-skipped without a resolvable token. `test_tools_smoke.py` covers happy paths; `test_tools_errors.py` forces real 404s on `get_file` / `repo_tree` / `list_tags` to verify each tool wires the right context into the classifier end-to-end.
131
+
132
+ CI lives in `.github/workflows/test.yml`. Unit + registration run on every push and PR; the integration job only runs on `main`, the nightly schedule, and manual `workflow_dispatch`.
133
+
134
+ ## Rate limits
135
+
136
+ - **Search API** — 30/min: `search_repos`, `search_code`, `find_symbol`
137
+ - **Core API** — 5,000/hr: `get_file`, `repo_tree`, `list_tags`. `find_symbol` also spends Core quota fetching up to 15 files per call for tree-sitter parsing.
138
+ - **External APIs** — `search_packages` hits PyPI/npm directly; no GitHub rate limit.
139
+
140
+ ## Conventions
141
+
142
+ - **Keep changes scoped.** A bug fix doesn't need a refactor. A new feature doesn't need extra configurability. Three similar lines of code beats a premature abstraction.
143
+ - **No speculative error handling.** Only validate at system boundaries. Trust internal code and framework guarantees.
144
+ - **Match existing patterns before inventing new ones.** When adding a tool, follow the shape of the existing seven. When touching an existing tool, preserve its structure unless there's a reason to change it.
145
+ - **The error classifier is load-bearing.** `_common.py::http_error_to_tool_error` is the single most important code surface for agent UX — every new error chain needs a unit test in `test_error_classification.py`.
146
+ - **No emojis in files unless explicitly requested.** Applies to code comments, docstrings, and documentation.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Hayden Lipsky
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,233 @@
1
+ Metadata-Version: 2.4
2
+ Name: fossick-mcp
3
+ Version: 0.1.2
4
+ Summary: MCP server — search code, find libraries, and evaluate dependencies across all of GitHub, PyPI, and npm
5
+ Project-URL: Homepage, https://github.com/Lipdog/fossick-mcp
6
+ Project-URL: Repository, https://github.com/Lipdog/fossick-mcp
7
+ Project-URL: Issues, https://github.com/Lipdog/fossick-mcp/issues
8
+ License-Expression: MIT
9
+ License-File: LICENSE
10
+ Keywords: ai-agents,code-search,github,library-discovery,mcp,mcp-server
11
+ Requires-Python: >=3.11
12
+ Requires-Dist: httpx>=0.27
13
+ Requires-Dist: mcp>=1.26
14
+ Requires-Dist: pydantic-settings>=2.0
15
+ Requires-Dist: pydantic>=2.0
16
+ Requires-Dist: tree-sitter-language-pack>=1.5.0
17
+ Requires-Dist: tree-sitter>=0.25.2
18
+ Description-Content-Type: text/markdown
19
+
20
+ # Fossick MCP
21
+
22
+ **Help your AI agent pick the right dependency — and learn from real code on GitHub.**
23
+
24
+ Fossick is an MCP server that gives Claude, Cursor, and other LLM agents a focused toolkit for **discovering libraries, evaluating them, and finding real-world code patterns** across all 200M+ GitHub repos plus PyPI and npm. Seven read-only tools that answer two questions agents constantly run into: _"what should I install for this?"_ and _"how do real projects actually use this API?"_
25
+
26
+ ```
27
+ You: "I need a Rust TUI library — something newer than ratatui."
28
+
29
+ Agent: → search_repos(queries=["rust tui terminal", "rust terminal ui framework"],
30
+ language="Rust", stars="100..5000", pushed=">2026-02-01")
31
+ → list_tags(repo=<top candidate>) # still maintained?
32
+ → repo_tree(repo=<top candidate>) # what does it look like?
33
+ → get_file(repo=<top candidate>, path="README.md")
34
+ → search_code(query="<library>::App", language="Rust") # real usage in the wild
35
+
36
+ Here are 3 actively-maintained options with star counts, last release,
37
+ and example usage from real repos…
38
+ ```
39
+
40
+ Fossick is **not** for code archaeology — git history, blame, PR review, version diffing. Reach for `git` and `gh` CLI for that. Fossick exists for the moment you're starting something new and need to pick well.
41
+
42
+ ## Why Fossick
43
+
44
+ - **Discovery-shaped, not search-shaped.** Tools are designed around the workflow ("find candidate → check if it's alive → read the API → see how others use it"), not around exposing every GitHub endpoint.
45
+ - **Hint chaining.** Every response ends with suggested next steps (`→ try repo_tree on this candidate`), so the agent has a clear path forward without guessing.
46
+ - **Multi-query search.** `search_repos` accepts a list of phrasings in one call and reranks the merged results — better recall than running the same query three times.
47
+ - **Tree-sitter symbol search.** `find_symbol` runs real AST queries on fetched files instead of substring-matching, so "where is `class Foo` defined" actually returns the definition.
48
+ - **Honest about rate limits.** Tracks the GitHub Search and Core buckets separately, sleeps on exhaustion, retries with exponential backoff.
49
+ - **Zero install for `gh` users.** If you already have GitHub CLI authenticated, Fossick uses your token automatically.
50
+
51
+ ## Install
52
+
53
+ You'll need [uv](https://docs.astral.sh/uv/) and Python 3.11+.
54
+
55
+ ```bash
56
+ git clone https://github.com/Lipdog/fossick-mcp.git
57
+ ```
58
+
59
+ Then add Fossick to your MCP client. The `command` is the same everywhere — just point `--directory` at your clone.
60
+
61
+ <details open>
62
+ <summary><b>Claude Code</b></summary>
63
+
64
+ Add to your project's `.mcp.json` (or `~/.claude.json` for global):
65
+
66
+ ```json
67
+ {
68
+ "mcpServers": {
69
+ "fossick": {
70
+ "command": "uv",
71
+ "args": ["run", "--directory", "/path/to/fossick-mcp", "fossick-mcp"]
72
+ }
73
+ }
74
+ }
75
+ ```
76
+ </details>
77
+
78
+ <details>
79
+ <summary><b>Claude Desktop</b></summary>
80
+
81
+ Edit `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS) or `%APPDATA%\Claude\claude_desktop_config.json` (Windows):
82
+
83
+ ```json
84
+ {
85
+ "mcpServers": {
86
+ "fossick": {
87
+ "command": "uv",
88
+ "args": ["run", "--directory", "/path/to/fossick-mcp", "fossick-mcp"]
89
+ }
90
+ }
91
+ }
92
+ ```
93
+ </details>
94
+
95
+ <details>
96
+ <summary><b>Cursor</b></summary>
97
+
98
+ Add to `~/.cursor/mcp.json` or `.cursor/mcp.json` in your project:
99
+
100
+ ```json
101
+ {
102
+ "mcpServers": {
103
+ "fossick": {
104
+ "command": "uv",
105
+ "args": ["run", "--directory", "/path/to/fossick-mcp", "fossick-mcp"]
106
+ }
107
+ }
108
+ }
109
+ ```
110
+ </details>
111
+
112
+ ### Authentication
113
+
114
+ Fossick resolves a GitHub token automatically, in this order:
115
+
116
+ 1. `GH_TOKEN`, `GITHUB_TOKEN`, or `GITHUB_PERSONAL_ACCESS_TOKEN` env vars
117
+ 2. `gh auth token` from the [GitHub CLI](https://cli.github.com/) — **no config needed if you're already logged in**
118
+
119
+ To pass a token explicitly:
120
+
121
+ ```json
122
+ {
123
+ "mcpServers": {
124
+ "fossick": {
125
+ "command": "uv",
126
+ "args": ["run", "--directory", "/path/to/fossick-mcp", "fossick-mcp"],
127
+ "env": { "GITHUB_TOKEN": "ghp_your_token_here" }
128
+ }
129
+ }
130
+ }
131
+ ```
132
+
133
+ A token only needs the public read scope (no scopes selected is fine for public repos).
134
+
135
+ ## Tools
136
+
137
+ Seven tools, organized by their role in the discovery workflow.
138
+
139
+ ### Find candidates
140
+
141
+ | Tool | What it does |
142
+ |---|---|
143
+ | **`search_repos`** | Discover repositories by topic, stars, language, recency, or trending. Accepts a list of query phrasings for better recall. |
144
+ | **`search_packages`** | Direct lookup on PyPI or npm when you already know the package name. Returns version, description, links, GitHub repo. |
145
+
146
+ ### Evaluate a candidate
147
+
148
+ | Tool | What it does |
149
+ |---|---|
150
+ | **`repo_tree`** | Browse a repo's file layout with depth and glob filtering. |
151
+ | **`get_file`** | Read any file at any branch, tag, or commit (READMEs, examples, the main module). |
152
+ | **`find_symbol`** | Goto-definition via tree-sitter — find where a class, function, or type is actually declared. |
153
+ | **`list_tags`** | View tags and recent releases. The fastest "is this still maintained?" check. |
154
+
155
+ ### Search real code across GitHub
156
+
157
+ | Tool | What it does |
158
+ |---|---|
159
+ | **`search_code`** | Search the contents of every public file on GitHub. Full search syntax (`repo:`, `language:`, `path:`, boolean operators, regex). Use it to find real-world examples of an API, locate config patterns (`filename:Dockerfile FROM python`), or scope a search to a single repo. The "show me how people actually do this" tool. |
160
+
161
+ All tools are read-only, idempotent, and safe to auto-approve. Every response includes hint-chained next steps so the agent knows what to do next.
162
+
163
+ ## A typical session
164
+
165
+ > _"Find me a small, modern alternative to Pydantic for runtime validation in Python."_
166
+
167
+ ```
168
+ 1. search_repos(queries=[
169
+ "pydantic alternative validation",
170
+ "dataclass runtime type validation",
171
+ "lightweight schema validation python"
172
+ ], language="Python", stars="100..5000")
173
+ → ranked candidates with stars, descriptions, last-push dates
174
+
175
+ 2. list_tags(repo=<top candidate>)
176
+ → recent release dates — confirms it's actively maintained
177
+
178
+ 3. get_file(repo=<top candidate>, path="README.md")
179
+ → positioning, install instructions, code samples
180
+
181
+ 4. search_code(query="from <pkg> import …", language="Python")
182
+ → real adoption signal — who else is using it
183
+
184
+ 5. find_symbol(repo=<top candidate>, name="Struct")
185
+ → goto-definition for the core API — read it before adopting it
186
+ ```
187
+
188
+ The agent can run the full evaluation in one turn without you context-switching to a browser.
189
+
190
+ Or, when you just want a code pattern:
191
+
192
+ > _"Show me how people set up structured logging with `structlog` and `asyncio` in production."_
193
+
194
+ ```
195
+ 1. search_code(query="structlog configure_once asyncio", language="Python")
196
+ → matches with surrounding context, ranked by file relevance
197
+
198
+ 2. get_file(repo=<best match>, path=<file>)
199
+ → read the full setup in context, not just the snippet
200
+ ```
201
+
202
+ ## Rate limits
203
+
204
+ Fossick tracks both GitHub buckets independently and pauses when either is exhausted.
205
+
206
+ - **Search API** — 30/min: `search_repos`, `search_code`, `find_symbol`
207
+ - **Core API** — 5,000/hr: `get_file`, `repo_tree`, `list_tags`
208
+ - **External APIs** — `search_packages` hits PyPI / npm directly, no GitHub limit
209
+
210
+ Retries use exponential backoff on `403`, `429`, `502`, `503`. Search results are cached for 120s, branch content for 300s, SHA-pinned content for 1h.
211
+
212
+ ## Development
213
+
214
+ ```bash
215
+ git clone https://github.com/Lipdog/fossick-mcp.git
216
+ cd fossick-mcp
217
+ uv sync
218
+ uv run pytest # unit + registration (no network)
219
+ uv run pytest -m live # integration tests against real GitHub
220
+ uv run fossick-mcp # launch the server on stdio
221
+ ```
222
+
223
+ The codebase is small and easy to navigate — see [`CLAUDE.md`](./CLAUDE.md) for an architecture tour and the recipe for adding a new tool.
224
+
225
+ ## Requirements
226
+
227
+ - Python 3.11+
228
+ - [uv](https://docs.astral.sh/uv/)
229
+ - A GitHub token, or [`gh`](https://cli.github.com/) authenticated locally
230
+
231
+ ## License
232
+
233
+ [MIT](./LICENSE) © 2026 Hayden Lipsky