tidewave 0.1.1 → 0.1.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 54751fab877a22eeffd2bd5179bebb1d566b92edf284fb34ffb2499a7ab04d15
4
- data.tar.gz: d00206e13b21d3e52e9331cf740cdca113fe574095d6a45444861c3f5c5ce140
3
+ metadata.gz: 8e88c68fa913f5012d8fa2b69353e4d2d290a36e4a2ebbc4194ccb220990ce75
4
+ data.tar.gz: f132fbe9a0c4d15f4f2f91773af9cbaebadfacbb98aac2d8a6ceeeccdb1903eb
5
5
  SHA512:
6
- metadata.gz: faff1feb577d5f467f58dbed4b3be691bdf160e991f30406d9812ec275575d448452460ffb0219603294a4021a7f7075bbcded1c5eef3c7bf68693e30a9ca107
7
- data.tar.gz: 987ac660e700738721fbd0e919f3d191b8a1a13af23c55a11b958f956aee638ec18326647a63b50099c5ada75885bf6ddcaba0f86577602c9437e074c5bc8857
6
+ metadata.gz: 37c5d8dfd49cb1fcb2d37302f0ea8ddf715262c6054405935fe3568741c50b65e26a2a6731dd64edb68791a2fd8bb58f20332a8119362c8949b18db8a1c82a07
7
+ data.tar.gz: 7bdd172eb19ef223ab972686d310f35a690331a5678467b22fb2d0bf70c401173784a47be2aa035e5bc704a602cb8e28ee7aaed1f6c18aff62ea743dd628a652
data/README.md CHANGED
@@ -29,6 +29,24 @@ Tidewave will now run on the same port as your regular Rails application.
29
29
  In particular, the MCP is located by default at http://localhost:3000/tidewave/mcp.
30
30
  [You must configure your editor and AI assistants accordingly](https://hexdocs.pm/tidewave/mcp.html).
31
31
 
32
+ ## Configuration
33
+
34
+ You may configure the `tidewave` using the following syntax:
35
+
36
+ ```ruby
37
+ config.tidewave.allowed_ips = [IPAddr.new("192.168.97.1")]
38
+ ```
39
+
40
+ The following options are available:
41
+
42
+ * `:allowed_origins`
43
+
44
+ * `:localhost_only`
45
+
46
+ * `:allowed_ips`
47
+
48
+ You can read more about this options in [FastMCP](https://github.com/yjacquin/fast_mcp) README.
49
+
32
50
  ## Considerations
33
51
 
34
52
  ### Production Environment
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Tidewave
4
+ class Configuration
5
+ attr_accessor :logger, :allowed_origins, :localhost_only, :allowed_ips
6
+
7
+ def initialize
8
+ @logger = Logger.new(STDOUT)
9
+ @allowed_origins = nil
10
+ @localhost_only = true
11
+ @allowed_ips = nil
12
+ end
13
+ end
14
+ end
@@ -4,13 +4,18 @@ require "fast_mcp"
4
4
  require "logger"
5
5
  require "fileutils"
6
6
  require "tidewave/tool_resolver"
7
+ require "tidewave/configuration"
7
8
 
8
9
  module Tidewave
9
10
  class Railtie < Rails::Railtie
11
+ config.tidewave = Tidewave::Configuration.new
12
+
10
13
  initializer "tidewave.setup_mcp" do |app|
11
14
  # Prevent MCP server from being mounted if Rails is not running in development mode
12
15
  raise "For security reasons, Tidewave is only supported in development mode" unless Rails.env.development?
13
16
 
17
+ config = app.config.tidewave
18
+
14
19
  # Set up MCP server with the host application
15
20
  FastMcp.mount_in_rails(
16
21
  app,
@@ -19,7 +24,10 @@ module Tidewave
19
24
  path_prefix: Tidewave::PATH_PREFIX,
20
25
  messages_route: Tidewave::MESSAGES_ROUTE,
21
26
  sse_route: Tidewave::SSE_ROUTE,
22
- logger: Logger.new(STDOUT)
27
+ logger: config.logger,
28
+ allowed_origins: config.allowed_origins,
29
+ localhost_only: config.localhost_only,
30
+ allowed_ips: config.allowed_ips
23
31
  ) do |server|
24
32
  app.config.before_initialize do
25
33
  # Register a custom middleware to register tools depending on `include_fs_tools` query parameter
@@ -1,8 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "rack"
4
+ require "json"
5
+ require "active_support/core_ext/class"
4
6
 
5
- gem_tools_path = File.expand_path("../../lib/tidewave/tools/**/*.rb", __dir__)
7
+ gem_tools_path = File.expand_path("tools/**/*.rb", __dir__)
6
8
  Dir[gem_tools_path].each { |f| require f }
7
9
 
8
10
  module Tidewave
@@ -2,8 +2,6 @@
2
2
 
3
3
  require "tidewave/file_tracker"
4
4
 
5
- # TODO: This tool is not yet implemented, it does not track the latest file read.
6
- # Also, it does not raise an error if the file contains the substring multiple times.
7
5
  class Tidewave::Tools::EditProjectFile < Tidewave::Tools::Base
8
6
  file_system_tool
9
7
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Tidewave
4
- VERSION = "0.1.1"
4
+ VERSION = "0.1.2"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tidewave
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yorick Jacquin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-05-01 00:00:00.000000000 Z
11
+ date: 2025-05-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 7.2.0
19
+ version: 7.1.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 7.2.0
26
+ version: 7.1.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: fast-mcp
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -63,6 +63,7 @@ files:
63
63
  - README.md
64
64
  - config/database.yml
65
65
  - lib/tidewave.rb
66
+ - lib/tidewave/configuration.rb
66
67
  - lib/tidewave/file_tracker.rb
67
68
  - lib/tidewave/railtie.rb
68
69
  - lib/tidewave/tool_resolver.rb