David Soria Parra
08042c3307
Merge pull request #181 from zzstoatzz/update-fastmcp-server-typing
...
satisfy `pyright` untyped decorators in `mcp.server.fastmcp.server`
2025-02-04 18:25:32 +00:00
David Soria Parra
08cfbe522a
fix: improve error handling and request cancellation for issue #88
2025-02-04 18:20:17 +00:00
zzstoatzz
ca060014bb
centralize type
2025-02-04 11:11:38 -06:00
zzstoatzz
00a44692e7
init
2025-02-04 11:11:38 -06:00
David Soria Parra
51e65c8310
Merge pull request #186 from modelcontextprotocol/fix/141-resource-templates
...
fix: standardize resource response format
2025-02-04 14:25:28 +00:00
David Soria Parra
827e494df4
feat: add request cancellation and in-flight request tracking
...
This commit adds support for request cancellation and tracking of
in-flight requests in the MCP protocol implementation. The key
architectural changes are:
1. Request Lifecycle Management:
- Added _in_flight dictionary to BaseSession to track active requests
- Requests are tracked from receipt until completion/cancellation
- Added proper cleanup via on_complete callback
2. Cancellation Support:
- Added CancelledNotification handling in _receive_loop
- Implemented cancel() method in RequestResponder
- Uses anyio.CancelScope for robust cancellation
- Sends error response on cancellation
3. Request Context:
- Added request_ctx ContextVar for request context
- Ensures proper cleanup after request handling
- Maintains request state throughout lifecycle
4. Error Handling:
- Improved error propagation for cancelled requests
- Added proper cleanup of cancelled requests
- Maintains consistency of in-flight tracking
This change enables clients to cancel long-running requests and
servers to properly clean up resources when requests are cancelled.
Github-Issue:#88
2025-02-03 20:50:05 +00:00
David Soria Parra
888bdd3c34
tests for issue 88
2025-02-03 14:03:41 +00:00
David Soria Parra
960b92355e
add uv.lock for simple-chatbot
2025-02-03 13:25:30 +00:00
David Soria Parra
a9ae38237d
check uv lockfile
2025-02-03 12:33:30 +00:00
David Soria Parra
ce06b6291d
chore: update uv.lock
2025-02-03 11:36:13 +00:00
David Soria Parra
0d3e02f6a2
fix: standardize resource response format
...
Github-Issue:#141
2025-02-03 11:33:32 +00:00
Jerome
444edf6760
Merge pull request #180 from modelcontextprotocol/jeremy/relax-pydantic
...
Relax pydantic, pydantic-settings, and uvicorn requirements
2025-01-31 07:07:59 +13:00
David Soria Parra
5e19c7cf73
Merge pull request #176 from sheffler/fixFirstProgressReport
...
progress_token is 0 on first tool-call and the return is taken mistakenly
2025-01-30 16:00:01 +00:00
jeremy
defd52b2d6
Fix comment about pydantic versioning
2025-01-30 10:21:03 -05:00
jeremy
0d48a4494f
relax pydantic, pydantic-settings, and uvicorn
2025-01-29 22:49:43 -05:00
Henry Mao
1395607583
Create Client websocket.py
2025-01-29 21:27:09 +08:00
David Soria Parra
53bfac0cc2
fix: make progress_token check E711 compat
2025-01-29 10:01:56 +00:00
David Soria Parra
44c0004e6c
Merge pull request #170 from modelcontextprotocol/fix/152-resource-mime-type
...
fix: respect resource mime type in responses
2025-01-28 18:12:39 +00:00
David Soria Parra
2dc5fbfa3d
fix: add test for #176
2025-01-28 11:19:13 +00:00
Thomas Sheffler
76325b7846
progress_token is 0 on first tool-call and the return is taken mistakenly
2025-01-27 19:04:20 -08:00
David Soria Parra
070e8412c0
refactor: standardize resource response format
...
Introduce ReadResourceContents type to properly handle MIME types in resource responses. Breaking change in FastMCP read_resource() return type.
Github-Issue:#152
2025-01-27 20:36:10 +00:00
David Soria Parra
f90cf6a2a5
docs: update read_resource examples to handle mime type
...
Update README examples to show proper handling of the new read_resource() return value
that includes mime type information.
Github-Issue:#152
2025-01-27 15:51:45 +00:00
David Soria Parra
8ff4b5e9d3
fix: respect resource mime type in responses
...
The server was ignoring mime types set on resources, defaulting to text/plain
for strings and application/octet-stream for bytes. Now properly preserves
the specified mime type in both FastMCP and low-level server implementations.
Note that this is breaks backwards compatibility as it changes the return
values of read_resource() on FastMCP. It is BC compatible on lowlevel since
it only extends the callback.
Github-Issue: #152
Reported-by: eiseleMichael
2025-01-27 15:51:44 +00:00
David Soria Parra
f10c2e3f1f
fix: add test to reproduce #152
2025-01-27 15:50:52 +00:00
David Soria Parra
978cfe3f92
more fixes
2025-01-27 15:49:59 +00:00
David Soria Parra
43a30c1d00
fix tests
2025-01-27 14:36:48 +00:00
David Soria Parra
91840fd9c0
Merge pull request #172 from sheffler/fixAsyncLog
...
async and await for send_log_message in fastmcp
2025-01-27 10:40:10 +00:00
Thomas Sheffler
7a64d8f9af
async and await for logging in fastmcp
2025-01-25 07:03:20 -08:00
David Soria Parra
57c3aa2f0d
docs: improve CLAUDE.md structure and clarity
2025-01-24 18:42:52 +00:00
David Soria Parra
d64b0679b8
Merge pull request #149 from cr7258/patch-1
...
fix: mcp install command with environment variables
2025-01-24 10:38:05 +00:00
David Soria Parra
5f537a0f69
Merge pull request #166 from modelcontextprotocol/davidsp/refactor
...
refactor: extract request and notification handling
2025-01-24 09:54:21 +00:00
David Soria Parra
ba25ad6921
Merge pull request #165 from modelcontextprotocol/davidsp/types-2024-11-05
...
feat: update types to 2024-11-05 schema
2025-01-24 09:53:40 +00:00
David Soria Parra
0a93799068
refactor: extract request and notification handling into separate methods
2025-01-24 09:52:20 +00:00
David Soria Parra
bd742272ab
fix: update types to reflext 2024-11-05 schema
2025-01-24 09:52:16 +00:00
David Soria Parra
c14ec2e0d7
fix typing issues
2025-01-23 13:27:25 +00:00
David Soria Parra
059e831b8d
Merge pull request #98 from 3choff/feature/simple-chatbot-example
...
Add example client to examples/clients folder
2025-01-23 13:27:10 +00:00
David Soria Parra
0cb3b26514
Merge pull request #157 from micpst/async-resources
...
feat: add async resources for FastMCP
2025-01-22 13:37:41 +00:00
David Soria Parra
73c62c5ccf
Merge pull request #158 from micpst/fix-logger-debug
...
fix: fastmcp debug logging
2025-01-20 11:56:12 +00:00
Michał Pstrąg
c184b7a8db
fix fastmcp logger debug
2025-01-18 19:59:51 +01:00
Michał Pstrąg
f5f19b2361
add support for async resources
2025-01-18 19:37:39 +01:00
Justin Spahr-Summers
4c71c6168f
Merge pull request #151 from modelcontextprotocol/merrill/tests-for-sse
...
add minimal tests for the SSE transport
2025-01-15 10:47:29 +00:00
Nick Merrill
d01d49ea6e
add timeout test
2025-01-14 12:10:41 -05:00
Nick Merrill
e798d20cbb
ruff
2025-01-14 11:56:44 -05:00
Nick Merrill
aa7869a62f
add type hints
2025-01-14 11:54:09 -05:00
Nick Merrill
3fa26a5a97
remove unused imports
2025-01-14 11:49:04 -05:00
Nick Merrill
07e721f63f
formatting
2025-01-14 11:47:41 -05:00
Nick Merrill
5097bb7ef8
revert unintended changes
2025-01-14 11:47:00 -05:00
Nick Merrill
7b35ab844a
run server in separate process
2025-01-14 11:44:03 -05:00
Nick Merrill
8d90a3afa3
attempt at server in process
2025-01-14 11:15:05 -05:00
Nick Merrill
7ab1fc71aa
attempt to get server to shut down
2025-01-14 11:01:43 -05:00