Skip to content

Securemcp core#3445

Closed
svkrishna wants to merge 3124 commits intoPrefectHQ:mainfrom
PureCipher:securemcp-core
Closed

Securemcp core#3445
svkrishna wants to merge 3124 commits intoPrefectHQ:mainfrom
PureCipher:securemcp-core

Conversation

@svkrishna
Copy link

Description

Contributors Checklist

  • My change closes #(issue number)
  • I have followed the repository's development workflow
  • I have tested my changes manually and by adding relevant tests
  • I have performed all required documentation updates

Review Checklist

  • I have self-reviewed my changes
  • My Pull Request is ready for review

jlowin and others added 30 commits February 1, 2026 18:30
Co-authored-by: Bill Easton <strawgate@users.noreply.github.com>
Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com>
…eneration (PrefectHQ#3048)

Co-authored-by: Bill Easton <strawgate@users.noreply.github.com>
Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com>
Mock network calls in CLI tests and use MemoryStore for OAuth tests
…ut errors (PrefectHQ#3067)

* Remove OpenAPI timeout param, make client optional, surface timeout errors

* Close auto-created httpx client via provider lifespan
Co-authored-by: marvin-context-protocol[bot] <225465937+marvin-context-protocol[bot]@users.noreply.github.com>
* Add `fastmcp generate-cli` command

Connects to any MCP server, reads its tool/resource/prompt schemas,
and writes a standalone Python CLI script with typed subcommands.

* docs: add generate-cli documentation

* docs: add generate-cli documentation; skip Windows executable test

* fix: address PR review feedback

- Sanitize tool and parameter names to valid Python identifiers
- Replace bare except Exception with specific exception types
- Escape server name in generated string literals
- Handle trailing colon edge case in _derive_server_name
- Clarify in docs that generated CLI is a client, not a bundled server

* Fix string escaping issues in generate-cli

- Use single-quoted docstrings to avoid triple-quote escaping issues
- Escape quotes in app_name derived from server_name
- Add tests for descriptions with quotes and server names with quotes

Addresses CodeRabbit review comments about insufficient escaping.

* Implement smart parameter handling for generate-cli

- Simple types (str, int, float, bool): Direct typed flags
- Arrays of simple types (list[str], list[int]): Repeatable flags via cyclopts
- Complex types (objects, nested arrays): Accept JSON strings with parsing
- JSON schema shown in help text for complex parameters
- Proper escaping of newlines and quotes in help text
- Filter out None and empty list defaults when calling tools

This gives typed, discoverable CLIs for common cases while handling
complex schemas via JSON input.

* Update generate-cli docs to explain smart parameter handling

- Document simple types as direct typed flags
- Document arrays of simple types as repeatable flags
- Document complex types as JSON strings with schema in help
- Add examples showing all three patterns

* Fix Codex review issues in generate-cli

High priority fixes:
- Complex type defaults: Serialize dict/list defaults to JSON strings
- List params: Preserve help metadata with Annotated wrapper
- Name collisions: Detect and error on sanitized name conflicts
- JSON parsing: Use isinstance check for safety with defaults

Added tests for:
- Complex types with default values
- Parameter name collision detection
- Updated existing tests to match new format

* Use pydantic_core.to_json for consistency

- Generator now uses pydantic_core.to_json() instead of json.dumps()
- Consistent with rest of fastmcp codebase
- Generated CLI still uses plain json module (standalone script)

* Move local imports to module level in generate-cli

* Handle union item types and Python keyword collisions in generate-cli
…s is supplied (PrefectHQ#3066)

* fix: enforce redirect URI validation when patterns are explicitly configured

Security fix: When allowed_redirect_uri_patterns is explicitly set, reject redirect URIs that don't match the patterns instead of falling back to parent validation. This prevents unauthorized OAuth clients from bypassing the allowlist and accessing protected resources.

* Update models.py

no need to return twice

* fix redirect uri access issue

* update style

* feat: add unit test to enforce fallback not applied when redirect uri's supplied

* fix: improve test case

* apply linter

* refactor: simplify logic and do not exposed allowed redirect patterns

---------

Co-authored-by: Nathan <2381793w@student.gla.ac.uk>
* Fix --reload port conflict by killing entire process group

* Gate start_new_session on Unix (no-op on Windows)
…efectHQ#2885)

* Add @handle_tool_errors decorator for standardized error handling

* Add tests for @handle_tool_errors decorator

* Add documentation for @handle_tool_errors decorator

* Fix type checking: use getattr for func.__name__ with fallback

* Add @overload declarations for proper async/sync type checking

* Fix type checking: reorder overloads and use Coroutine for async typing

* Update lockfile and fix test formatting

* Improve error_handling module: add docstrings, fix logging, handle cancellation, and update documentation

* Add auth error mappings, doc tweaks, and doc fix

* Pivot to hybrid approach

* Remove decorator, keep only core 429/timeout handling

---------

Co-authored-by: Jeremiah Lowin <153965+jlowin@users.noreply.github.com>
Co-authored-by: marvin-context-protocol[bot] <225465937+marvin-context-protocol[bot]@users.noreply.github.com>
…refectHQ#3088)

* Fix ty 0.0.15 type errors: use Omit/omit instead of NotGiven/NOT_GIVEN

🤖 Generated with Claude Code

https://claude.ai/code/session_01Fs5vHiWaUebe826pGq4eCN

* Use kwargs dict to avoid NotGiven/Omit sentinel type issues across SDK versions

🤖 Generated with Claude Code

https://claude.ai/code/session_01Fs5vHiWaUebe826pGq4eCN

* Bump ty minimum to 0.0.15

🤖 Generated with Claude Code

https://claude.ai/code/session_01Fs5vHiWaUebe826pGq4eCN

---------

Co-authored-by: Claude <noreply@anthropic.com>
…ompatibility (PrefectHQ#3102)

Changes:
- Changed default of prune_additional_properties from True to False in compress_schema
- Added test demonstrating MCP client compatibility requirement
- Updated existing tests to explicitly enable pruning when needed
- Added additionalProperties: false to manually constructed schemas in tool_transform
- Updated inline snapshots to reflect new behavior

Fixes PrefectHQ#3008

Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com>
Co-authored-by: Jeremiah Lowin <jlowin@users.noreply.github.com>
* Infer mime_type from OpenAPI response content types for resources

🤖 Generated with Claude Code

https://claude.ai/code/session_01FZD5ZT8WiQqfBu39ybuQis

* Handle media types without schemas in MIME inference

🤖 Generated with Claude Code

https://claude.ai/code/session_01FZD5ZT8WiQqfBu39ybuQis

---------

Co-authored-by: Claude <noreply@anthropic.com>
…3098)

* Harden CIMD redirect and cache handling

* Preserve CIMD cache policy on 304 revalidation

* Refresh 304 cache expiry from cached lifetime
jlowin and others added 27 commits March 6, 2026 17:31
…refectHQ#3411)

* Cap client auto-pagination pages

🤖 Generated with GPT-5.2-Codex

* Raise on pagination limit instead of returning partial data

Add max_pages kwarg (default 250) to list_tools/list_resources/
list_resource_templates/list_prompts so users can control the bound.
* Validate version metadata to reject non-scalar types (PrefectHQ#3422)

🤖 Generated with Claude Code

* Reject bool values in version coercion
…HQ#3406)

* Bind Cognito verifier audience to client ID

🤖 Generated with GPT-5.2-Codex

* Fix ty error: narrow return type of AWSCognitoProvider.get_token_verifier

🤖 Generated with Claude Code
…roxyClient (PrefectHQ#3408)

* Avoid reusing connected ProxyClient sessions

🤖 Generated with Codex

* Fix static analysis: ruff format + ty type narrowing
…Q#3417)

* Guard OAuth callback result overwrite 🤖 Generated with GPT-5.2-Codex

* Fix ruff formatting in test_oauth_callback_race.py

Co-authored-by: Jeremiah Lowin <jlowin@users.noreply.github.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Marvin Context Protocol <41898282+Marvin Context Protocol@users.noreply.github.com>
Co-authored-by: Jeremiah Lowin <jlowin@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
…tHQ#3419)

* Block HS* algorithms with JWKS in JWT verifier

🤖 Generated with GPT-5.2-Codex

* Fix ruff format: remove extra blank line in test_supabase.py

🤖 Generated with Claude Code

Co-authored-by: Jeremiah Lowin <jlowin@users.noreply.github.com>

---------

Co-authored-by: Marvin Context Protocol <41898282+Marvin Context Protocol@users.noreply.github.com>
Co-authored-by: Jeremiah Lowin <jlowin@users.noreply.github.com>
* Block BulkToolCaller self-invocation

🤖 Generated with GPT-5.2-Codex

* Fix ruff format violation in test_bulk_tool_caller.py

🤖 Generated with Claude Code
)

* Fix get_* returning None when latest version is disabled (PrefectHQ#3421)

When a visibility transform disabled the highest version of a component,
get_tool/get_resource/get_resource_template/get_prompt returned None
instead of falling back to the next-highest enabled version. The list_*
path already worked correctly because deduplication runs after visibility
filtering. The get_* path now falls back to listing all versions and
picking the highest enabled one when the top version is disabled.

* Apply auth checks in version fallback paths

The fallback code in get_tool, get_resource, get_resource_template, and
get_prompt bypassed auth filtering when falling back to older versions
after the highest version was disabled. This could expose auth-protected
older versions to unauthorized users.
* Fix server lifespan overlap teardown

🤖 Generated with GPT-5.2-Codex

* Clear lifespan state when non-owner session is last to exit
* Fix  output schema object detection

🤖 Generated with GPT-5.2-Codex

* Fix ty invalid-type-alias-type error

Co-authored-by: Jeremiah Lowin <jlowin@users.noreply.github.com>
🤖 Generated with Claude Code

* Fix $ref resolution to handle JSON Pointer escaping and nested paths

---------

Co-authored-by: Marvin Context Protocol <41898282+Marvin Context Protocol@users.noreply.github.com>
Co-authored-by: Jeremiah Lowin <jlowin@users.noreply.github.com>
…tations (PrefectHQ#3429)

* Preserve kw-only defaults in cloned adapters (🤖 GPT-5.2-Codex)

* Fix ruff format violation in test_types.py
…#3436)

* Redact sensitive headers in OpenAPI provider debug logging (PrefectHQ#3427)

* Use safe-header allowlist instead of sensitive-header denylist for redaction
…Q#3438)

* Fix async partial callables rejected by iscoroutinefunction (PrefectHQ#3423)

Add `is_coroutine_function()` utility that unwraps `functools.partial`
before checking, and guard `isroutine` checks so partials aren't
misrouted through `__call__`.

* Also check asyncio.iscoroutinefunction in is_coroutine_function
…3430)

* Block HS* JWT verification with public keys/JWKS

🤖 Generated with GPT-5.2-Codex

* Fix ruff format violations

🤖 Generated with Claude Code

* Handle bytes public_key in HS* algorithm PEM check
…ctHQ#3409)

* Sanitize untrusted CLI client output

🤖 Generated with GPT-5.2-Codex

* Fix ruff format violations
@marvin-context-protocol marvin-context-protocol bot added the invalid Issue lacks info, is off-topic, or doesn't make sense. Often LLM-generated spam. label Mar 8, 2026
@svkrishna svkrishna closed this Mar 8, 2026
@svkrishna svkrishna deleted the securemcp-core branch March 8, 2026 00:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

invalid Issue lacks info, is off-topic, or doesn't make sense. Often LLM-generated spam.

Projects

None yet

Development

Successfully merging this pull request may close these issues.