-
-
Notifications
You must be signed in to change notification settings - Fork 102
AppleScript Integration with Memory
One powerful use case for the MCP Memory Service is creating a reusable script library for automation tools. Here's how we integrated it with peakmojo/applescript-mcp to build an intelligent AppleScript management system.
AppleScript MCP servers like peakmojo's offer maximum flexibility by allowing you to execute any AppleScript code. However, this means recreating scripts from scratch each time, consuming tokens and potentially leading to inconsistencies.
By combining the Memory Service with AppleScript MCP, we created a system that:
- Stores successful scripts with rich metadata and tags
- Searches existing scripts before creating new ones
- Adapts templates to new requirements
- Builds a personal script library over time
// Before creating a new script, search memory
await search_by_tag(["applescript", "app:calendar", "action:create"]);
// Store successful scripts with metadata
await store_memory({
content: `tell application "Calendar"
tell calendar "CALENDAR_NAME"
set startDate to date "START_DATE"
set endDate to date "END_DATE"
make new event with properties {summary:"EVENT_TITLE", start date:startDate, end date:endDate}
end tell
end tell`,
metadata: {
tags: ["applescript", "app:calendar", "action:create", "category:productivity"],
type: "applescript-template",
parameters: ["CALENDAR_NAME", "EVENT_TITLE", "START_DATE", "END_DATE"],
description: "Create a calendar event with title, start and end time",
example_usage: "Replace parameters with actual values"
}
});
We use a structured tagging system:
-
App tags:
app:calendar
,app:finder
,app:messages
,app:notes
-
Action tags:
action:create
,action:read
,action:update
,action:delete
-
Category tags:
category:productivity
,category:communication
,category:system
-
Feature tags:
feature:automation
,feature:notification
,feature:integration
- Token efficiency: Reuse scripts instead of recreating them
- Consistency: Same script patterns used across sessions
- Learning system: Library grows based on actual usage
- Best of both worlds: Flexibility of raw AppleScript with structure of pre-built tools
For persistent context across sessions, we also created an applescript_context.json
file for the MCP Context Provider that defines the workflow and best practices.
This approach can be adapted for any MCP tool that would benefit from memory-based template management!