-
Notifications
You must be signed in to change notification settings - Fork 5
AppleScript with Memory Integration
The Context Provider can be extended to support any MCP tool. Here's a real-world example of how we created context rules for [peakmojo/applescript-mcp](https://github.com/peakmojo/applescript-mcp) that integrates with the [MCP Memory Service](https://github.com/doobidoo/mcp-memory-service).
AppleScript MCP provides maximum flexibility by allowing execution of any AppleScript code. By adding context rules that integrate with memory, we created an intelligent script management system that:
- Searches for existing scripts before creating new ones
- Stores successful scripts for reuse
- Maintains consistency across sessions
- Reduces token usage
Create this file in your /contexts directory:
{
"tool_category": "applescript",
"description": "AppleScript execution context with memory integration for reusable script management",
"auto_convert": true,
"memory_integration": {
"workflow": {
"step1": "Search memory for existing scripts: search_by_tag(['applescript', '<app>', '<action>'])",
"step2": "Adapt found scripts or create new ones",
"step3": "Store successful scripts with rich metadata",
"step4": "Tag frequently used scripts as 'high-priority'"
},
"storage_pattern": {
"content": "The AppleScript code with PARAMETER placeholders",
"metadata": {
"tags": ["applescript", "app:<n>", "action:<type>", "category:<category>"],
"type": "applescript-template",
"description": "Clear description of functionality",
"parameters": ["list", "of", "replaceable", "parameters"]
}
},
"tag_taxonomy": {
"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"]
}
},
"common_patterns": {
"calendar_event": {
"template": "tell application \"Calendar\"\n tell calendar \"CALENDAR_NAME\"\n make new event with properties {summary:\"EVENT_TITLE\"}\n end tell\nend tell",
"parameters": ["CALENDAR_NAME", "EVENT_TITLE"]
}
},
"best_practices": {
"security": {
"no_hardcoded_passwords": true,
"validate_file_paths": true,
"check_permissions": true
}
},
"metadata": {
"version": "1.0.0",
"applies_to_tools": ["execute_applescript", "applescript:*", "memory:*"],
"dependencies": ["mcp-memory-service"]
}
}- On Claude Desktop startup: Context is loaded automatically
- When user requests Mac automation: Claude checks memory for existing scripts
- Scripts are reused and adapted: Reducing token usage and maintaining consistency
- New scripts are stored: Building a personal automation library
- Cross-session persistence: Context survives Claude Desktop restarts
- Intelligent automation: Scripts are reused rather than recreated
- Growing knowledge base: Library expands based on actual usage
- Token efficiency: Dramatic reduction in token usage for repeated tasks
-
Install both MCP servers:
-
Add the
applescript_context.jsonfile to your contexts directory -
Configure Claude Desktop to load both MCP servers
-
Restart Claude Desktop
User: "Create a calendar event for tomorrow at 2pm"
Claude:
1. Searches memory: search_by_tag(["applescript", "app:calendar", "action:create"])
2. Finds existing template
3. Adapts parameters for specific request
4. Executes via execute_applescript
5. Stores any new patterns discoveredThis pattern can be adapted for any MCP tool that would benefit from memory-based template management and persistent context rules!