Skip to content

enzoenrico/siri-shortcuts

v0.1.0MIT

Let Grok Bot list and run your Siri Shortcuts (App Intents) on your Mac, and ask that Grok Bot from Siri with an App Intents companion app.

Siri Grok Connector

Connects Siri and Grok in both directions:

  • Ask Grok from Siri. Say "Hey Siri, Ask Grok". Siri asks for your question, sends it to your Grok Bot, and speaks that bot's answer. This is an iOS App Intents app in ios/.
  • Let Grok Bot run your Siri Shortcuts. A Grok Bot plugin (Agent Plugin format) with an MCP server that lists and runs the shortcuts on your Mac. This is the repository root: plugin.json, mcp.json, skills/, mcp/.

No gateway token is stored in source. The iOS app keeps the token in the device Keychain, and the MCP server holds no token.

Ask Grok from Siri

Requirements: a Mac with Xcode 16 or later, iOS 17 or later, XcodeGen, and a Grok Bot you can reach from the iPhone. Ask Grok does not call the xAI chat API. It messages that bot through the gateway on the bot's computer (port 1340) and waits for the bot's reply.

  1. Generate the Xcode project:

    brew install xcodegen
    cd ios && xcodegen generate && open AskGrok.xcodeproj
    
  2. In the AskGrok target, under Signing & Capabilities, select your team and change the bundle ID from com.example.askgrok to one you own.

  3. On the Grok Bot computer, read the gateway token from /home/box/sand-data/gateway.json. Put that computer on your Tailscale network (or another private network the iPhone can reach) and note its address. Do not publish port 1340 on the public internet. The token is a password, and it changes when that computer restarts.

  4. Run the app on your iPhone. Paste the gateway token, the bot's name, and the gateway URL (for example http://100.x.x.x:1340). Open that bot in Grok Bot so it is running, then tap Ask Grok to test it.

  5. Say "Hey Siri, Ask Grok". Siri replies "What do you want to ask Grok Bot?". Speak your question and Siri reads the bot's answer.

The app registers the phrases "Ask Grok", "Ask Grok a question", and "Use Ask Grok". The Ask Grok action is also available in the Shortcuts app, so you can chain it with other actions.

The question is sent with a short instruction to answer in one to three spoken sentences. The bot that answers is the one you named, with its own memory and tools. If that bot is still working after about 45 seconds, Siri says so and the bot keeps going in the Grok Bot app.

Settings:

SettingDefaultNotes
Gateway tokenemptyBearer token from the bot computer's gateway.json. Stored in the Keychain.
Bot nameemptyThe Grok Bot's name, or its id.
Gateway URLhttp://127.0.0.1:1340Origin of the gateway. From the phone this is the computer's Tailscale address, port 1340.

Let Grok Bot run your Siri Shortcuts

Requirements: macOS 12 or later (for the shortcuts command) and Node.js 20 or later.

The MCP server exposes two tools:

  • list_shortcuts returns the names of your installed shortcuts.
  • run_shortcut runs a shortcut by name, passes optional text input, and returns its text output.

The siri-shortcuts skill tells the agent to list before it runs, and to confirm before a shortcut that sends messages, spends money, deletes data, or unlocks a door.

Agent on your Mac (stdio)

When the agent runs on the same Mac (for example the Cursor desktop app), install this repository as a plugin. mcp.json starts the server over stdio with node ${PLUGIN_ROOT}/mcp/server.mjs. To add it by hand instead, add this to your MCP config:

{
  "mcpServers": {
    "siri-shortcuts": { "command": "node", "args": ["/path/to/siri-grok-connector/mcp/server.mjs"] }
  }
}

Grok Bot in the cloud (Streamable HTTP)

Grok Bot runs on its own computer, so it cannot start a process on your Mac. Run the server in HTTP mode on the Mac and expose it over HTTPS:

export SIRI_MCP_TOKEN="$(openssl rand -hex 32)"
SIRI_MCP_PORT=8787 node mcp/server.mjs
cloudflared tunnel --url http://127.0.0.1:8787   # or: tailscale funnel 8787

Then add a custom MCP connector in Grok Bot with the tunnel URL plus /mcp, and the header Authorization: Bearer <SIRI_MCP_TOKEN>. The server binds to 127.0.0.1 unless you set SIRI_MCP_HOST, and rejects every request without the token.

Limit which shortcuts can run

Set a comma-separated allowlist. The server hides and refuses every other shortcut:

SIRI_SHORTCUTS_ALLOW="Add Reminder,Turn On Lights" node mcp/server.mjs

Environment variables

VariablePurpose
SIRI_MCP_PORTServe Streamable HTTP on this port instead of stdio.
SIRI_MCP_TOKENRequired bearer token in HTTP mode.
SIRI_MCP_HOSTHTTP bind address. Default 127.0.0.1.
SIRI_SHORTCUTS_ALLOWComma-separated shortcut allowlist.
SHORTCUTS_CLIPath to the shortcuts binary. Default /usr/bin/shortcuts. The tests use it to point at a fake.

Development

npm test                 # MCP server, end to end over stdio and HTTP, with a fake shortcuts CLI
cd ios && swift test     # GrokCore request, response, and error handling (runs on Linux too)

CI (.github/workflows/ci.yml) runs both suites on Linux and builds the iOS app on macOS with xcodebuild.

Layout:

  • mcp/handler.mjs owns the MCP JSON-RPC methods and the tool registry.
  • mcp/shortcuts.mjs wraps the macOS shortcuts CLI and the allowlist.
  • mcp/server.mjs owns the stdio and HTTP transports.
  • ios/Sources/GrokCore is the platform-independent Grok Bot gateway client.
  • ios/App is the iOS app: the App Intent, the Siri phrases, Keychain storage, and the settings screen.

Publish to the Grok Bot marketplace

Submit the public GitHub URL of this repository at x.ai/bot/marketplace/submit-a-plugin. For testing instructions, give reviewers the npm test command and the HTTP-mode steps above.

License

MIT