* Add plumbing to set instructions on Server
* Use instructions description from MCP schema
---------
Co-authored-by: Peter Liddle <development.peter@liddle.network>
Co-authored-by: Mattt <mattt@me.com>
* adds listResourceTemplates to client for #124
* add pagination to resources/templates/list
from @mattt
Co-authored-by: Mattt <mattt@loopwork.com>
* adds cursor functionality to ListResourceTemplates
* updates the client method to use the updated signature
---------
Co-authored-by: Mattt <mattt@loopwork.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
* Expand README with more information about client and server usage
* Add discussion of initialize hook for server
* Add section about request batching
* Trim trailing whitespace
* Rename section to Request Batching
* Add example usage to HTTPClientTransport documentation comments
* Add documentation comments to NetworkTransport
* Improve documentation comments for StdioTransport
* 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
* support 405 response from servers that don’t support streaming
* Rephrase comment
---------
Co-authored-by: Stephen Tallent <stallent@mercury.io>
Co-authored-by: Mattt Zmuda <mattt@loopwork.com>
* 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>
* Update README with information about transports and platform availability
* Add footnote about WIP Alpine Linux and Windows support
* Move discussion of platform availability to separate section
* Add link from requirements to platform availability section
* 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