Commit Graph

37 Commits

Author SHA1 Message Date
Max Isbey 91a983fc4c chore: ignore ANN204 to allow __init__ without return type
Replaces mypy-init-return (which only exempts __init__ when args are
typed) with a blanket ANN204 ignore. Special methods have well-known
return types and pyright infers them correctly.
2026-03-24 23:12:43 +00:00
Max Isbey cfde91dacd chore: exempt tests from ANN, enable mypy-init-return
Align with ecosystem norms per review feedback:
- Add mypy-init-return = true to skip -> None on __init__ when args are typed
- Exempt tests/** from ANN rules (near-universal practice)
- Revert test file annotations and __init__-only changes

Shrinks diff from 149 to ~47 files, keeping the valuable src/ return
type annotations that close the pyright gap.
2026-03-24 23:04:34 +00:00
Max Isbey 8b7399c060 chore: use AsyncIterator for lifespan annotations, sync README snippets
- Switch AsyncGenerator[None, None] to AsyncIterator[None] in 4 example
  snippets to match codebase convention for @asynccontextmanager lifespans
- Regenerate README.v2.md to sync snippet changes from eb3d0d0
2026-03-24 23:04:34 +00:00
Max Isbey 5697d68e65 chore: enforce type annotations on all functions via ruff ANN rules
Enable the `ANN` (flake8-annotations) rule set to require return type
and argument annotations on all function definitions. Pyright strict
already enforces argument types but infers return types silently; this
closes the gap so every function has an explicit return annotation.

Configuration choices:
- `ANN401` (any-type) is ignored: `Any` is sometimes the right answer
  and pyright strict already catches genuine misuse.
- `allow-star-arg-any = true`: `*args: Any, **kwargs: Any` is a common
  valid pattern for pass-through wrappers.
- Per-file ignores for `test_func_metadata.py` and `test_server.py` where
  untyped parameters are intentional (testing schema inference on
  unannotated signatures).
- README code snippets (via pytest-examples) exempt — short doc
  examples shouldn't need full annotations.

Auto-fix added `-> None` or inferred return types to ~910 functions.
The remaining ~100 were annotated manually — mostly
`@asynccontextmanager` generators, pytest fixtures, and ASGI handlers
that Ruff couldn't infer.
2026-03-24 23:04:34 +00:00
Max Isbey 31a38b5078 fix: correct Context type parameters across examples and tests (#2256) 2026-03-09 16:52:56 +00:00
Max Isbey b9431d483f fix: prevent command injection in example URL opening (#2082) 2026-02-18 15:16:44 +00:00
Max Isbey 0a22a9dc33 refactor: replace lowlevel Server decorators with on_* constructor kwargs (#1985) 2026-02-12 15:55:54 +00:00
Marcelo Trylesinski 1a8c14a5b8 refactor: replace mcp.types as types to from mcp import types (#1986) 2026-02-03 16:42:29 +00:00
Marcelo Trylesinski 4fc49c62bd feat: add ClientRequestContext type alias for client-side handlers (#1989) 2026-02-03 17:37:38 +01:00
Marcelo Trylesinski b1f7eec3cd refactor: split RequestContext between server and client (#1987) 2026-02-03 14:35:07 +01:00
Marcelo Trylesinski 21822053df Support different transports in Client (#1972) 2026-01-30 12:11:27 +00:00
Marcelo Trylesinski acba5478a9 refactor: McpError renamed to MCPError and flatten parameters (#1956)
Co-authored-by: Max Isbey <224885523+maxisbey@users.noreply.github.com>
2026-01-26 14:37:44 +01:00
Marcelo Trylesinski 65c614e48e Rename FastMCP to MCPServer (#1951) 2026-01-25 14:45:52 +01:00
Marcelo Trylesinski f0ab53e194 Add meta to Client methods (#1923) 2026-01-22 14:50:39 +01:00
Felix Weinberger d41d0c0128 chore: add D212 lint rule to enforce Google-style docstrings (#1892) 2026-01-16 16:10:52 +00:00
Marcelo Trylesinski 8adb5bdce8 refactor: move transport-specific parameters from FastMCP constructor to run() (#1898)
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-16 15:16:20 +00:00
Marcelo Trylesinski e94b386a13 refactor: use snake case instead of camel case in types (#1894) 2026-01-16 15:51:27 +01:00
Felix Weinberger cfb2909631 fix: change Resource URI fields from AnyUrl to str (#1863) 2026-01-16 09:58:57 +01:00
Marcelo Trylesinski a3a4b8d11a Add streamable_http_client which accepts httpx.AsyncClient instead of httpx_client_factory (#1177)
Co-authored-by: Felix Weinberger <fweinberger@anthropic.com>
2025-12-10 16:39:00 +00:00
Tyler Mailman 72a34002aa fix: add lifespan context manager to StreamableHTTP mounting examples (#1669)
Co-authored-by: TheMailmans <tyler@example.com>
Co-authored-by: Marcelo Trylesinski <marcelotryle@gmail.com>
2025-12-03 22:08:21 +00:00
Felix Weinberger fa851d93a2 feat: backwards-compatible create_message overloads for SEP-1577 (#1713) 2025-12-02 13:17:45 +00:00
Chris Coutinho 02b7889929 Implement SEP-1036: URL mode elicitation for secure out-of-band interactions (#1580)
Co-authored-by: Felix Weinberger <3823880+felixweinberger@users.noreply.github.com>
Co-authored-by: Felix Weinberger <fweinberger@anthropic.com>
2025-11-25 11:00:21 +00:00
Olivier Chafik 71c475588f Implement SEP-1577 - Sampling With Tools (#1594)
Co-authored-by: Felix Weinberger <fweinberger@anthropic.com>
Co-authored-by: Claude <noreply@anthropic.com>
2025-11-22 23:58:14 -05:00
adam jones fcffa14b5b docs: Update examples to use stateless HTTP with JSON responses (#1499)
Main branch checks / checks (push) Failing after 0s
2025-11-20 15:06:37 +00:00
Brandon Shar 1200ba0082 Allow CallToolResult to be returned directly to support _meta field for OpenAI Apps (#1459)
Co-authored-by: Max Isbey <224885523+maxisbey@users.noreply.github.com>
2025-10-21 18:52:08 +00:00
Felix Weinberger de89457683 fix: send params as empty object for list methods without cursor (#1453) 2025-10-14 11:11:38 +01:00
Max Isbey 4fb975c6dc feat: add paginated list decorators for prompts, resources, and tools (#1286)
Co-authored-by: Claude <noreply@anthropic.com>
2025-09-23 14:58:06 +01:00
jess 1644b822b3 changes structured temperature to not deadly (#1328) 2025-08-31 23:09:49 +00:00
Felix Weinberger ff02c596a4 docs: clarify streamable_http_path configuration when mounting servers (#1172) 2025-08-21 14:15:37 +01:00
Marcelo Trylesinski c7671e470c Add pyright strict mode on the whole project (#1254) 2025-08-11 18:56:37 +01:00
Inna Harper 41184ba6c8 README - replace code snippets with examples -- auth examples (#1164) 2025-07-17 18:36:20 +01:00
Dagang Wei dd792977dd Docs: Update CallToolResult parsing in README (#812)
Co-authored-by: Felix Weinberger <fweinberger@anthropic.com>
2025-07-17 12:48:19 +01:00
Inna Harper e975d0550b README - replace code snippets with examples - streamable http (#1155) 2025-07-16 21:45:40 +01:00
Inna Harper 0b4ce00be2 README - replace code snippets with examples - add lowlevel to snippets (#1150) 2025-07-16 15:26:16 +01:00
Inna Harper a10fec7fa6 README - replace code snippets with examples - direct execution and display utilities (#1137) 2025-07-14 15:54:36 +01:00
Inna Harper 9bf5160eea README - replace code snippets with examples (#1136) 2025-07-14 13:57:47 +01:00
Inna Harper adf327164a Embed code snippets for README from executable examples (#1055) 2025-07-04 17:25:54 +01:00