Repository navigation
update to the fork source - #2
Merged
Merged
Conversation
The MCP SDK's NetworkTransport has reconnection logic that creates unstructured tasks holding CheckedContinuation references. For server-side incoming connections, this reconnection path can cause double-resume when connections are cancelled, crashing the app. Disable reconnection and heartbeats for server-accepted connections since they are client features — if a client disconnects, it should reconnect itself. Also make removeConnection idempotent to prevent stop() being called twice on the same connection. Co-authored-by: Claude Opus 4.6 (1M context) <[email protected]>
* Cancel the Bonjour browser on every discovery exit path imcp-server retries discovery in a loop, creating a new NWBrowser each time. The 30-second timeout path never cancelled the previous browser, so every timed-out attempt left a DNSServiceBrowse connection to mDNSResponder open. On a machine where the app wasn't running, that leaked one connection every ~35 seconds until the daemon ran out of descriptors and DNS failed for every process. Move discovery into BonjourDiscovery.discoverEndpoint, which cancels the browser in a defer, and share the file with the CLI test target so the behavior is covered by a test against a real NWBrowser. Also drop a module-level browser that was never started and a write-only property. Fixes #192. Fixes #174. * Use a valid absent service type and require the timeout error in the test
* Exempt connections awaiting approval from the setup timeout handleNewConnection races connection setup against a 10-second stall timer, but setup includes waiting for the user to answer the approval dialog. A first connection from a new client was therefore torn down before anyone could click Allow, which is why the first attempt always failed and the retry (now trusted) succeeded. Track connections whose setup is blocked on the approval handler and skip them in the timeout check. The handshake before the prompt is still covered, and a denied dialog still closes the connection. Fixes #193. * Pause the setup timer during approval and restart it afterwards A one-shot timer that merely skipped connections awaiting approval could still close a connection approved just before the deadline, and stopped enforcing anything once approval finished. Keep a timer per connection: cancel it when the approval handler starts, give the connection a fresh budget when approval returns, and clear it when setup ends.
…vents (#175) * Set @id on calendar events from EKEvent.eventIdentifier Without an identifier, Event values produced from EKEvent encoded as JSON-LD blank nodes. Two events with the same name/dates/calendar serialised to byte-identical objects, and downstream JSON-LD-aware consumers collapsed them into a single node. Symptom: events_fetch appeared to silently filter out duplicate-named events. Populate Event.identifier from EKEvent.eventIdentifier in both events_fetch and events_create so each event carries a stable @id, matching what Ontology already does for Person (CNContact.identifier) and ItemList (EKCalendar.calendarIdentifier). * Fix date-only inputs being misread as having a timezone suffix ISO8601DateFormatter.lenientDate(fromISO8601String:) ran a regex to decide whether the input already carried a timezone offset and thus should not be re-parsed in local time. The regex #"([Zz]|[+-]\\d{2}(:?\\d{2})?)$"# matches the trailing -DD of any bare yyyy-MM-dd date — "2026-06-15" looks like it ends with a -15 offset — so date-only inputs returned nil instead of falling through to the "yyyy-MM-dd" DateFormatter fallback. In events_fetch this manifested as a silent regression: when the caller passed e.g. start="2026-06-02", end="2026-06-15", parsing failed for both, hasStart/hasEnd stayed false, and the tool fell back to its 'now → now + 1 week' default range. The user saw events from the current week and assumed events past that point had been filtered out (in this case two same-name events where only the earlier one was in the default range). Gate the timezone-suffix check on dateString.count > 10 so it can't fire on a bare yyyy-MM-dd. The day component can no longer collide with the offset branch of the regex; date-only inputs now reach the "yyyy-MM-dd" fallback as intended.
Madrid 0.4.0 deprecated fetchMessages(with:in:limit:), and the project treats warnings as errors, so any bump past 0.1.0 failed the build at the call in Messages.swift. Move that call to fetch(_:) with an equivalent predicate, and pin 0.5.0, which reads the write-ahead log and exposes Message.chatID for the follow-up Messages PRs.
* Bump Madrid to 0.4.0 iMCP has been pinned to Madrid 0.1.0. Madrid has since shipped 0.2.0, 0.3.0, and 0.4.0. This bumps the pin to 0.4.0 with no behaviour change, so that later work can use APIs added in those releases (notably `Message.readAt` / `Message.isRead` from 0.3.0, for #154). The version requirement was already `upToNextMajorVersion` from 0.1.0, which 0.4.0 satisfies, so this is mechanically a re-resolve. The declared minimum is raised alongside the lockfile to keep the two in agreement. Source compatibility was verified by compiling iMCP's Madrid call sites (`Database()`, `Database(path:)`, `fetchParticipant(matching:)`, `fetchMessages(with:in:limit:)`, and the `Message` properties read in `messages_fetch`) against 0.4.0. They compile unchanged. Behaviour was checked against 0.1.0 for the two cases that could have differed, and matches in both: - With no participants, 0.1.0 skipped the participant condition. In 0.4.0 the deprecated `fetchMessages` shim likewise omits the predicate for an empty set, and `.and([])` compiles to an absent WHERE clause rather than a false one. - Message ordering was `ORDER BY m.date DESC` in 0.1.0, and the 0.4.0 default sort is `[.date(.descending), .id(.descending)]` — the same order, with an added tiebreak. Co-Authored-By: Claude Opus 5 <[email protected]> * Add read status to messages_fetch Closes #154. Adds an optional `isRead` filter to `messages_fetch`, and reports read status on every message it returns: - `isRead` (input, optional): if true, fetch read messages; if false, unread incoming; if omitted, fetch all. - `isRead` (output): present on every message. - `dateRead` (output): ISO 8601, omitted when the message is unread. The tri-state input mirrors `reminders_fetch`'s `completed` parameter rather than introducing a single-purpose `unreadOnly` flag, so the same parameter also expresses "only messages I have read". Filtering for unread excludes outgoing messages. Read receipts populate a read date on messages you sent, so without that guard "unread" would also report your own messages the recipient has not read yet. Read status is derived from Madrid's `Message.readAt`, which is the read timestamp `chat.db` records rather than a dedicated unread flag. A message marked read without a recorded timestamp therefore counts as unread, so this is a superset of genuinely-unread and may not match the Messages app badge exactly. Known limitation: `messages_fetch` fetches `max(limit, 1024)` candidates and filters them down to `limit`, so the filter only sees the most recent 1024 messages. A large *read* backlog can push unread messages outside that window. Filtering in SQL instead would remove the limitation, but Madrid has no read-status predicate to compose; mattt/Madrid#17 proposes one. The tool's schema would not change if the filtering later moves into the query. Co-Authored-By: Claude Opus 5 <[email protected]> --------- Co-authored-by: Claude Opus 5 <[email protected]> Co-authored-by: mattt <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.