mcpeasy 0.1.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.claudeignore +0 -3
- data/.mcp.json +19 -1
- data/CHANGELOG.md +59 -0
- data/CLAUDE.md +19 -5
- data/README.md +19 -3
- data/lib/mcpeasy/cli.rb +62 -10
- data/lib/mcpeasy/config.rb +22 -1
- data/lib/mcpeasy/setup.rb +1 -0
- data/lib/mcpeasy/version.rb +1 -1
- data/lib/utilities/gcal/README.md +11 -3
- data/lib/utilities/gcal/cli.rb +110 -108
- data/lib/utilities/gcal/mcp.rb +463 -308
- data/lib/utilities/gcal/service.rb +312 -0
- data/lib/utilities/gdrive/README.md +3 -3
- data/lib/utilities/gdrive/cli.rb +98 -96
- data/lib/utilities/gdrive/mcp.rb +290 -288
- data/lib/utilities/gdrive/service.rb +293 -0
- data/lib/utilities/gmail/README.md +278 -0
- data/lib/utilities/gmail/cli.rb +264 -0
- data/lib/utilities/gmail/mcp.rb +846 -0
- data/lib/utilities/gmail/service.rb +547 -0
- data/lib/utilities/gmeet/cli.rb +131 -129
- data/lib/utilities/gmeet/mcp.rb +374 -372
- data/lib/utilities/gmeet/service.rb +411 -0
- data/lib/utilities/notion/README.md +287 -0
- data/lib/utilities/notion/cli.rb +245 -0
- data/lib/utilities/notion/mcp.rb +607 -0
- data/lib/utilities/notion/service.rb +327 -0
- data/lib/utilities/slack/README.md +3 -3
- data/lib/utilities/slack/cli.rb +69 -54
- data/lib/utilities/slack/mcp.rb +277 -226
- data/lib/utilities/slack/service.rb +134 -0
- data/mcpeasy.gemspec +6 -1
- metadata +87 -10
- data/env.template +0 -11
- data/lib/utilities/gcal/gcal_tool.rb +0 -308
- data/lib/utilities/gdrive/gdrive_tool.rb +0 -291
- data/lib/utilities/gmeet/gmeet_tool.rb +0 -407
- data/lib/utilities/slack/slack_tool.rb +0 -119
- data/logs/.keep +0 -0
@@ -1,119 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "bundler/setup"
|
4
|
-
require "slack-ruby-client"
|
5
|
-
require "mcpeasy/config"
|
6
|
-
|
7
|
-
class SlackTool
|
8
|
-
def initialize
|
9
|
-
ensure_env!
|
10
|
-
@client = Slack::Web::Client.new(
|
11
|
-
token: Mcpeasy::Config.slack_bot_token,
|
12
|
-
timeout: 10, # 10 second timeout
|
13
|
-
open_timeout: 5 # 5 second connection timeout
|
14
|
-
)
|
15
|
-
end
|
16
|
-
|
17
|
-
def post_message(channel:, text:, username: nil, thread_ts: nil)
|
18
|
-
# Clean up parameters
|
19
|
-
clean_channel = channel.to_s.sub(/^#/, "").strip
|
20
|
-
clean_text = text.to_s.strip
|
21
|
-
|
22
|
-
# Validate inputs
|
23
|
-
raise "Channel cannot be empty" if clean_channel.empty?
|
24
|
-
raise "Text cannot be empty" if clean_text.empty?
|
25
|
-
|
26
|
-
# Build request parameters
|
27
|
-
params = {
|
28
|
-
channel: clean_channel,
|
29
|
-
text: clean_text
|
30
|
-
}
|
31
|
-
params[:username] = username if username && !username.to_s.strip.empty?
|
32
|
-
params[:thread_ts] = thread_ts if thread_ts && !thread_ts.to_s.strip.empty?
|
33
|
-
|
34
|
-
# Retry logic for reliability
|
35
|
-
max_retries = 3
|
36
|
-
retry_count = 0
|
37
|
-
|
38
|
-
begin
|
39
|
-
response = @client.chat_postMessage(params)
|
40
|
-
|
41
|
-
if response["ok"]
|
42
|
-
response
|
43
|
-
else
|
44
|
-
raise "Failed to post message: #{response["error"]} (#{response.inspect})"
|
45
|
-
end
|
46
|
-
rescue Slack::Web::Api::Errors::TooManyRequestsError => e
|
47
|
-
retry_count += 1
|
48
|
-
if retry_count <= max_retries
|
49
|
-
sleep_time = e.retry_after || 1
|
50
|
-
sleep(sleep_time)
|
51
|
-
retry
|
52
|
-
else
|
53
|
-
raise "Slack API Error: #{e.message}"
|
54
|
-
end
|
55
|
-
rescue Slack::Web::Api::Errors::SlackError => e
|
56
|
-
retry_count += 1
|
57
|
-
if retry_count <= max_retries && retryable_error?(e)
|
58
|
-
sleep(0.5 * retry_count) # Exponential backoff
|
59
|
-
retry
|
60
|
-
else
|
61
|
-
raise "Slack API Error: #{e.message}"
|
62
|
-
end
|
63
|
-
rescue => e
|
64
|
-
Mcpeasy::Config.ensure_config_dirs
|
65
|
-
File.write(Mcpeasy::Config.log_file_path("slack", "error"), "#{Time.now}: SlackTool error: #{e.class}: #{e.message}\n#{e.backtrace.join("\n")}\n", mode: "a")
|
66
|
-
raise e
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
def list_channels
|
71
|
-
response = @client.conversations_list(types: "public_channel,private_channel")
|
72
|
-
|
73
|
-
if response["ok"]
|
74
|
-
response["channels"].to_a.map do |channel|
|
75
|
-
{
|
76
|
-
name: channel["name"],
|
77
|
-
id: channel["id"]
|
78
|
-
}
|
79
|
-
end
|
80
|
-
else
|
81
|
-
raise "Failed to list channels: #{response["error"]}"
|
82
|
-
end
|
83
|
-
rescue Slack::Web::Api::Errors::SlackError => e
|
84
|
-
raise "Slack API Error: #{e.message}"
|
85
|
-
end
|
86
|
-
|
87
|
-
def test_connection
|
88
|
-
response = @client.auth_test
|
89
|
-
|
90
|
-
if response["ok"]
|
91
|
-
response
|
92
|
-
else
|
93
|
-
raise "Authentication failed: #{response["error"]}"
|
94
|
-
end
|
95
|
-
rescue Slack::Web::Api::Errors::SlackError => e
|
96
|
-
raise "Slack API Error: #{e.message}"
|
97
|
-
end
|
98
|
-
|
99
|
-
def tool_definitions
|
100
|
-
end
|
101
|
-
|
102
|
-
private
|
103
|
-
|
104
|
-
def retryable_error?(error)
|
105
|
-
# Network-related errors that might be temporary
|
106
|
-
error.is_a?(Slack::Web::Api::Errors::TimeoutError) ||
|
107
|
-
error.is_a?(Slack::Web::Api::Errors::UnavailableError) ||
|
108
|
-
(error.respond_to?(:message) && error.message.include?("timeout"))
|
109
|
-
end
|
110
|
-
|
111
|
-
def ensure_env!
|
112
|
-
unless Mcpeasy::Config.slack_bot_token
|
113
|
-
raise <<~ERROR
|
114
|
-
Slack bot token is not configured!
|
115
|
-
Please run: mcp set slack_bot_token YOUR_TOKEN
|
116
|
-
ERROR
|
117
|
-
end
|
118
|
-
end
|
119
|
-
end
|
data/logs/.keep
DELETED
File without changes
|