-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to run #7
Comments
FOR VIRTUAL ENVIRONMENTCreating a virtual environment in Python on VS Code on a Mac involves the following steps: Step 1: Open Terminal or Integrated Terminal in VS Code
Step 2: Navigate to Your Project Directory
Step 3: Create the Virtual Environment
Step 4: Activate the Virtual Environment
Step 5: Install Extensions in VS Code (if necessary)
Step 6: Configure Python Interpreter
Step 7: Verify the Virtual Environment
Step 8: Deactivate the Virtual Environment (Optional)When you're done working in the environment, deactivate it by running: deactivate Step 9: Automate Activation in Terminal (Optional)If you want VS Code to automatically activate the virtual environment when you open the project:
Now, the environment will automatically activate when you open the terminal in VS Code. |
Cleaned up note on running the project:Here's how to set up and run your MCP project with the specifics you provided, combining your rough notes and project structure: Step 1: Set Up a Virtual Environment
3.5. Select the right Python interpreter
Step 2: Set Environment VariablesExport the export ANTHROPIC_API_KEY="your_api_key_here" Step 3: Run Server A
Step 4: Run Server B
Step 5: Start the Gateway
Step 6: Configure Claude Desktop
Step 7: Verify the Setup
Troubleshooting
Let me know if you need further clarifications! |
Even MORE Complete Cheat Sheet for Running This ProjectCertainly! Below is a comprehensive cheat-sheet capturing all the steps needed to set up and run the MCP-Agent-Router Project Setup and Execution Cheat-Sheet1. Initial SetupStep 1: Clone the RepositoryIf you haven’t already cloned the project: git clone <repository-url>
cd mcp-agent-router Step 2: Set Up the Python Virtual Environment
Step 3: Configure
|
Best Cold-Start "How to Run" Documentation(Based on continuing periodic issues, I've further documented below how best to run and use this project based on the various obstacles that have popped up. Note that the file paths should be updated to your machine and I hard-coded the version of Python I'm using to deal with countless issues pointing to the right version and maintaining the link to it.) Okay, let's get the 1. Project Setup with First, ensure your project environment is correctly set up with # Clone the repository if you haven't already
git clone <repository-url>
cd mcp-agent-router
# Remove existing virtual environments if any
rm -rf .venv venv
# Create a new virtual environment with Python 3.11
/Library/Frameworks/Python.framework/Versions/3.11/bin/python3.11 -m venv ./venv
# Link venv to .venv for uv
ln -s venv .venv
# Activate the virtual environment
source ./venv/bin/activate
# Confirm Python version
python --version
# Expected output is: Python 3.11.x
# Install necessary dependencies using uv
uv pip install flask anthropic requests python-dotenv mcp
# Update the python version
echo "3.11" > .python-version Explanation:
2. Start the MCP Servers and Gateway Agent Next, we'll start each of your three "black box" servers and the gateway agent in separate terminals. Terminal 1: Server A (Personal Trainer) cd server-a
source ../venv/bin/activate
python server.py Terminal 2: Server B (Work Assistant) cd ../server-b
source ../venv/bin/activate
python server.py Terminal 3: Gateway Agent cd ../gateway-agent
source ../venv/bin/activate
uv run service.py Explanation:
3. Configure Claude Desktop Now, let's configure Claude Desktop to recognize your gateway agent and servers. Here’s how your {
"mcpServers": {
"gateway-agent": {
"url": "http://localhost:8000/mcp/v1"
},
"server-a": {
"url": "http://localhost:5010/mcp/v1"
},
"server-b": {
"url": "http://localhost:5001/mcp/v1"
}
}
} Explanation:
4. Starting and Using the MCP Inspector Now we can run and use the inspector to test out the servers and debug. Open a new terminal (Terminal 4): cd mcp-agent-router/gateway-agent
source ../venv/bin/activate
npx @modelcontextprotocol/inspector http://localhost:8000/mcp/v1 Explanation:
5. Interacting with MCP Inspector
Explanation:
6. Interacting with Claude Desktop After completing these steps, Claude Desktop should be able to send queries through your gateway server. To test with Claude Desktop:
Troubleshooting:
Key Points to Understand
Note: Be sure to check the log files that are output into the shared folder for debugging. Also use the Inspector to make sure that you have each server connecting and correctly routing messages as designed. |
I think there are still some issues with the documentation on this! Here is another shot at correcting the causes of the errors: Run the ProjectOkay, let's get your 1. Project Setup with First, ensure your project environment is correctly set up with # Clone the repository if you haven't already
git clone <repository-url>
cd mcp-agent-router
# Remove existing virtual environments if any
rm -rf .venv venv
# Create a new virtual environment with Python 3.11 (or match with .python-version)
/Library/Frameworks/Python.framework/Versions/3.11/bin/python3.11 -m venv ./venv
# Link venv to .venv for uv
ln -s venv .venv
# Activate the virtual environment
source ./venv/bin/activate
# Confirm Python version
python --version
# Expected output is: Python 3.11.x
# Install necessary dependencies using uv
uv pip install flask anthropic requests python-dotenv mcp Explanation:
2. Prepare Server Configuration Files Create
Explanation:
3. Start the MCP Servers and Gateway Agent Next, we'll start each of your three "black box" servers and the gateway agent in separate terminals. Terminal 1: Server A (Personal Trainer) cd server-a
source ../venv/bin/activate
uv run server.py Make note of the fact that server A runs on port 5010. Terminal 2: Server B (Work Assistant) cd ../server-b
source ../venv/bin/activate
uv run server.py Make note of the fact that server B runs on port 5001. Terminal 3: Gateway Agent cd ../gateway-agent
source ../venv/bin/activate
uv run service.py Make note of the fact that gateway agent will listen on port 8000. Explanation:
4. Configure Claude Desktop Now, let's configure Claude Desktop to recognize your gateway agent and servers. Here’s how your {
"mcpServers": {
"gateway-agent": {
"command": "uv",
"args": ["run", "/Users/dazzagreenwood/mcp-agent-router/gateway-agent/service.py"],
"url": "http://localhost:8000/mcp/v1"
},
"server-a": {
"url": "http://localhost:5010/mcp/v1"
},
"server-b": {
"url": "http://localhost:5001/mcp/v1"
}
}
} Replace Explanation:
5. Starting and Using the MCP Inspector Now we can run and use the inspector to test out the servers and debug. Open a new terminal (Terminal 4): cd mcp-agent-router/gateway-agent
source ../venv/bin/activate
npx @modelcontextprotocol/inspector http://localhost:8000/mcp/v1 Explanation:
6. Interacting with MCP Inspector
Explanation:
7. Interacting with Claude Desktop After completing these steps, Claude Desktop should be able to send queries through your gateway server. To test with Claude Desktop:
Troubleshooting:
Key Points to Understand
Let me know if you need further help, or run into any issues. Be sure to check the log files that are output into the shared folder for debugging. Also use the Inspector to make sure that you have each server connecting and correctly routing messages as designed. Explanation of Changes
|
One more time, with feeling! Running the
|
Running directly
Install libs with uv or pip
ie:
Set anthoripc key env:
export ANTHROPIC_API_KEY=keyhere
Go into
server-a
andpython server.py
In another term go into
server-b
andpython server.py
Test to see if the gateway can start:
uv run path/to/gateway/service.py
, but you have to update the path to be your localNow configure your claude desktop to run the gateway script with uv
Now claude desktop should be able to use the gateway MCP tool on restart, hopefully it all works
Helper notes:
https://docs.astral.sh/uv/getting-started/installation/
uv run /Users/dazzagreenwood/mcp-agent-router/gateway-agent/service.py
The text was updated successfully, but these errors were encountered: