Commit graph python-sdk/src/mcp/client
Author SHA1 Message Date
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
Sarmad Qadri
e5ee279614
Fixes to stdio_client to support Windows more robustly (#372) 2025-03-27 09:14:56 +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)
Some checks failed
Main branch checks / checks (push) Has been cancelled
2025-03-21 11:43:08 +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
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)
Some checks failed
Main branch checks / checks (push) Has been cancelled
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)
Some checks failed
Main branch checks / checks (push) Has been cancelled
* 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
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
Henry Mao
ba184a2667
Ruff 2025-03-12 13:51:35 -07: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
Henry Mao
9d65e5ac03
Remove optional check 2025-03-07 22:02:16 +08:00
Henry Mao
fd826cc7a6
Fix Websocket Client and Add Test 2025-03-07 22:00:56 +08:00
Henry Mao
fc021eea76
Apply suggestions from code review
Co-authored-by: Marcelo Trylesinski <marcelotryle@gmail.com>
2025-03-06 20:12:51 +08:00
Henry Mao
f67c3ee6c0
Merge branch 'modelcontextprotocol:main' into patch-1 2025-03-06 13:24:01 +08:00
David Soria Parra
a50cf92d3a
fix: ruff format 2025-02-20 11:04:46 +00:00
Jerome
ff22f48365
Add client handling for sampling, list roots, ping (#218)
Adds sampling and list roots callbacks to the ClientSession, allowing the client to handle requests from the server.

Co-authored-by: TerminalMan <84923604+SecretiveShell@users.noreply.github.com>
Co-authored-by: David Soria Parra <davidsp@anthropic.com>
2025-02-20 10:49:43 +00:00
David Soria Parra
0d3e02f6a2
fix: standardize resource response format
Github-Issue:#141
2025-02-03 11:33:32 +00:00
Henry Mao
1395607583
Create Client websocket.py 2025-01-29 21:27:09 +08:00
TerminalMan
99727a97ae ruff format 2024-12-29 17:09:18 +00:00
TerminalMan
4f36581a5c add text encoding params to STDIO client 2024-12-29 16:41:30 +00:00
David Soria Parra
1d4a0d3589
ruff format 2024-12-12 17:01:00 +00:00
David Soria Parra
ef9b4cf6a2
Remove click dependency in client 2024-12-12 16:41:30 +00:00
David Soria Parra
1177a11910
Return a specific server session instance of request context
We currently return a generic instance of RequestContext without
a specialization on the Session type. This makes it impossible
for servers to typesafe call `list_roots()` and other methods.

We now return a specific instance of `RequestContext[ServerSession]`
2024-11-11 21:11:13 +00:00
David Soria Parra
ec8c85edea
run ruff 2024-11-11 20:42:46 +00:00
David Soria Parra
b9b44e6dad
Don't re-export types
We will be a bit more low level and expect callees to import mcp.types
instead of relying in re-exported types. This makes usage more explicit
and avoids potential collisions in mcp.server.
2024-11-11 20:39:33 +00:00
David Soria Parra
ed87ae9f06
rename mcp_python to mcp 2024-11-11 12:40:32 +00:00