Commit Graph

177 Commits

Author SHA1 Message Date
ihrpr
3978c6e1b9 StreamableHttp -- resumability support for servers (#587) 2025-05-02 14:10:40 +01:00
ihrpr
9dfc925090 StreamableHttp client transport (#573) 2025-05-02 13:59:02 +01:00
ihrpr
46523afe30 StreamableHttp - GET request standalone SSE (#561) 2025-05-02 13:52:27 +01:00
ihrpr
72b66a58b1 StreamableHttp - stateless server support (#554) 2025-05-02 13:40:21 +01:00
ihrpr
78f0b11a09 StreamableHttp - Server transport with state management (#553) 2025-05-02 11:58:54 +01:00
Peter Raboud
2210c1be18 Add support for serverside oauth (#255)
Co-authored-by: David Soria Parra <davidsp@anthropic.com>
Co-authored-by: Basil Hosmer <basil@anthropic.com>
Co-authored-by: ihrpr <inna@anthropic.com>
2025-05-01 19:42:59 +01:00
bhosmer-ant
82bd8bc1d9 Properly clean up response streams in BaseSession (#515) 2025-05-01 14:45:47 +01:00
bhosmer-ant
1a330ac672 Add ToolAnnotations support in FastMCP and lowlevel servers (#482) 2025-04-30 14:52:56 +01:00
Guillaume Raille
96e5327110 add a timeout arguments on per-request basis (as per MCP specifications) (#601) 2025-04-29 13:58:48 +01:00
Samuel Colvin
697b6e8e05 replace inefficient use of to_jsonable_python (#545) 2025-04-26 20:41:19 +02:00
ihrpr
b4c7db6a50 Format files with ruff (#562) 2025-04-23 05:06:51 +01:00
Christian Clauss
babb477dff Python lint: Ruff rules for comprehensions and performance (#512) 2025-04-15 16:58:33 +02:00
Dan Lapid
8c9269c34b Move uvicorn import to usage (#502) 2025-04-15 16:51:02 +02:00
Mohamed Amine Zghal
70115b99b3 Fix tests for Pydantic 2.11 (#465) 2025-04-11 09:17:36 +02:00
Jerome
c4beb3e8ef Support custom client info throughout client APIs (#474)
Co-authored-by: Claude <noreply@anthropic.com>
2025-04-10 14:52:01 +01:00
Junpei Kawamoto
da54ea003e Allow generic parameters to be passed onto Context on FastMCP tools
Co-authored-by: Marcelo Trylesinski <marcelotryle@gmail.com>
2025-04-10 10:36:46 +01:00
David Soria Parra
d788424caa fix 2025-03-27 16:44:44 +00:00
Pol Avec
4e3c196941 Fixes incorrect casting into int for numbers in string format (#384) 2025-03-27 15:14:01 +00:00
evalstate
6d66ab8be0 Fix/base64 handling (Issue #342) (#343)
Co-authored-by: David Soria Parra <167242713+dsp-ant@users.noreply.github.com>
2025-03-27 09:18:02 +00:00
Sarmad Qadri
e5ee279614 Fixes to stdio_client to support Windows more robustly (#372) 2025-03-27 09:14:56 +00:00
David Soria Parra
9a2bb6a7e7 refactor: Make types.py strictly typechecked. (#336) 2025-03-26 14:21:35 +00:00
David Soria Parra
df2d3a57c2 Fix #355: Fix type error with lifespan context (#368)
Co-authored-by: Marcelo Trylesinski <marcelotryle@gmail.com>
2025-03-26 14:18:41 +00:00
Bar Nuri
fd2fd34357 default log level info (#366) 2025-03-25 09:50:15 +00:00
David Soria Parra
568cbd1a66 Fix #201: Move incoming message stream from BaseSession to ServerSession (#325)
Co-authored-by: Claude <noreply@anthropic.com>
2025-03-24 14:14:14 +00:00
Alex
9ae4df85fb Use default environment even when env is provided(#327) 2025-03-21 11:43:08 +00:00
elsejj
e2a7338730 enable custom path of sse server (#246)
Co-authored-by: David Soria Parra <167242713+dsp-ant@users.noreply.github.com>
2025-03-20 17:56:35 +00:00
Nino Risteski
04586f8f86 Update types.py (#243)
excluded prompts/get change
2025-03-20 17:53:36 +00:00
arthrod
e334f7e4b6 Update __init__.py (#335) 2025-03-20 17:20:40 +00:00
Tom Sheffler
c3fd34a1a6 Enhancement: make stderr of server subprocess configurable (#191)
* make stderr of server subprocess configurable

* Update stdio.py

---------

Co-authored-by: David Soria Parra <167242713+dsp-ant@users.noreply.github.com>
2025-03-20 16:28:57 +00:00
Marcelo Trylesinski
ae77772ea8 Add strict mode to pyright (#315)
* Add strict mode to pyright

* Apply UP rule

* fix readme

* More correct

* Leave wrong Context for now

* Add strict mode to pyright

* Apply UP rule

* fix readme

* fix

* ignore
2025-03-20 09:13:08 +00:00
Samuel Colvin
805fb469f5 add cwd to StdioServerParameters (#292) 2025-03-19 12:03:10 +00:00
ihrpr
08f4e01b8f add callback for logging message notification (#314) 2025-03-19 09:40:08 +00:00
comfuture
a9aca20205 Option to mount SSE server to existing ASGI server (#312)
* Option to mount SSE server to existing ASGI server

Fixes #311

Add option to mount SSE server to an existing ASGI server.

* Add a new method `sse_app` in `src/mcp/server/fastmcp/server.py` to return an instance of the SSE server app.
* Update the `run_sse_async` method in `src/mcp/server/fastmcp/server.py` to use the new `sse_app` method.
* Update the documentation in `README.md` to include instructions on how to mount the SSE server to an existing ASGI server.
* Fix the example in `README.md` to use `app.mount('/', mcp.sse_app())` instead.

---

For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/modelcontextprotocol/python-sdk/issues/311?shareId=XXXX-XXXX-XXXX-XXXX).

* Add `sse_app` method and update `run_sse_async` method in `server.py`

* Add `sse_app` method to return an instance of the SSE server app
* Update `run_sse_async` method to use the new `sse_app` method

Update `README.md` to include instructions for mounting SSE server

* Add section on mounting the SSE server to an existing ASGI server

* fix: Move import statements to the top of the file/

* docs: Update README to reflect changes in mounting SSE server with Starlette

* docs: Formatting of SSE server mounting example in README
2025-03-19 05:26:49 +01:00
Marcelo Trylesinski
6b6f34eaa6 Improve readability of CLI help option (#295) 2025-03-17 10:24:26 +00:00
Marcelo Trylesinski
c8978681f6 Avoid double JSON encoding/decoding (#287) 2025-03-14 15:08:11 +00:00
Marcelo Trylesinski
97201cce59 Strict types on the client side (#285) 2025-03-14 10:56:48 +00:00
Marcelo Trylesinski
7196604468 Revert "refactor: reorganize message handling for better type safety and clar…" (#282)
This reverts commit 9d0f2daddb.
2025-03-14 09:50:46 +00:00
David Soria Parra
9d0f2daddb refactor: reorganize message handling for better type safety and clarity (#239)
* refactor: improve typing with memory stream type aliases

Move memory stream type definitions to models.py and use them throughout
the codebase for better type safety and maintainability.

GitHub-Issue:#201

* refactor: move streams to ParsedMessage

* refactor: update test files to use ParsedMessage

Updates test files to work with the ParsedMessage stream type aliases
and fixes a line length issue in test_201_client_hangs_on_logging.py.

Github-Issue:#201

* refactor: rename ParsedMessage to MessageFrame for clarity

🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>

* refactor: move MessageFrame class to types.py for better code organization

🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>

* fix pyright

* refactor: update websocket client to use MessageFrame

Modified the websocket client to work with the new MessageFrame type,
preserving raw message text and properly extracting the root JSON-RPC
message when sending.

Github-Issue:#204

* fix: use NoneType instead of None for type parameters in MessageFrame

🤖 Generated with [Claude Code](https://claude.ai/code)

* refactor: rename root to message
2025-03-13 13:44:55 +00:00
Michaelzag
ad7f7a5473 Changed default log level to error (#258) 2025-03-13 13:16:21 +00:00
Mariusz Woloszyn
5c9f688d95 Add support for Linux configuration path in get_claude_config_path (#270)
* feat: add support for Linux configuration path in get_claude_config_path

* On Linux use XDG_CONFIG_HOME environment variable and fall back to $HOME/.config

* update Linux config path to include 'Claude' directory

* fix: format

---------

Co-authored-by: David Soria Parra <davidsp@anthropic.com>
2025-03-13 11:46:06 +00:00
Marcelo Trylesinski
94d326dbf1 Close unclosed resources in the whole project (#267)
* Close resources

* Close all resources

* Update pyproject.toml

* Close all resources

* Close all resources

* try now...

* try to ignore this

* try again

* try adding one more..

* try now

* try now

* revert ci changes
2025-03-13 10:59:45 +00:00
Jerome
1691b905e2 Merge pull request #179 from smithery-ai/patch-1
Create Client websocket.py
2025-03-12 22:53:22 +00:00
Henry Mao
ba184a2667 Ruff 2025-03-12 13:51:35 -07:00
Marcelo Trylesinski
e756315dea Add ServerSessionT type var to Context (#271)
* Add ServerSessionT type var to Context

* Passing locally

* Try now
2025-03-12 15:35:15 +00:00
David Soria Parra
78fc5c12c0 fix: fix ci 2025-03-12 14:22:30 +00:00
Jerome
d51726a9e8 Merge branch 'main' into patch-1 2025-03-12 09:31:56 +00:00
Marcelo Trylesinski
3e0ab1e7ee Drop AbstractAsyncContextManager for proper type hints (#257) 2025-03-11 13:17:15 +00:00
Marcelo Trylesinski
5cbea24ecb Use proper generic for Context (#245) 2025-03-11 13:15:07 +00:00
Henry Mao
dec28830b9 Remove try except 2025-03-08 10:53:56 +08:00
Henry Mao
ea8a2dbd6d Reraise exception and make websocket optional 2025-03-08 10:52:10 +08:00