Public scan — anyone with this URL can view this analysis. Sign up to track your own repos privately, run scheduled re-scans, and get AI fix prompts via your dashboard.

Scan timing: clone 1.59s · analysis 5.24s · 3.8 MB · GitHub API rate-limit (preflight)

modelcontextprotocol/python-sdk

https://github.com/modelcontextprotocol/python-sdk · scanned 2026-05-31 01:27 UTC (1 week, 6 days ago) · 10 languages

331 raw signals (144 security + 187 graph) 99th percentile · Python · medium (20-100K LoC) System graph score 94 (lower by 4)

UNIFIED Repobility · multi-layer engine · AI coders

Complete repo analysis

Last scanned 1 week, 6 days ago · v2 · last Δ -4.3 (diff) · 122 actionable findings from 2 signal sources. 96 repeated signals grouped for readability. Security checks, system graph analysis, and verified AI-agent feedback are merged into one review queue.

JSON
Score breakdown â 2026-05-18-v5
Component Sub-score Weight Contribution
structure_score 85.0 0.15 12.75
security_score 95.9 0.25 23.98
testing_score 100.0 0.20 20.00
documentation_score 96.0 0.15 14.40
practices_score 77.0 0.15 11.55
code_quality 77.7 0.10 7.77
Overall 1.00 90.4
Severity distribution — click a segment to filter
Active filters: excluding tests × Reset all
Scan summary Quality grade A (90/100). Dimensions: security 96, maintainability 85. 144 findings (4 security). 75,658 lines analyzed.

Showing 61 of 122 actionable findings. 218 raw detector signals were grouped into reader-sized issues. Click TP / FP to vote on a finding's accuracy — votes adjust the confidence weighting and improve detection across the platform.

high Security checks quality Quality conf 1.00 ✓ Repobility 3 occurrences Missing import: `queue` used but not imported
The file uses `queue.something(...)` but never imports `queue`. This raises NameError at runtime the first time the line executes.
3 files, 3 locations
src/mcp/shared/experimental/tasks/message_queue.py:167
src/mcp/shared/tool_name_validation.py:67
tests/interaction/_connect.py:283
low Security checks quality Quality conf 1.00 ✓ Repobility [MINED006] Overcatch Baseexception: except BaseException: ... — prevents Ctrl+C and SystemExit from working.
Review and fix per the pattern semantics. See CWE-705 / for context.
examples/snippets/clients/url_elicitation_client.py:269
high Security checks security Injection conf 0.50 [SEC004] SQL Injection Risk: String interpolation in SQL execution. Allows SQL injection.
Use parameterized queries: cursor.execute('SELECT * FROM t WHERE id = %s', [id]). For dynamic table or column names, choose identifiers from a hard-coded allowlist and keep values in parameters.
examples/servers/simple-task-interactive/mcp_simple_task_interactive/server.py:65
high Security checks quality Quality conf 1.00 ✓ Repobility 4 occurrences `self.aclose` used but never assigned in __init__
Method `__aexit__` of class `SpyMemoryObjectSendStream` reads `self.aclose`, but no assignment to it exists in __init__ (and no class-level fallback). This raises AttributeError the first time the method runs against an instance.
2 files, 4 locations
tests/interaction/_helpers.py:48, 58, 82 (3 hits)
tests/client/conftest.py:30
high Security checks quality Quality conf 1.00 ✓ Repobility 6 occurrences Blocking call `input` inside async function `interactive_loop`
`input` is a synchronous (blocking) call. When invoked inside an `async def` it stalls the event loop, preventing every other coroutine in the process from making progress.
5 files, 6 locations
examples/snippets/clients/url_elicitation_client.py:103, 266 (2 hits)
examples/clients/simple-auth-client/mcp_simple_auth_client/main.py:311
examples/clients/simple-chatbot/mcp_simple_chatbot/main.py:376
examples/clients/simple-task-interactive-client/mcp_simple_task_interactive_client/main.py:33
examples/snippets/clients/oauth_client.py:50
high Security checks software dependencies conf 0.90 ✓ Repobility 3 occurrences pre-commit hook `https://github.com/pre-commit/pre-commit-hooks` pinned to mutable rev `v6.0.0`
`.pre-commit-config.yaml` references `https://github.com/pre-commit/pre-commit-hooks` at `rev: v6.0.0`. If `{rev}` is a branch or version tag, the repo owner can push new code there and `pre-commit install --install-hooks` will fetch it on every developer's machine.
lines 4, 8, 14
.pre-commit-config.yaml:4, 8, 14 (3 hits)
low Security checks quality Error handling conf 1.00 [ERR001] Silent Exception Swallowing: Silently swallowing all exceptions hides bugs. Even in cleanup code, log at DEBUG level.
Log the error: `except Exception: logger.debug('cleanup failed', exc_info=True)`. Or handle specific exception types.
src/mcp/os/win32/utilities.py:302
low Security checks quality Error handling conf 1.00 [ERR001] Silent Exception Swallowing: Silently swallowing all exceptions hides bugs. Even in cleanup code, log at DEBUG level.
Log the error: `except Exception: logger.debug('cleanup failed', exc_info=True)`. Or handle specific exception types.
src/mcp/server/experimental/task_result_handler.py:170
medium Security checks quality Quality conf 1.00 3 occurrences [SEC123] Production stack trace / debug output exposed: Debug mode left on in production exposes stack traces, environment variables, framework internals — sometimes triggers RCE (Django debug page with arbitrary template eval).
Set DEBUG=False / APP_DEBUG=false in production. Provide a generic 500 handler that logs to backend but returns a sanitized page to clients.
3 files, 3 locations
examples/servers/simple-auth/mcp_simple_auth/legacy_as_server.py:68
examples/servers/simple-auth/mcp_simple_auth/server.py:67
examples/servers/simple-streamablehttp-stateless/mcp_simple_streamablehttp_stateless/server.py:104
low Security checks quality Error handling conf 0.55 ✓ Repobility 18 occurrences Broad exception handler needs review
This handler catches Exception/BaseException. It is actionable when it swallows errors without logging, re-raising, or returning a structured error. Handlers that intentionally convert exceptions into typed error results should not be treated as high risk.
12 files, 18 locations
examples/servers/everything-server/mcp_everything_server/server.py:191, 213, 245, 304 (4 hits)
examples/clients/simple-auth-client/mcp_simple_auth_client/main.py:236, 277, 297 (3 hits)
examples/snippets/clients/url_elicitation_client.py:118, 132 (2 hits)
scripts/update_readme_snippets.py:89
src/mcp/client/auth/utils.py:265
src/mcp/server/experimental/request_context.py:207
src/mcp/server/lowlevel/server.py:512
src/mcp/server/mcpserver/server.py:315
Error handlingquality
medium Security checks quality Quality conf 1.00 ✓ Repobility Mutable default argument in `_exchange_token_authorization_code` (dict)
`def _exchange_token_authorization_code(... = []/{}/set())` — Python's default value is constructed ONCE at function definition time and shared across all calls. Mutating it in one call mutates it for every future call too.
src/mcp/client/auth/oauth2.py:379
medium Security checks quality Quality conf 1.00 ✓ Repobility 2 occurrences Mutable default argument in `dev` (list)
`def dev(... = []/{}/set())` — Python's default value is constructed ONCE at function definition time and shared across all calls. Mutating it in one call mutates it for every future call too.
lines 221, 361
src/mcp/cli/cli.py:221, 361 (2 hits)
medium Security checks quality Quality conf 0.78 Public web service has no security.txt
security.txt gives researchers and customers a safe disclosure channel. Public web apps and APIs should publish it under /.well-known/security.txt.
.well-known/security.txt
medium System graph cicd CI/CD security conf 1.00 4 occurrences GitHub Actions workflow grants broad write permissions
CI tokens with write permissions increase blast radius when an action, dependency, or PR workflow is compromised. Prefer job-level least-privilege permissions.
4 files, 4 locations
.github/workflows/claude.yml
.github/workflows/deploy-docs.yml
.github/workflows/publish-pypi.yml
.github/workflows/weekly-lockfile-update.yml
CI/CD securitySupply chainGithub actions
medium System graph security security conf 1.00 Insecure pattern 'subprocess_shell_true' in src/mcp/cli/cli.py:48
Found a known-risky pattern (subprocess_shell_true). Review and replace if possible.
src/mcp/cli/cli.py:48 Subprocess shell true
medium System graph quality Integrity conf 1.00 Network/subprocess call without timeout or try/except — src/mcp/cli/cli.py:276
`subprocess.run(...)` here lacks both a `timeout=` arg and an enclosing try/except. This is exactly the class of bug that took down our git-clone earlier (HTTP/2 stream cancel surfaced as a fatal). Add a `timeout=` and wrap in try/except, or use a wrapper that retries.
runtime safetyRobustness
medium System graph quality Integrity conf 1.00 Network/subprocess call without timeout or try/except — src/mcp/os/win32/utilities.py:220
`subprocess.Popen(...)` here lacks both a `timeout=` arg and an enclosing try/except. This is exactly the class of bug that took down our git-clone earlier (HTTP/2 stream cancel surfaced as a fatal). Add a `timeout=` and wrap in try/except, or use a wrapper that retries.
runtime safetyRobustness
low Security checks quality Quality conf 0.60 Duplicated implementation block across source files
Duplicate implementation blocks are maintenance debt. Keep them visible, but they are not a high-severity defect unless the duplicated logic is security-sensitive or drifting.
src/mcp/server/lowlevel/experimental.py:98 duplicationquality
low Security checks quality Quality conf 0.60 Duplicated implementation block across source files
Duplicate implementation blocks are maintenance debt. Keep them visible, but they are not a high-severity defect unless the duplicated logic is security-sensitive or drifting.
src/mcp/server/experimental/task_context.py:406 duplicationquality
low System graph quality Integrity conf 1.00 8 env vars used in code but missing from .env.example
Drift between code and config docs. The first few: `MCP_CLIENT_METADATA_URL`, `MCP_CONFORMANCE_CONTEXT`, `MCP_CONFORMANCE_SCENARIO`, `MCP_SERVER_PORT`, `MCP_TRANSPORT_TYPE`, `USER`, `UV_INDEX`, `XDG_CONFIG_HOME`. Add them (with a placeholder/comment) to .env.example so onboarding doesn't break.
config drift
low System graph software Dead code candidate conf 1.00 File has no detected symbols: docs/hooks/gen_ref_pages.py
Source file with no class/function declarations — possible config, dead code, or scratch file.
low System graph software Dead code candidate conf 1.00 File has no detected symbols: examples/clients/simple-task-client/mcp_simple_task_client/__main__.py
Source file with no class/function declarations — possible config, dead code, or scratch file.
low System graph software Dead code candidate conf 1.00 File has no detected symbols: examples/clients/simple-task-interactive-client/mcp_simple_task_interactive_client/__main__.py
Source file with no class/function declarations — possible config, dead code, or scratch file.
low System graph software Dead code candidate conf 1.00 File has no detected symbols: examples/servers/everything-server/mcp_everything_server/__main__.py
Source file with no class/function declarations — possible config, dead code, or scratch file.
low System graph software Dead code candidate conf 1.00 File has no detected symbols: examples/servers/simple-auth/mcp_simple_auth/__main__.py
Source file with no class/function declarations — possible config, dead code, or scratch file.
low System graph software Dead code candidate conf 1.00 File has no detected symbols: examples/servers/simple-pagination/mcp_simple_pagination/__main__.py
Source file with no class/function declarations — possible config, dead code, or scratch file.
low System graph software Dead code candidate conf 1.00 File has no detected symbols: examples/servers/simple-prompt/mcp_simple_prompt/__main__.py
Source file with no class/function declarations — possible config, dead code, or scratch file.
low System graph software Dead code candidate conf 1.00 File has no detected symbols: examples/servers/simple-resource/mcp_simple_resource/__main__.py
Source file with no class/function declarations — possible config, dead code, or scratch file.
low System graph software Dead code candidate conf 1.00 File has no detected symbols: examples/servers/simple-streamablehttp-stateless/mcp_simple_streamablehttp_stateless/__main__.py
Source file with no class/function declarations — possible config, dead code, or scratch file.
low System graph software Dead code candidate conf 1.00 File has no detected symbols: examples/servers/simple-streamablehttp/mcp_simple_streamablehttp/__main__.py
Source file with no class/function declarations — possible config, dead code, or scratch file.
low System graph software Dead code candidate conf 1.00 File has no detected symbols: examples/servers/simple-task-interactive/mcp_simple_task_interactive/__main__.py
Source file with no class/function declarations — possible config, dead code, or scratch file.
low System graph software Dead code candidate conf 1.00 File has no detected symbols: examples/servers/simple-task/mcp_simple_task/__main__.py
Source file with no class/function declarations — possible config, dead code, or scratch file.
low System graph software Dead code candidate conf 1.00 File has no detected symbols: examples/servers/simple-tool/mcp_simple_tool/__main__.py
Source file with no class/function declarations — possible config, dead code, or scratch file.
low System graph software Dead code candidate conf 1.00 File has no detected symbols: examples/servers/sse-polling-demo/mcp_sse_polling_demo/__main__.py
Source file with no class/function declarations — possible config, dead code, or scratch file.
low System graph software Dead code candidate conf 1.00 File has no detected symbols: src/mcp/client/context.py
Source file with no class/function declarations — possible config, dead code, or scratch file.
low System graph software Dead code candidate conf 1.00 File has no detected symbols: src/mcp/shared/version.py
Source file with no class/function declarations — possible config, dead code, or scratch file.
low System graph quality Integrity conf 1.00 16 occurrences Near-duplicate function bodies in 2 places
Functions with the same first-5-line body hash: examples/mcpserver/readme-quickstart.py:sum, examples/snippets/servers/mcpserver_quickstart.py:add This is *the* AI-coder failure mode (4× more duplication in vibe-coded repos — see https://jw.hn/ai-code-hygiene). Consolidate or document why they're …
16 occurrences
repo-level (16 hits)
duplicatesduplication
low System graph quality Integrity conf 1.00 2 occurrences Near-duplicate function bodies in 3 places
Functions with the same first-5-line body hash: src/mcp/client/client.py:send_progress_notification, src/mcp/client/session.py:send_progress_notification, src/mcp/server/session.py:send_progress_notification This is *the* AI-coder failure mode (4× more duplication in vibe-coded repos — see https:/…
2 occurrences
repo-level (2 hits)
duplicatesduplication
low System graph quality Integrity conf 1.00 Near-duplicate function bodies in 4 places
Functions with the same first-5-line body hash: examples/servers/simple-resource/mcp_simple_resource/server.py:arun, examples/servers/simple-prompt/mcp_simple_prompt/server.py:arun, examples/servers/simple-pagination/mcp_simple_pagination/server.py:arun, examples/servers/simple-tool/mcp_simple_tool…
duplicatesduplication
low System graph quality Integrity conf 1.00 Near-duplicate function bodies in 5 places
Functions with the same first-5-line body hash: examples/servers/simple-task-interactive/mcp_simple_task_interactive/server.py:handle_list_tools, examples/servers/simple-task/mcp_simple_task/server.py:handle_list_tools, examples/servers/simple-streamablehttp-stateless/mcp_simple_streamablehttp_stat…
duplicatesduplication
low System graph quality Integrity conf 1.00 Old/deprecated-named symbol `DATA_EXPORT_v2` in tests/shared/test_tool_name_validation.py:23
Names with suffixes like `_old`, `_v1`, `_deprecated` usually indicate replaced-but-not-removed code (typical AI-coder leftover). Confirm and delete, or rename if it's the active version.
old markerDead code
low System graph quality Integrity conf 1.00 Old/deprecated-named symbol `select_color_legacy` in tests/server/mcpserver/test_elicitation.py:368
Names with suffixes like `_old`, `_v1`, `_deprecated` usually indicate replaced-but-not-removed code (typical AI-coder leftover). Confirm and delete, or rename if it's the active version.
old markerDead code
low System graph software Dead code conf 1.00 4 occurrences Possibly dead Python function: arun
No callers detected by AST scan in this repo. Could be exported for external callers or a framework handler.
4 files, 4 locations
examples/servers/simple-pagination/mcp_simple_pagination/server.py:170
examples/servers/simple-prompt/mcp_simple_prompt/server.py:92
examples/servers/simple-resource/mcp_simple_resource/server.py:85
examples/servers/simple-tool/mcp_simple_tool/server.py:74
low System graph software Dead code conf 1.00 8 occurrences Possibly dead Python function: handle_call_tool
No callers detected by AST scan in this repo. Could be exported for external callers or a framework handler.
8 files, 8 locations
examples/servers/simple-pagination/mcp_simple_pagination/server.py:90
examples/servers/simple-streamablehttp-stateless/mcp_simple_streamablehttp_stateless/server.py:44
examples/servers/simple-streamablehttp/mcp_simple_streamablehttp/server.py:47
examples/servers/simple-task-interactive/mcp_simple_task_interactive/server.py:105
examples/servers/simple-task/mcp_simple_task/server.py:26
examples/servers/simple-tool/mcp_simple_tool/server.py:42
examples/servers/sse-polling-demo/mcp_sse_polling_demo/server.py:60
examples/servers/structured-output-lowlevel/mcp_structured_output_lowlevel/__main__.py:48
low System graph software Dead code conf 1.00 Possibly dead Python function: handle_get_prompt
No callers detected by AST scan in this repo. Could be exported for external callers or a framework handler.
examples/servers/simple-prompt/mcp_simple_prompt/server.py:58
low System graph software Dead code conf 1.00 Possibly dead Python function: handle_get_prompt
No callers detected by AST scan in this repo. Could be exported for external callers or a framework handler.
examples/servers/simple-pagination/mcp_simple_pagination/server.py:124
low System graph software Dead code conf 1.00 3 occurrences Possibly dead Python function: handle_list_prompts
No callers detected by AST scan in this repo. Could be exported for external callers or a framework handler.
3 files, 3 locations
examples/servers/simple-pagination/mcp_simple_pagination/server.py:82
examples/servers/simple-prompt/mcp_simple_prompt/server.py:32
examples/snippets/servers/lowlevel/basic.py:12
low System graph software Dead code conf 1.00 3 occurrences Possibly dead Python function: handle_list_resources
No callers detected by AST scan in this repo. Could be exported for external callers or a framework handler.
3 files, 3 locations
examples/servers/simple-pagination/mcp_simple_pagination/server.py:73
examples/servers/simple-resource/mcp_simple_resource/server.py:24
examples/snippets/servers/pagination_example.py:10
low System graph software Dead code conf 1.00 Possibly dead Python function: handle_read_resource
No callers detected by AST scan in this repo. Could be exported for external callers or a framework handler.
examples/servers/simple-resource/mcp_simple_resource/server.py:41
low System graph software Dead code conf 1.00 Possibly dead Python function: handle_read_resource
No callers detected by AST scan in this repo. Could be exported for external callers or a framework handler.
examples/servers/simple-pagination/mcp_simple_pagination/server.py:106
low System graph software Dead code conf 1.00 Possibly dead Python function: handle_set_logging_level
No callers detected by AST scan in this repo. Could be exported for external callers or a framework handler.
examples/servers/everything-server/mcp_everything_server/server.py:400
low System graph software Dead code conf 1.00 Possibly dead Python function: handle_subscribe
No callers detected by AST scan in this repo. Could be exported for external callers or a framework handler.
examples/servers/everything-server/mcp_everything_server/server.py:406
low System graph software Dead code conf 1.00 Possibly dead Python function: handle_unsubscribe
No callers detected by AST scan in this repo. Could be exported for external callers or a framework handler.
examples/servers/everything-server/mcp_everything_server/server.py:413
low System graph software Dead code conf 1.00 Possibly dead Python function: init
No callers detected by AST scan in this repo. Could be exported for external callers or a framework handler.
examples/mcpserver/memory.py:75
low System graph quality Integrity conf 1.00 Stub function `_default_logging_callback` (body is just `pass`/`return`) — src/mcp/client/session.py:92
Likely an AI scaffold that was never filled in. Remove or implement.
Empty handlerDead code
low System graph quality Complexity conf 1.00 Very large file: src/mcp/types/_types.py (1778 lines)
Files with >800 lines often hide complexity hotspots and discourage tests.
low System graph quality Complexity conf 1.00 Very large file: tests/client/test_auth.py (2620 lines)
Files with >800 lines often hide complexity hotspots and discourage tests.
low System graph quality Complexity conf 1.00 Very large file: tests/interaction/_requirements.py (2816 lines)
Files with >800 lines often hide complexity hotspots and discourage tests.
low System graph quality Complexity conf 1.00 Very large file: tests/server/mcpserver/auth/test_auth_integration.py (1653 lines)
Files with >800 lines often hide complexity hotspots and discourage tests.
low System graph quality Complexity conf 1.00 Very large file: tests/server/mcpserver/test_server.py (1518 lines)
Files with >800 lines often hide complexity hotspots and discourage tests.
low System graph quality Complexity conf 1.00 Very large file: tests/shared/test_streamable_http.py (2320 lines)
Files with >800 lines often hide complexity hotspots and discourage tests.
For AI agents: Voting guide (TP/FP) MCP manifest Stdio wrapper SARIF Integrate Findings queue Vote TP/FP on findings to calibrate the engine.
For AI agents + API integrations
Email me when this repo regresses
Free. We re-scan periodically; new criticals → your inbox. No signup required for the scan itself.
API access

This page is publicly accessible at: https://repobility.com/scan/09a82e1c-3c7b-4e96-9fa0-263fa270bb5b/

To check status programmatically (no auth required):

curl -s https://repobility.com/api/v1/public/scan/09a82e1c-3c7b-4e96-9fa0-263fa270bb5b/

Important — please don't re-submit the same URL repeatedly. The submission endpoint is idempotent: re-submitting the same git URL returns this same scan_token, not a new one. To re-scan this repo, sign up free and use the dashboard.