forked from radanskoric/coding_agent
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheck_mcp.rb
More file actions
executable file
·40 lines (35 loc) · 1.22 KB
/
check_mcp.rb
File metadata and controls
executable file
·40 lines (35 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/env ruby
# frozen_string_literal: true
# This script checks if the MCP server configuration is valid and can connect
Dir.chdir(__dir__) do
require 'bundler/setup'
require 'ruby_llm'
require 'ruby_llm/mcp'
require_relative 'src/mcp/client'
end
# NOTE: We're skipping the complex parameters support as it appears
# to have issues with the current version of the gem
puts 'Checking MCP configuration from mcp.json...'
mcp_client = MCP::Client.from_json_file
if mcp_client
puts '✅ MCP client connected successfully using mcp.json'
puts 'Available MCP tools:'
mcp_client.tools.each do |tool|
puts " - #{tool.name}: #{tool.description}"
end
else
puts '❌ Failed to connect to MCP server using mcp.json'
# Try from env as fallback
puts "\nTrying environment variables as fallback..."
mcp_client = MCP::Client.from_env
if mcp_client
puts '✅ MCP client connected successfully using environment variables'
puts 'Available MCP tools:'
mcp_client.tools.each do |tool|
puts " - #{tool.name}: #{tool.description}"
end
else
puts '❌ Failed to connect to MCP server using environment variables'
puts "\nPlease check your mcp.json configuration or environment variables."
end
end