Skip to main content

The code-review MCP that reviews your merge request against the whole codebase, not just the diff

Project description

myopic

The code-review MCP with the most ironic name in the registry. It's anything but nearsighted — the goal is to review your merge request against the whole codebase, not just the diff in front of it.

⚠️ Alpha / building in public. myopic is under active development and currently supports GitLab merge requests only — GitHub pull requests are on the roadmap (the platform layer is already abstracted for them). The roadmap below is public on purpose: follow along, open issues, and pitch in. What's checked off works today; the rest is coming. Don't depend on it in a critical workflow yet.


Why

Most AI code review looks at the diff in isolation. But the bugs that matter live in what the diff doesn't show: the caller three files away that now breaks, the convention every sibling file follows that this one quietly drops, the helper that already exists so this new one is a duplicate, the file nobody imports. A reviewer that only reads the patch is myopic.

myopic is an MCP server that feeds your AI client (Claude, Cursor, etc.) the structured context to review like someone who actually knows the codebase — starting with precise, line-numbered access to the merge request itself, and growing toward full codebase-aware review (see the roadmap).

It pairs with amnesic, my MCP server that gives AI persistent memory of SQL databases.


Status & roadmap

Tool What it does Status
mr_review_status MR metadata + every discussion thread + resolved/unresolved state, in one call ✅ alpha
mr_diff_lines MR diff as structured, line-numbered hunks — exact positions for inline comments ✅ alpha
mr_diff_sections AST-grouped diff (by function/class) so large MRs don't blow the token budget 🔜 planned
review_with_context RAG-augmented review: callers of changed symbols + conventions sibling files follow + duplication + unwired-file detection 🔜 planned
mr_post_comments bulk-post inline review comments at exact diff positions 🔜 planned
GitHub pull requests same tools, GitHub PRs (the platform layer is already abstracted for this) 🔜 planned

Full details and design notes: ROADMAP.md. Ideas and issues welcome — that's the point of building this in the open.


Install

uvx myopic            # run directly (recommended)
# or
pip install myopic

Setup

myopic needs a GitLab URL and a personal access token with api (or read_api) scope.

myopic init           # writes a config template + prints next steps

Then put your token in ~/.config/myopic/.env:

GITLAB_TOKEN=glpat-xxxxxxxxxxxxxxxxxxxx

Edit ~/.config/myopic/config.toml if your GitLab is self-hosted (defaults to https://gitlab.com). Verify it:

myopic test           # ✓ Authenticated to https://gitlab.com as <you>

The token never lives in the TOML — it's referenced as ${GITLAB_TOKEN} and read from the .env file (or your environment).

Add to your AI client

Claude Code (~/.claude/mcp.json or project .mcp.json):

{
  "mcpServers": {
    "myopic": {
      "command": "uvx",
      "args": ["myopic"]
    }
  }
}

The same command/args work for Claude Desktop, Cursor, and other MCP-compatible clients — consult your client's MCP config docs for where the file lives.

Use

Point your AI at a merge request:

"Review this MR: https://gitlab.com/group/project/-/merge_requests/42"

Your client will call mr_review_status to orient, then mr_diff_lines to read exactly what changed with precise line numbers — and review from there.


Configuration reference

Source Key Notes
config.toml [gitlab].url GitLab base URL (default https://gitlab.com)
config.toml [gitlab].token use ${GITLAB_TOKEN} — don't hardcode
.env (next to config) GITLAB_TOKEN the actual token value
env var MYOPIC_GITLAB_URL / GITLAB_URL fallback if no TOML
env var MYOPIC_GITLAB_TOKEN / GITLAB_TOKEN fallback if no TOML
env var MYOPIC_CONFIG override the config file path
env var MYOPIC_HOME override the config directory

Security

  • Read-oriented today. The shipped tools only read MR data; nothing posts or mutates. (Comment-posting on the roadmap will be explicit and opt-in.)
  • Your token stays local. It lives in your .env / environment and is sent only to your configured GitLab instance — never to any third party.
  • Auth errors are scrubbed so your token never leaks into error messages.

Development

pip install -e ".[dev]"
pytest                 # diff-parser unit tests, no network needed

License

MIT © Suraj Goyal

mcp-name: io.github.SurajKGoyal/myopic

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

myopic-0.0.1.tar.gz (51.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

myopic-0.0.1-py3-none-any.whl (52.3 kB view details)

Uploaded Python 3

File details

Details for the file myopic-0.0.1.tar.gz.

File metadata

  • Download URL: myopic-0.0.1.tar.gz
  • Upload date:
  • Size: 51.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for myopic-0.0.1.tar.gz
Algorithm Hash digest
SHA256 15d64facd797fddfec1c7c7095616425ad9f3384a2382dfc95a8b4c021ec57b6
MD5 c6792fc94d8b30365a6e3ec95e97246d
BLAKE2b-256 33303fa63723ab0ced5af9efdb6d30ab1a0a875c8ce2f54e33a8383eea0fee37

See more details on using hashes here.

Provenance

The following attestation bundles were made for myopic-0.0.1.tar.gz:

Publisher: publish.yml on SurajKGoyal/myopic

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file myopic-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: myopic-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 52.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for myopic-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 fae090a90fd1d28282e27717cf4a0378f3d7e8bdada29072a44b3a318e561bc4
MD5 5b3a16ee668c3507f753a5516451e770
BLAKE2b-256 dab703d65044431f79a20795f8d5e3a592ecf0f90d6ad1b90dd0d11c89aa876c

See more details on using hashes here.

Provenance

The following attestation bundles were made for myopic-0.0.1-py3-none-any.whl:

Publisher: publish.yml on SurajKGoyal/myopic

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page