* feat: improvement to oauth resources resolution
* feat: improvements to refreshToken procedure and updates to unit tests
* feat: improvements to documentation of clien_id
* fix: review fixes of the latest changes
* fix: updated unit tests
* chore: more conformance compliance improvements
* chore: reverted protocol changes
* chore: more compliance improvements
* chore: more conformance compliance improvements
* chore: improvements to the backcompat and updated to Tool unit tests
* chore: ci update
* Support 2025-06-18 Spec (#167)
* Support OpenAI _meta for Tool
* Update init
* Add title and outputSchema
* Concurreny issue
* General fields
* Add Generate Fields to Server elements
* 4 tab spacing
* Update Version
* Elicitation
* Format
* More tests and inits
* Elicitation in README
* Fix orphaned test
* Add title to more structs
* Public init
* Fix meta validation and make tests more generic
* Format and make Result properties public again
* Revert more visibility changes
* feat: 2025-11-25 phase 1, includes Version, Icon, Progress (#181)
* chore: fixed unit tests
* feat: added icon and progess base structs
* feat: added progress notification and meta to callTool
* feat: added tests
* feat: simplified RequestMeta encoding/decoding
* tests: added unit test to track progress
* chore: rebased v0.11.x
* feat: implemented cancellation
* feat: added overloaded callTool method
* fix: encoding Response _meta fix
* chore: added old version to the versions list
* feat: 2025-11-25 phase 2; added Logging and Completions (#196)
* feat: added Logging and Completions
* feat: updated EmbeddedResource for the latest spec
* chore: changed encoding of meta in Prompts to encodeIfPresent
* feat: compliance tests + http server transport (#197)
* feat: http server transport
* feat: added http server transport
* feat: removed unused files
* feat: added conformance tests
* feat: improved conformace testing
* chore: removed redundant files
* feat/2025-11-25: sampling, elicitation, roots (#198)
* feat: Roots implementation
* feat: added unit testing
* feat: improved unit tests and fixed NetworkTransport crash
* feat: implemented sampling and elicitation
* feat: improved sampling tests
* feat: improved elicitation tests
* feat: improved confirmance tests
* feat: improved Prompts unit tests
* feat: removed test code
* feat: updated conformance tests
* chore: removed redundant commas
* chore: removed 6.0.3 swift version from ci
* chore: improved unit tests a little bit
* chore: update README.md
* chore: add server progress tracking example to README.md
* chore: updated README.md
* chore: updated transports table formatting
* chore: updated MockNetworkConnection
---------
Co-authored-by: Austin Evans <austinjevans@me.com>
Co-authored-by: yehorsobko <yehorsobko@macpaw.com>
* fix: allow description field to be absent from `Tool`
* description field is not a requried field of Tool
* Apply suggestions from code review
* Update Tests/MCPTests/ToolTests.swift
---------
Co-authored-by: Mattt <mattt@me.com>
* Add requestModifier property to HTTPClientTransport
Co-authored-by: Tim Wang <tim.wang@ing.com>
* Add test coverage
---------
Co-authored-by: Tim Wang <tim.wang@ing.com>
* Improve NetworkTransport and add test coverage
* Remove the weakTransport check since actors have special memory management rules
* Use Task.sleep(for:) consistently
* Always start connection in connect
* Run NetworkTransportTests serially
* Implement client version negotiation in server initialization
* Add test coverage for version negotiation
* Make Version.supported and Version.negotiate() APIs internal to not create new surface area
* Delay SSE GET connection until after session ID is established
- Add a signaling mechanism to ensure the SSE streaming task waits for the initial session ID to be set before attempting the GET connection.
- Use a TaskGroup to race between session ID signal and a 10-second timeout, logging the outcome.
- Trigger the signal when a session ID is received for the first time from any response.
- Add detailed logging for all code paths to aid debugging and clarify connection timing.
- Clean up signal resources on disconnect to prevent leaks.
This addresses the initialization timing issue where the SSE GET could be attempted before the session was established, as discussed in MCP PR #91.
* Update tests for SSE timing
* Use configurable timeout for acquiring session ID
* Remove Actor protocol conformance for HTTPClientTransport
* Configure shorter session ID timeout for tests
* Add documentation comments to HTTPClientTransport
* Rename sessionIDWaitTimeout to sseInitializationTimeout
* Add package dependency for github.com/loopwork-ai/EventSource
* Use EventSource for SSE implementation
* Refactor response stream and content type handling
Co-authored-by: Stephen Tallent <stallent@mercury.io>
* Conditionalize use of streaming for supported platforms
* Refactor conditional platform handling
* Conditionalize code and package dependency on Linux
---------
Co-authored-by: Stephen Tallent <stallent@mercury.io>
* Add test coverage for Client with HTTPClientTransport
* Configure HTTP client transport to stream by default
* Add example usage of streaming HTTP transport to README
* Explicitly set streaming to false in test
* Optimized code in `connectToEventStream` to use `.lines` computed value of `AsyncSequence` to produce a `AsyncLineSequence` instead of building a lines manually.
* - Reverter use of `lines` (it swallows newlines)
- Fiexed original issue I experienced with line 229 `while let newlineIndex = buffer.firstIndex(of: "\n") {` not handling "\r\n" properly
- Added unit test to test for "\r\n" scenario
- Simplified `end of event` test - `line` creation trims newline, added code trims carriage return. Only thing that should be left is an empty line
* Update AnyNotification to not wipe out params that come with a notification
* Add test coverage for notification with params
* Allow params to be omitted when empty
---------
Co-authored-by: Stephen Tallent <stallent@mercury.io>
Co-authored-by: Mattt Zmuda <mattt@loopwork.com>
* Rename file to Transport.swift
* Rename file to StdioTransportTests.swift
* Add .index-build/ to .gitignore
* Implement HTTP client transport
* Add test coverage for streamable HTTP client transport
* Conditionally import FoundationNetworking
* Conditionalize streaming for unsupported platforms
* Import FoundationNetworking in tests
* Add 5 minute timeout to CI jobs
* Remove debug logging
* Formatting
* Skip SSE tests on platforms that don't support streaming
* Update StdioTransport documentation comments to indicate support for JSON-RPC batches
* Add server support for JSON-RPC batching
* Add client support for JSON-RPC batching
* Fix bug that caused error messages to be wrapped unnecessarily
* Conditionally import Glibc on Linux for fcntl calls
* Extract transport implementations into separate files
* Fix warning in test
* Add ubuntu-latest to CI test matrix
* Switch to vapor/swiftly-action for setup step
* Configure Prettier extension to format GitHub Actions workflows
* Setup with different actions depending on platform
* Rename step
* Rename job
* Update README
* 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
* 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.
* 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>
* 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
* Conform Server.Capabilities types to ExpressibleByBooleanLiteral
* Conform Client.Capabilities types to ExpressibleByBooleanLiteral
* Use Boolean literatls for capabilities in tests
* Update README
* 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>