Commit graph

42 commits

Author SHA1 Message Date
Mattt Zmuda
402904eab2
Bump version to 0.7.0 0.7.0 2025-04-03 05:33:06 -07:00
Mattt
7c84c20faf
Add Changelog section to README (#45) 2025-04-03 05:32:30 -07:00
Mattt
09da2a1c01
Rename Error to MCPError (#44)
* Rename Error to MCPError

* Conform MCPError to Swift.Error

* Use unqualified Error instead of Swift.Error

* Use unqualified MCPError instead of MCP.MCPError

* Rename file back to Error.swift

* Introduce top-level MCP namespace with nested Error typealias to provide deprecation notice for existing usage of MCP.Error

* Fix markup for MCP enum warning
2025-04-03 05:25:00 -07:00
Mattt
a9bcbf9ad9
Update transports to send and receive data instead of strings (#42)
* Update transports to send and receive data instead of strings

* Rename MockTransport helper methods

* Adopt Task.sleep(for:...) instead of variant taking nanoseconds

* Update comment

* Revert inadvertant change to visibility of send method
2025-04-03 04:42:56 -07:00
Mattt
de829ee648
Add configurable strict mode for MCP client initialization (#43)
* Add configurable strict mode for MCP client initialization

* Rename checkCapability to validateServerCapability
2025-04-03 04:33:50 -07:00
Mattt
5551f66d0e
Update README to reflect MIT License (#41) 2025-04-03 02:16:05 -07:00
Mattt Zmuda
3372a14a10
Bump version to 0.6.0 0.6.0
Update README
2025-03-31 10:24:53 -07:00
Mattt
daa7dad30a
Update platform requirements (#30)
* Relax platform requirements to macOS 13 and iOS 16

* Expand supported platforms
2025-03-31 10:22:39 -07:00
Adam Wulf
19857af5bf
Fix/decode tool call (#36)
* Adding unit test

* Decode entire request to strongly typed Method call. This allows NotRequired parameters to properly decode from null, which wouldn't be possible when decoding from the 'null' JSON encoding directly.
2025-03-31 05:34:33 -07:00
Mattt
d55140bc46
Import System package when available (#34)
* Import System package when available

* Add isResourceTemporarilyUnavailable helper method to reduce number of imports of System / SystemPackage
2025-03-31 05:30:45 -07:00
Adam Wulf
97b756c0f4
Add waitUntilComplete() method to Server (#26)
* Add waitUntilComplete() method to Server

* Update Sources/MCP/Server/Server.swift

Co-authored-by: Mattt <mattt@me.com>

---------

Co-authored-by: Mattt <mattt@me.com>
2025-03-29 04:26:16 -07:00
Mattt
8dfc9c7875
Transfer project to @modelcontextprotocol (#28)
* Update package URL to github.com/modelcontextprotocol/swift-sdk

* Remove link to iMCP

* Change to MIT License

* Apply suggestions from code review
2025-03-27 07:51:20 -07:00
Mattt
b5c9978922
Set permissions for CI workflow (#29) 2025-03-27 07:22:13 -07:00
Mattt Zmuda
ef647106b9
Bump version to 0.5.1 0.5.1 2025-03-19 05:42:19 -07:00
Adam Wulf
da97a3db3c
Add unit test to check that AnyRequest handles missing parameters (#24)
* Add unit test to check that AnyRequest handles missing parameters

* Conform Value to NotRequired

* Add test for decoding AnyRequest with empty parameters

---------

Co-authored-by: Mattt Zmuda <mattt@loopwork.com>
2025-03-19 05:41:50 -07:00
Mattt Zmuda
36a55a5b57
Bump version to 0.5.0 0.5.0 2025-03-18 10:02:29 -07:00
Mattt
75322c3baf
Ensure Request decoder handles missing/null params correctly (#22) 2025-03-18 10:02:05 -07:00
Mattt
2510dda70e
Add server initialization hook (#19) 2025-03-18 09:47:54 -07:00
Mattt
e0186b5ad5
Configure JSON encoding format options (#21) 2025-03-18 09:44:44 -07:00
Mattt Zmuda
c672358e7b
Bump version to 0.4.2 0.4.2 2025-03-17 05:42:51 -07:00
Mattt
59b6b755c0
Revert "Update capabilities to be expressible by Boolean literals (#16)" (#18)
This reverts commit 3e628db6d8.
2025-03-17 05:42:27 -07:00
Mattt Zmuda
eba4f62bd5
Bump version to 0.4.1 0.4.1 2025-03-17 05:27:22 -07:00
Mattt
6f1f65a392
Allow params field to be omitted in requests for methods that don't require them (#17)
* Allow `params` field to be omitted in requests for methods with empty parameters

* Add ping request to roundtrip test

* Generalize decoding of non-required parameters
2025-03-17 05:26:47 -07:00
Mattt
3e628db6d8
Update capabilities to be expressible by Boolean literals (#16)
* Conform Server.Capabilities types to ExpressibleByBooleanLiteral

* Conform Client.Capabilities types to ExpressibleByBooleanLiteral

* Use Boolean literatls for capabilities in tests

* Update README
2025-03-17 04:35:03 -07:00
Mattt Zmuda
4ed52bc2c3
Bump version to 0.4.0 0.4.0 2025-03-17 04:17:51 -07:00
Mattt
a2a0044abb
Remove nonstandard read and list capabilities for resources (#15)
* Remove nonstandard read and list capabilities for server

* Update README
2025-03-17 04:17:23 -07:00
Mattt Zmuda
dccaa3a411
Bump version to 0.3.2 0.3.2 2025-03-14 06:25:29 -07:00
Mattt
a62e51a61c
Make CallTool.Result.isError optional (#11) 2025-03-14 06:24:46 -07:00
Mattt Zmuda
154cf61040
Bump version to 0.3.1 0.3.1 2025-03-13 11:40:45 -07:00
Sash Zats
c63a872a69
Fix client parsing (#8)
* Allow decoding Decodable type directly from Value

Summary: I noticed we are not converting value associated with response to the strong types requests recorded
This change will help to decode the value type later once we support the rest of plumbing (next commit)

* Store and pass original request when response arrives

Summary: Looks like there were multiple issues with parsing response:
1. It appears that we would mistakenly pass response both for response and request arguments in the private func handleResponse(_ response: Response<AnyMethod>, for request: Any)
2. Later I couldn't figure out how to win against swift type system, so ended up creating a type-erased request to store in the pendingRequests instead of original type under Any (that wouldn't allow to downcast original type later)

Test Plan:

1. Standup iMCP client from https://github.com/loopwork-ai/iMCP
2. Create a dummy project setting up MCP client against "/private/var/folders/26/8gncz37x7slbfrr95d9jcr400000gn/T/AppTranslocation/62ADEC4D-3545-4E98-A612-0E6DF52CE525/d/iMCP.app/Contents/MacOS/imcp-server" and call initialize

Note response is being parsed correctly and client.initialize() does not hang indefinitely

* Fix warning: 'Cast from Client.AnyPendingRequest to unrelated type Client.PendingRequest<Any> always fails'

* Fix warning: 'Conditional cast from NWError to NWError always succeeds'

* Uncomment code in RoundtripTests

* Formatting

* Reorganize declarations

* Inline JSONDecoder extension

* Expand roundtrip tests

---------

Co-authored-by: Sash Zats sash@zats.io <>
Co-authored-by: Mattt Zmuda <mattt@loopwork.com>
2025-03-13 11:39:46 -07:00
Mattt
9ebe12559e
Add link to iMCP in README
Signed-off-by: Mattt <mattt@loopwork.com>
2025-03-06 06:51:34 -08:00
Mattt Zmuda
775425b140
Bump version to 0.3.0 0.3.0 2025-03-04 06:28:02 -08:00
Mattt
893614e241
Update server to always send response to invalid messages (#6) 2025-03-04 06:25:40 -08:00
Mattt
d0364a936a
Throw more specific networking errors in NetworkTransport (#5) 2025-03-04 06:18:44 -08:00
Mattt
b761d3ea6f
Properly propagate errors in NetworkTransport receive stream (#4)
Changes AsyncStream to AsyncThrowingStream to ensure network errors are correctly propagated to callers. Updates receive() to handle errors from the underlying message stream.
2025-03-04 06:05:41 -08:00
Mattt
1f5f8d64b9
Add configurable strict mode for MCP server initialization (#3)
Adds a Configuration struct to control server behavior around client initialization.
When strict mode is enabled, server enforces MCP spec requiring clients to initialize
before sending requests. Default mode is more permissive for non-compliant clients.
2025-03-04 06:02:43 -08:00
Mattt Zmuda
7619e5881c
Bump version to 0.2.0 0.2.0 2025-02-27 14:51:39 -08:00
Mattt
136762158e
Add NetworkTransport (#2) 2025-02-27 14:50:50 -08:00
Mattt
224707cdba
Add CI workflow (#1) 0.1.0
* Add CI workflow

* Setup Swift 6

* Set name for job
2025-02-11 15:26:39 -08:00
Mattt Zmuda
06d5e9a093
Temporarily comment out hanging test 2025-02-11 15:22:41 -08:00
Mattt Zmuda
be1e9583f8
Initial implementation 2025-02-11 15:22:35 -08:00
Mattt Zmuda
cc603d35fe
Initial commit 2025-02-05 11:13:57 -08:00