<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Zakaria Mehbi</title>
    <description>The latest articles on DEV Community by Zakaria Mehbi (@zakariamehbi).</description>
    <link>https://dev.to/zakariamehbi</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F244614%2Fefbc0915-8f15-45f4-8474-d78af1ac62ff.jpeg</url>
      <title>DEV Community: Zakaria Mehbi</title>
      <link>https://dev.to/zakariamehbi</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/zakariamehbi"/>
    <language>en</language>
    <item>
      <title>How InkHammy checks grammar in every Mac app with the Accessibility API</title>
      <dc:creator>Zakaria Mehbi</dc:creator>
      <pubDate>Tue, 17 Nov 2026 12:51:02 +0000</pubDate>
      <link>https://dev.to/zakariamehbi/how-inkhammy-checks-grammar-in-every-mac-app-with-the-accessibility-api-5bc4</link>
      <guid>https://dev.to/zakariamehbi/how-inkhammy-checks-grammar-in-every-mac-app-with-the-accessibility-api-5bc4</guid>
      <description>&lt;p&gt;I'm Zak, and I build InkHammy, a grammar checker that runs as a Mac menu bar app and as an iPhone keyboard. Disclosure up front: InkHammy is my product. This post isn't a review; it's a write-up of how the Mac app reads and fixes text inside other apps through the macOS Accessibility API, and the design choices that came out of it.&lt;/p&gt;

&lt;h2&gt;
  
  
  The problem
&lt;/h2&gt;

&lt;p&gt;A browser extension only sees web pages. A lot of writing on a Mac happens somewhere else: Slack, Mail, Notes, Messages, the ChatGPT app, and text fields inside desktop apps built on web views. To check text in all of them, an app has to follow whichever field has focus, read its text, know where each word sits on screen, and write corrections back without breaking the host app.&lt;/p&gt;

&lt;p&gt;macOS exposes this through the Accessibility API (AX). The user grants Accessibility permission once in System Settings, and the app can then observe and act on UI elements in other processes. AX is powerful, but every host app implements it a little differently, and a call into a busy app can block. Most of InkHammy's Mac architecture exists to deal with those two facts.&lt;/p&gt;

&lt;h2&gt;
  
  
  Client and server have separate jobs
&lt;/h2&gt;

&lt;p&gt;The Mac client doesn't decide what is wrong with the text. All correction processing lives in the backend. The client detects the text being written, sends it with read-only context, and applies the ranges that come back only after re-checking that the text has not changed in the meantime.&lt;/p&gt;

&lt;p&gt;That split keeps the client's job mechanical: observe, send, draw, and write back when the user asks.&lt;/p&gt;

&lt;h2&gt;
  
  
  Following the focused field
&lt;/h2&gt;

&lt;p&gt;The core object on macOS is &lt;code&gt;FieldSessionCoordinator&lt;/code&gt;. It follows the focused field and coordinates four collaborators, each with one job:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;FieldObserver&lt;/code&gt; turns Accessibility notifications into polls. A notification is treated as a hint that something may have changed, not as the source of truth.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;FieldSessionMachine&lt;/code&gt; decides what each poll means, as a pure function: given the current state and what the poll read, it returns the next state and the action to take. With no side effects, it can be tested without driving a real app.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;AnalysisScheduler&lt;/code&gt; owns requests to the server and the cache, so the same text isn't checked twice and an old response can't overwrite a newer one.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;OverlayPresenter&lt;/code&gt; draws the badge, the underlines and the review card in an overlay above the host app.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Turning notifications into polls matters because notifications aren't consistent from one app to the next. A poll that reads the current state and hands it to a pure state machine behaves the same way no matter which path triggered it.&lt;/p&gt;

&lt;h2&gt;
  
  
  A hung app must not freeze InkHammy
&lt;/h2&gt;

&lt;p&gt;An AX call is a synchronous request to another process. If that process is stuck, the call waits. If those calls ran on the main thread, one frozen app would freeze InkHammy's menu bar and overlay along with it.&lt;/p&gt;

&lt;p&gt;So every Accessibility call runs on its own &lt;code&gt;AXActor&lt;/code&gt; queue. The rest of the app talks to that actor. If a host app stops responding, only the AX work waits; everything else keeps running.&lt;/p&gt;

&lt;h2&gt;
  
  
  Web fields are different
&lt;/h2&gt;

&lt;p&gt;Text fields inside browsers and web-view apps are web content exposed through AX, and they behave differently from native text views. InkHammy detects them from their &lt;code&gt;AXWebArea&lt;/code&gt;. Per-app behaviour lives in one place, &lt;code&gt;AppCompatibility&lt;/code&gt;: web field detection, a short list of verified exceptions, and each app's send key.&lt;/p&gt;

&lt;h2&gt;
  
  
  Writing a fix back
&lt;/h2&gt;

&lt;p&gt;Reading text is the easy half. Writing into another app's text field safely is where most of the care goes, and InkHammy never edits text on its own: a fix is applied only when the user asks for it, by &lt;code&gt;FieldWriter&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;FieldWriter&lt;/code&gt; applies fixes one range at a time, last range first. Working from the end of the text toward the start means applying one fix doesn't shift the offsets of the fixes that come before it. For each range it:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;selects the exact range,&lt;/li&gt;
&lt;li&gt;verifies the selection,&lt;/li&gt;
&lt;li&gt;sets the new text, or, where a host app ignores the setter, pastes over just that range,&lt;/li&gt;
&lt;li&gt;reads the text back to confirm the change landed,&lt;/li&gt;
&lt;li&gt;restores the caret.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The select, verify, set, read back sequence exists because an AX write can fail without an error. Reading back after every write is how the app knows a fix actually happened, instead of assuming it did.&lt;/p&gt;

&lt;h2&gt;
  
  
  The send guard
&lt;/h2&gt;

&lt;p&gt;InkHammy can also catch typos at the moment you press send in Slack, Messages or Mail. &lt;code&gt;KeyEventTap&lt;/code&gt;, a session event tap, owns the review card's keyboard shortcuts and the send guard, so those keys never leak into the host app. &lt;code&gt;SendGuardPolicy&lt;/code&gt; decides what happens with each send key press, using the send key &lt;code&gt;AppCompatibility&lt;/code&gt; records for that app.&lt;/p&gt;

&lt;h2&gt;
  
  
  From a model's output to safe ranges
&lt;/h2&gt;

&lt;p&gt;On the server, a fast check streams the corrected text from the model. The server diffs that text against the original and turns the differences into exact UTF-16 ranges, the unit both Swift's &lt;code&gt;NSString&lt;/code&gt; APIs and the Accessibility API use for text offsets. Before anything reaches the client, the ranges are validated: protected content such as URLs, numbers, code, quotes and emoji must not change. The server pushes each fix as soon as the model has written past it, then sends the full response.&lt;/p&gt;

&lt;p&gt;The client receives ranges, not a rewritten paragraph. That is what lets &lt;code&gt;FieldWriter&lt;/code&gt; touch only the words being fixed and leave the rest of the field, and the user's formatting, alone.&lt;/p&gt;

&lt;h2&gt;
  
  
  If you're building something similar
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Treat AX notifications as hints and re-read the state yourself.&lt;/li&gt;
&lt;li&gt;Put every AX call behind an actor or a dedicated queue, so a hung app can't take yours down.&lt;/li&gt;
&lt;li&gt;Verify every write by reading it back.&lt;/li&gt;
&lt;li&gt;Apply multiple edits from the end of the text toward the start.&lt;/li&gt;
&lt;li&gt;Keep the decision logic pure, so you can test it without real apps.&lt;/li&gt;
&lt;li&gt;Keep per-app quirks in one table instead of scattering special cases through the code.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you've worked with AX and found other patterns that hold up across apps, I'd like to hear them in the comments.&lt;/p&gt;

&lt;p&gt;If you want to try it in your own apps, InkHammy for Mac is here: &lt;a href="https://inkhammy.com/mac" rel="noopener noreferrer"&gt;https://inkhammy.com/mac&lt;/a&gt;&lt;/p&gt;

</description>
      <category>macos</category>
      <category>swift</category>
      <category>a11y</category>
      <category>productivity</category>
    </item>
    <item>
      <title>What I learned building a read-only bank MCP server for Claude and ChatGPT</title>
      <dc:creator>Zakaria Mehbi</dc:creator>
      <pubDate>Tue, 17 Nov 2026 02:28:48 +0000</pubDate>
      <link>https://dev.to/zakariamehbi/what-i-learned-building-a-read-only-bank-mcp-server-for-claude-and-chatgpt-4m3c</link>
      <guid>https://dev.to/zakariamehbi/what-i-learned-building-a-read-only-bank-mcp-server-for-claude-and-chatgpt-4m3c</guid>
      <description>&lt;p&gt;I wanted to ask my AI assistant one boring question: &lt;strong&gt;"where did my money go last month?"&lt;/strong&gt; Not a budget template, not a categorization chore. Just an answer, with the transactions behind it.&lt;/p&gt;

&lt;p&gt;So we built &lt;a href="https://sprout.mindcrafters.group/mcp?utm_source=devto" rel="noopener noreferrer"&gt;Sprout&lt;/a&gt;, a remote MCP server (plus iPhone, Mac and web apps) that connects US and Canadian bank and card accounts through Plaid, &lt;strong&gt;read-only&lt;/strong&gt;, and exposes them to Claude, ChatGPT, Cursor or any MCP client. Here is what mattered once real money data was involved.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Read-only is a product decision, not just a scope
&lt;/h2&gt;

&lt;p&gt;Every tool except one is read-only, and the one exception (&lt;code&gt;update_settings&lt;/code&gt;) only saves a default reporting period. There is no tool that can move money, pay a bill or cancel a subscription, so there is nothing for a prompt injection inside a transaction description to trigger. We also treat transaction text as &lt;strong&gt;data, never instructions&lt;/strong&gt;: merchant names come from banks and can contain anything.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Let the server do the math
&lt;/h2&gt;

&lt;p&gt;LLMs are bad at summing 400 transactions. Each tool returns computed figures, not raw rows to add up:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;get_cash_flow&lt;/code&gt; – income vs spending for a period&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;get_spending_breakdown&lt;/code&gt; – by category or merchant&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;get_period_totals&lt;/code&gt; / &lt;code&gt;compare_periods&lt;/code&gt; – trends and month-over-month&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;search_transactions&lt;/code&gt; – a specific charge or merchant&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;get_recurring_charges&lt;/code&gt; – subscriptions and bills&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;find_unusual_transactions&lt;/code&gt; – duplicates and outliers&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;list_accounts&lt;/code&gt;, &lt;code&gt;get_data_health&lt;/code&gt; – what is connected and how complete it is&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Two rules saved us from wrong answers: &lt;strong&gt;transfers between your own accounts are excluded&lt;/strong&gt; from spending, and &lt;strong&gt;USD and CAD are never summed together&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. "Missing data" is not "zero spending"
&lt;/h2&gt;

&lt;p&gt;If an account only synced 20 days, "you spent $0 on groceries in the first 10 days" is a lie. &lt;code&gt;get_data_health&lt;/code&gt; tells the model what is connected and how far back data goes, and every answer carries the date range it used, so the user can check it against their bank.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Tool descriptions are routing logic
&lt;/h2&gt;

&lt;p&gt;Most bad answers we saw were the model picking the wrong tool. Naming sibling tools inside each description ("for a single merchant use search_transactions instead") fixed more issues than any prompt change.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. OAuth in 2026: support CIMD &lt;em&gt;and&lt;/em&gt; dynamic client registration
&lt;/h2&gt;

&lt;p&gt;Claude and ChatGPT use Client ID Metadata Documents. Plenty of other clients (&lt;code&gt;mcp-remote&lt;/code&gt;, gateways, some IDE agents) still only do dynamic client registration. If your authorization server only advertises one, half the ecosystem silently can't sign in. Turn both on.&lt;/p&gt;

&lt;h2&gt;
  
  
  6. Distribution: publish to the official registry first
&lt;/h2&gt;

&lt;p&gt;We published &lt;code&gt;group.mindcrafters/sprout&lt;/code&gt; to the official MCP Registry with a DNS-verified namespace. Several directories ingest from it, so one publish seeded multiple listings.&lt;/p&gt;

&lt;h2&gt;
  
  
  Try it
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;MCP endpoint: &lt;code&gt;https://api-sprout.mindcrafters.group/mcp&lt;/code&gt; (OAuth, no API key)&lt;/li&gt;
&lt;li&gt;Plugin manifests (MIT): &lt;a href="https://github.com/MindCraftersGroup/sprout-claude-plugin" rel="noopener noreferrer"&gt;github.com/MindCraftersGroup/sprout-claude-plugin&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;iPhone/iPad/Mac: &lt;a href="https://apps.apple.com/app/id6803864427" rel="noopener noreferrer"&gt;App Store&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Ask it "compare my spending in October with September" and tell me what breaks. I'm especially curious which MCP clients still fail the OAuth handshake.&lt;/p&gt;

</description>
      <category>mcp</category>
      <category>ai</category>
      <category>fintech</category>
      <category>showdev</category>
    </item>
  </channel>
</rss>
