This commit is contained in:
@@ -6,20 +6,27 @@
|
||||
|
||||
set -e
|
||||
|
||||
CALLER_PWD="${PWD}"
|
||||
WORKSPACE_DIR="${MCP_WORKSPACE_DIR:-$CALLER_PWD}"
|
||||
|
||||
export PATH="$HOME/.asdf/shims:$PATH"
|
||||
|
||||
# Change to the project directory
|
||||
cd "$(dirname "$0")/.."
|
||||
export MCP_WORKSPACE_DIR="$WORKSPACE_DIR"
|
||||
|
||||
# Set environment
|
||||
export MIX_ENV="${MIX_ENV:-dev}"
|
||||
export NATS_HOST="${NATS_HOST:-localhost}"
|
||||
export NATS_PORT="${NATS_PORT:-4222}"
|
||||
|
||||
# Log startup
|
||||
# Log startup with workspace information
|
||||
echo "Starting AgentCoordinator Unified MCP Server..." >&2
|
||||
echo "Environment: $MIX_ENV" >&2
|
||||
echo "NATS: $NATS_HOST:$NATS_PORT" >&2
|
||||
echo "Caller PWD: $CALLER_PWD" >&2
|
||||
echo "Workspace Directory: $WORKSPACE_DIR" >&2
|
||||
echo "Agent Coordinator Directory: $(pwd)" >&2
|
||||
|
||||
# Start the Elixir application with unified MCP server
|
||||
exec mix run --no-halt -e "
|
||||
|
||||
@@ -10,10 +10,14 @@
|
||||
|
||||
set -e
|
||||
|
||||
CALLER_PWD="${PWD}"
|
||||
WORKSPACE_DIR="${MCP_WORKSPACE_DIR:-$CALLER_PWD}"
|
||||
|
||||
export PATH="$HOME/.asdf/shims:$PATH"
|
||||
|
||||
# Change to the project directory
|
||||
cd "$(dirname "$0")/.."
|
||||
export MCP_WORKSPACE_DIR="$WORKSPACE_DIR"
|
||||
|
||||
# Parse command line arguments
|
||||
INTERFACE_MODE="${1:-stdio}"
|
||||
|
||||
@@ -1,73 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Ultra-minimal test that doesn't start the full application
|
||||
|
||||
echo "🔬 Ultra-Minimal AgentCoordinator Test"
|
||||
echo "======================================"
|
||||
|
||||
cd "$(dirname "$0")"
|
||||
|
||||
echo "📋 Testing compilation..."
|
||||
if mix compile >/dev/null 2>&1; then
|
||||
echo "✅ Compilation successful"
|
||||
else
|
||||
echo "❌ Compilation failed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "📋 Testing MCP server without application startup..."
|
||||
if timeout 10 mix run --no-start -e "
|
||||
# Load compiled modules without starting application
|
||||
Code.ensure_loaded(AgentCoordinator.MCPServer)
|
||||
|
||||
# Test MCP server directly
|
||||
try do
|
||||
# Start just the required processes manually
|
||||
{:ok, _} = Registry.start_link(keys: :unique, name: AgentCoordinator.InboxRegistry)
|
||||
{:ok, _} = Phoenix.PubSub.start_link(name: AgentCoordinator.PubSub)
|
||||
|
||||
# Start TaskRegistry without NATS
|
||||
{:ok, _} = GenServer.start_link(AgentCoordinator.TaskRegistry, [nats: nil], name: AgentCoordinator.TaskRegistry)
|
||||
|
||||
# Start MCP server
|
||||
{:ok, _} = GenServer.start_link(AgentCoordinator.MCPServer, %{}, name: AgentCoordinator.MCPServer)
|
||||
|
||||
IO.puts('✅ Core components started')
|
||||
|
||||
# Test MCP functionality
|
||||
response = AgentCoordinator.MCPServer.handle_mcp_request(%{
|
||||
\"jsonrpc\" => \"2.0\",
|
||||
\"id\" => 1,
|
||||
\"method\" => \"tools/list\"
|
||||
})
|
||||
|
||||
case response do
|
||||
%{\"result\" => %{\"tools\" => tools}} when is_list(tools) ->
|
||||
IO.puts(\"✅ MCP server working (#{length(tools)} tools)\")
|
||||
_ ->
|
||||
IO.puts(\"❌ MCP server not working: #{inspect(response)}\")
|
||||
end
|
||||
|
||||
rescue
|
||||
e ->
|
||||
IO.puts(\"❌ Error: #{inspect(e)}\")
|
||||
end
|
||||
|
||||
System.halt(0)
|
||||
"; then
|
||||
echo "✅ Minimal test passed!"
|
||||
else
|
||||
echo "❌ Minimal test failed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "🎉 Core MCP functionality works!"
|
||||
echo ""
|
||||
echo "📝 The hanging issue was due to NATS persistence trying to connect."
|
||||
echo " Your MCP server core functionality is working perfectly."
|
||||
echo ""
|
||||
echo "🚀 To run with proper NATS setup:"
|
||||
echo " 1. Make sure NATS server is running: sudo systemctl start nats"
|
||||
echo " 2. Or run: nats-server -js -p 4222 -m 8222 &"
|
||||
echo " 3. Then use: ../scripts/mcp_launcher.sh"
|
||||
@@ -1,54 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Quick test script to verify Agentecho "💡 Next steps:"
|
||||
echo " 1. Run scripts/setup.sh to configure VS Code integration"
|
||||
echo " 2. Or test manually with: scripts/mcp_launcher.sh"rdinator works without getting stuck
|
||||
|
||||
echo "🧪 Quick AgentCoordinator Test"
|
||||
echo "=============================="
|
||||
|
||||
cd "$(dirname "$0")"
|
||||
|
||||
echo "📋 Testing basic compilation..."
|
||||
if mix compile --force >/dev/null 2>&1; then
|
||||
echo "✅ Compilation successful"
|
||||
else
|
||||
echo "❌ Compilation failed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "📋 Testing application startup (without persistence)..."
|
||||
if timeout 10 mix run -e "
|
||||
Application.put_env(:agent_coordinator, :enable_persistence, false)
|
||||
{:ok, _apps} = Application.ensure_all_started(:agent_coordinator)
|
||||
IO.puts('✅ Application started successfully')
|
||||
|
||||
# Quick MCP server test
|
||||
response = AgentCoordinator.MCPServer.handle_mcp_request(%{
|
||||
\"jsonrpc\" => \"2.0\",
|
||||
\"id\" => 1,
|
||||
\"method\" => \"tools/list\"
|
||||
})
|
||||
|
||||
case response do
|
||||
%{\"result\" => %{\"tools\" => tools}} when is_list(tools) ->
|
||||
IO.puts(\"✅ MCP server working (#{length(tools)} tools available)\")
|
||||
_ ->
|
||||
IO.puts(\"❌ MCP server not responding correctly\")
|
||||
end
|
||||
|
||||
System.halt(0)
|
||||
"; then
|
||||
echo "✅ Quick test passed!"
|
||||
else
|
||||
echo "❌ Quick test failed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "🎉 AgentCoordinator is ready!"
|
||||
echo ""
|
||||
echo "🚀 Next steps:"
|
||||
echo " 1. Run ./setup.sh to configure VS Code integration"
|
||||
echo " 2. Or test manually with: ./mcp_launcher.sh"
|
||||
echo " 3. Or run Python example: python3 mcp_client_example.py"
|
||||
@@ -145,7 +145,7 @@ if [ -f "$SETTINGS_FILE" ]; then
|
||||
echo "$MCP_CONFIG" | jq -s '.[0] * .[1]' "$SETTINGS_FILE" - > "$SETTINGS_FILE.tmp"
|
||||
mv "$SETTINGS_FILE.tmp" "$SETTINGS_FILE"
|
||||
else
|
||||
echo "⚠️ jq not found. Please manually add MCP configuration to $SETTINGS_FILE"
|
||||
echo "jq not found. Please manually add MCP configuration to $SETTINGS_FILE"
|
||||
echo "Add this configuration:"
|
||||
echo "$MCP_CONFIG"
|
||||
fi
|
||||
@@ -153,25 +153,25 @@ else
|
||||
echo "$MCP_CONFIG" > "$SETTINGS_FILE"
|
||||
fi
|
||||
|
||||
echo "✅ VS Code settings updated"
|
||||
echo "VS Code settings updated"
|
||||
|
||||
# Test MCP server
|
||||
echo -e "\n🧪 Testing MCP server..."
|
||||
echo -e "\nTesting MCP server..."
|
||||
cd "$PROJECT_DIR"
|
||||
if timeout 5 ./scripts/mcp_launcher.sh >/dev/null 2>&1; then
|
||||
echo "✅ MCP server test passed"
|
||||
echo "MCP server test passed"
|
||||
else
|
||||
echo "⚠️ MCP server test timed out (this is expected)"
|
||||
echo "MCP server test timed out (this is expected)"
|
||||
fi
|
||||
|
||||
# Create desktop shortcut for easy access
|
||||
echo -e "\n🖥️ Creating desktop shortcuts..."
|
||||
echo -e "\nCreating desktop shortcuts..."
|
||||
|
||||
# Start script
|
||||
cat > "$PROJECT_DIR/start_agent_coordinator.sh" << 'EOF'
|
||||
#!/bin/bash
|
||||
cd "$(dirname "$0")"
|
||||
echo "🚀 Starting AgentCoordinator..."
|
||||
echo "Starting AgentCoordinator..."
|
||||
|
||||
# Start NATS if not running
|
||||
if ! pgrep -f nats-server > /dev/null; then
|
||||
@@ -191,7 +191,7 @@ chmod +x "$PROJECT_DIR/start_agent_coordinator.sh"
|
||||
# Stop script
|
||||
cat > "$PROJECT_DIR/stop_agent_coordinator.sh" << 'EOF'
|
||||
#!/bin/bash
|
||||
echo "🛑 Stopping AgentCoordinator..."
|
||||
echo "Stopping AgentCoordinator..."
|
||||
|
||||
# Stop NATS if we started it
|
||||
if [ -f /tmp/nats.pid ]; then
|
||||
@@ -203,24 +203,24 @@ fi
|
||||
pkill -f "scripts/mcp_launcher.sh" || true
|
||||
pkill -f "agent_coordinator" || true
|
||||
|
||||
echo "✅ AgentCoordinator stopped"
|
||||
echo "AgentCoordinator stopped"
|
||||
EOF
|
||||
|
||||
chmod +x "$PROJECT_DIR/stop_agent_coordinator.sh"
|
||||
|
||||
echo "✅ Created start/stop scripts"
|
||||
echo "Created start/stop scripts"
|
||||
|
||||
# Final instructions
|
||||
echo -e "\n🎉 Setup Complete!"
|
||||
echo -e "\nSetup Complete!"
|
||||
echo "==================="
|
||||
echo ""
|
||||
echo "📋 Next Steps:"
|
||||
echo "Next Steps:"
|
||||
echo ""
|
||||
echo "1. 🔄 Restart VS Code to load the new MCP configuration"
|
||||
echo "1. Restart VS Code to load the new MCP configuration"
|
||||
echo " - Close all VS Code windows"
|
||||
echo " - Reopen VS Code in your project"
|
||||
echo ""
|
||||
echo "2. 🤖 GitHub Copilot should now have access to AgentCoordinator tools:"
|
||||
echo "2. GitHub Copilot should now have access to AgentCoordinator tools:"
|
||||
echo " - register_agent"
|
||||
echo " - create_task"
|
||||
echo " - get_next_task"
|
||||
@@ -233,14 +233,13 @@ echo " - Ask Copilot: 'Register me as an agent with coding capabilities'"
|
||||
echo " - Ask Copilot: 'Create a task to refactor the login module'"
|
||||
echo " - Ask Copilot: 'Show me the task board'"
|
||||
echo ""
|
||||
echo "📂 Useful files:"
|
||||
echo " Useful files:"
|
||||
echo " - Start server: $PROJECT_DIR/start_agent_coordinator.sh"
|
||||
echo " - Stop server: $PROJECT_DIR/stop_agent_coordinator.sh"
|
||||
echo " - Test client: $PROJECT_DIR/mcp_client_example.py"
|
||||
echo " - VS Code settings: $SETTINGS_FILE"
|
||||
echo ""
|
||||
echo "🔧 Manual start (if needed):"
|
||||
echo " cd $PROJECT_DIR && ./scripts/mcp_launcher.sh"
|
||||
echo ""
|
||||
echo "💡 Tip: The MCP server will auto-start when Copilot needs it!"
|
||||
echo ""
|
||||
echo ""
|
||||
|
||||
Reference in New Issue
Block a user