Commit Graph

58 Commits

Author SHA1 Message Date
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
David Soria Parra
2dc5fbfa3d fix: add test for #176 2025-01-28 11:19:13 +00: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
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
Michał Pstrąg
f5f19b2361 add support for async resources 2025-01-18 19:37:39 +01: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
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
Nick Merrill
8f81a85abe all tests passing with custom port, but not passing all together 2025-01-14 10:45:55 -05:00
Nick Merrill
e79a56435a passing SSE client test 2025-01-14 10:34:32 -05:00
Nick Merrill
66ccd1c515 test_sse_connection is passing 2025-01-14 10:18:27 -05:00
Nick Merrill
a0e2f7fab7 WIP 2025-01-14 09:38:06 -05:00
Nick Merrill
3f9f7c8311 WIP 2025-01-14 09:27:42 -05:00
Nick Merrill
b0a6aafaf6 WIP 2025-01-14 09:24:44 -05:00
Nick Merrill
f164291483 trying to test SSE 2025-01-14 09:22:05 -05:00
Salman Mohammed
bc6746e89b Add instructions field to ServerSession and FastMCP 2025-01-13 13:00:11 -05:00
Salman Mohammed
135191403a Add instructions field to InitializeResult 2025-01-13 11:58:43 -05:00
David Soria Parra
4770bcd0b1 fix: #129 resource template handling in FastMCP server 2025-01-06 20:02:03 +00:00
David Soria Parra
b66c6759c3 feat: add example and test for parameter descriptions in FastMCP tools 2025-01-06 12:30:44 +00:00
David Soria Parra
e21e8c157d style: Fix import sorting and update ruff version 2025-01-03 15:57:14 +00:00
David Soria Parra
329f595f5f fix: Fix line length in test_server.py 2025-01-03 15:53:19 +00:00
David Soria Parra
2d8f08d648 fix: Address formatting and type checking issues 2025-01-03 15:23:58 +00:00
David Soria Parra
79ec8dccdb test: Add test for unlimited tool listing (issue #100) 2025-01-03 15:20:43 +00:00
David Soria Parra
43796bfa24 test: Add test for non-ASCII character handling in FastMCP tools 2025-01-03 15:20:43 +00:00
David Soria Parra
73c055f136 fix: Update AnyIO stream creation to use type annotation syntax 2025-01-02 16:59:26 +00:00
samefarrar
6194d06f6c test: Add test that uv command inserted into config can run "with --help" 2024-12-29 14:57:34 +00:00
David Soria Parra
44e1abb7f1 fix tests 2024-12-21 01:17:59 +00:00
David Soria Parra
680afeeed6 fix pydantic version 2024-12-21 01:04:30 +00:00
David Soria Parra
0b09fa5944 fix type issues 2024-12-21 00:46:37 +00:00
David Soria Parra
a79f51f55f style: Fix imports and line length formatting 2024-12-21 00:46:36 +00:00
David Soria Parra
15cd7df87f refactor: Update FastMCP examples to use new import path
Update all FastMCP examples to use mcp.server.fastmcp instead of fastmcp.
Add tests to verify example servers work correctly.

Changes:
- Update import paths in all example files
- Create test_examples.py to verify functionality
- Fix test assertions to match actual response format
2024-12-21 00:41:39 +00:00
David Soria Parra
fe75f43ee6 fix: Update test to match Pydantic's JSON schema output for model references with defaults
Pydantic now uses allOf to combine model references with default values in JSON schema output.
2024-12-21 00:41:39 +00:00
David Soria Parra
557e90d2e7 Integrate FastMCP
This commit integrates FastMCP, a high-level MCP server implementation originally written by Jeremiah Lowin,
into the official MCP SDK. It also updates dependencies and adds new dev dependencies.
It moves the existing SDK into a .lowlevel .
2024-12-21 00:41:38 +00:00
David Soria Parra
ec8c85edea run ruff 2024-11-11 20:42:46 +00:00
David Soria Parra
f5d82bd229 Remove helper types
The helper types in mcp.server.types got really confusioning during
implementation as they overlapped with mcp.types. I now believe it
is better if we stay more low level to the spec types.

To do this, we now only use mcp.types everywhere. We renamed mcp.server.types
to mcp.server.models and removed it to the absolute minimum.
2024-11-11 20:05:51 +00:00
David Soria Parra
ed87ae9f06 rename mcp_python to mcp 2024-11-11 12:40:32 +00:00
David Soria Parra
5497da0afd feat: add structured capability types
Replace generic capability dictionaries with structured types for prompts,
resources, tools, and roots. This improves type safety and makes capability
features like listChanged and subscribe more explicit in the protocol.
2024-11-07 14:49:40 +00:00
Justin Spahr-Summers
c7d8f11e0c Formatting 2024-11-06 12:35:32 +00:00