Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
2f0a06a
Add macros mcp
mprystupa Sep 24, 2025
2289d99
Added trivia-mcp
stoyanes Sep 24, 2025
507ce24
Add nutritional-plan-mcp
mprystupa Sep 24, 2025
d5881fd
Add trivia secrets, celebrity sightings, and insider tips for various…
stoyanes Sep 24, 2025
04d1160
Frontend setup
mprystupa Sep 24, 2025
6105954
Merge branch 'main' of https://github.com/SirAnsberry/Hackathon-2025
mprystupa Sep 24, 2025
cfde215
Added storage MCP
SirAnsberry Sep 24, 2025
ce01734
Merge branch 'main' into Storage-mcp
SirAnsberry Sep 24, 2025
7589476
Merge pull request #1 from SirAnsberry/Storage-mcp
SirAnsberry Sep 24, 2025
419c9eb
recipe mcp with local data
aleksttc Sep 24, 2025
145cc56
Merge branch 'main' of https://github.com/SirAnsberry/Hackathon-2025
aleksttc Sep 24, 2025
d7aca78
frontend stuff
mprystupa Sep 24, 2025
669b19a
Merge branch 'main' into mp/calorie-tracker
mprystupa Sep 24, 2025
b2a9193
stuff
mprystupa Sep 24, 2025
f4294a7
Added all MCPs to run
SirAnsberry Sep 24, 2025
e90f386
Merge branch 'main' of https://github.com/SirAnsberry/Hackathon-2025
SirAnsberry Sep 24, 2025
23636d9
From attractions trivia mcp to nutritions trivia mcp
stoyanes Sep 24, 2025
5b7ba58
Merge branch 'main' of https://github.com/SirAnsberry/Hackathon-2025
stoyanes Sep 24, 2025
bf24185
Fix ports
SirAnsberry Sep 24, 2025
f039f00
Merge branch 'main' of https://github.com/SirAnsberry/Hackathon-2025
SirAnsberry Sep 24, 2025
84a13f8
Add calorie tracking frontend skeleton
mprystupa Sep 24, 2025
27c52bc
added restautants mcp
stoyanes Sep 24, 2025
a9bb168
Improve tracker feature
mprystupa Sep 24, 2025
788b8d1
Added some prompts
SirAnsberry Sep 24, 2025
82e0584
updated restaurants-mcp with Rome data
stoyanes Sep 24, 2025
20bf10e
add chat widget
mprystupa Sep 24, 2025
6a7c63c
Merge branch 'main' into mp/calorie-tracker
mprystupa Sep 24, 2025
d8bf6f9
Merge branch 'main' of https://github.com/SirAnsberry/Hackathon-2025
SirAnsberry Sep 24, 2025
809fc7e
Push slides
ttc-danielpascoe Sep 24, 2025
7268e26
Merge branch 'main' of https://github.com/SirAnsberry/Hackathon-2025
ttc-danielpascoe Sep 24, 2025
223e369
more stuff
mprystupa Sep 24, 2025
8b15b5e
Merge pull request #2 from SirAnsberry/mp/calorie-tracker
mprystupa Sep 24, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified demo/demo_template 1.pptx
Binary file not shown.
41 changes: 31 additions & 10 deletions src/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,118 +7,139 @@ This repository contains all materials for the hackathon focused on building age
There are 2 pre-built MCP servers and a Jupyter notebook that can be run to execute LangChain to communicate with these MCP servers.

- [Attractions MCP Server](mcp/attractions-mcp/README.md)
- [Weather MCP Server](mcp/weather-mcp/README.md)
- [Weather MCP Server (port 8009)](mcp/weather-mcp/README.md)
- [Attractions Jupyter Notebook](agent/README.md)
- [Macros MCP Server (port 8010)](mcp/macros-mcp/README.md)
- [Nutritional Plan MCP Server (port 8011)](mcp/nutritional-plan-mcp/README.md)
- [Trivia MCP Server (port 8012)](mcp/trivia-mcp/README.md)

## Getting Started

Follow these steps to set up and run Weather MCP/Attractions MCP service:

### Prerequisites

1. **Install Python 3.13**

- Download from [python.org](https://www.python.org/downloads/)

2. **Install uv** (Python package manager)

```bash
pip install uv
```

**Windows users**: You may need to add the Python Scripts folder to your PATH environment variable:

- If installed globally: `C:\Users\<your-username>\AppData\Local\Programs\Python\Python313\Scripts\`
- If installed with `pip install --user uv`: `C:\Users\<your-username>\AppData\Roaming\Python\Python313\Scripts\`
- Restart your command prompt/PowerShell after updating PATH

### Setup Steps

1. **Fork and clone the repository**

```bash
git clone <your-repo-url>
cd Hackathon-2025
```

2. **Navigate to the weather-mcp or attractions-mcp directory**

```bash
cd src/mcp/weather-mcp
```

```bash
cd src/mcp/attractions-mcp
```

3. **Install dependencies**

```bash
uv sync
```

4. **Run the MCP server**

```bash
uv run mcp dev main.py
```

The weather MCP service will start and a local UI will launch in the browser (MCP's have to be running to run the jupyter notebook).

When using mcp dev you may need to change the support type dropdown to STDIO to use it.

> **⚠ Important Note:** If you are running the MCP to be consumed by the agent, do not run it in dev mode. Use the following command instead:
>
> ```bash
> uv run main.py
> ```

## Agent Notebook

Once your MCP services are running, you can explore the agent implementation in the Jupyter notebook:

- [Attractions Agent Notebook](agent/README.md)

## Creating a New MCP Service

To create your own MCP service, follow these steps:

1. **Navigate to the MCP folder**

```bash
cd src/mcp
```

2. **Initialize a new MCP project**

```bash
uv init mymcpname-mcp
```

3. **Add MCP dependencies**

```bash
cd mymcpname-mcp
uv add "mcp[cli]"
```

4. **Create your MCP service code**
Update the `main.py` file with this default MCP code to get you started:
```python

```python
from mcp.server.fastmcp import FastMCP

# Create an MCP server
# you can add the port here so that it doesnt clash with other mcp servers
mcp = FastMCP("myname")

# Add an addition tool
@mcp.tool()
def add(a: int, b: int) -> int:
"""Add two numbers"""
return a + b


# Add a dynamic greeting resource
@mcp.resource("greeting://{name}")
def get_greeting(name: str) -> str:
"""Get a personalized greeting"""
return f"Hello, {name}!"


if __name__ == "__main__":
mcp.run("streamable-http")
```

5. **Run your MCP service**

```bash
uv run mcp dev main.py
```

6. **Start building your custom functionality**
- Follow the existing patterns in `weather-mcp` or `attractions-mcp` folders
- Implement your custom tools and functionality
- for any additional guidance you can check here https://github.com/modelcontextprotocol/python-sdk
- for any additional guidance you can check here https://github.com/modelcontextprotocol/python-sdk
98 changes: 90 additions & 8 deletions src/agent/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ This notebook demonstrates a LangChain agent integrated with MCP (Model Context
## Setup Instructions

### 1. Environment Setup

Create a `.env` file in this directory with your Azure OpenAI credentials and mcp configuration:

```env
Expand All @@ -27,24 +28,29 @@ AZURE_API_VERSION=2024-12-01-preview
DEPLOYMENT_NAME=
ATTRACTIONS_MCP_URL=http://127.0.0.1:8008/mcp/
WEATHER_MCP_URL=http://127.0.0.1:8009/mcp/
MACROS_MCP_URL=http://127.0.0.1:8010/mcp/
NUTRITION_PLAN_MCP_URL=http://127.0.0.1:8011/mcp/
```

You can get these credentials from:

- Azure OpenAI service → Azure AI Foundry Portal
- Your Azure OpenAI resource in the Azure portal
- Overview tab for endpoint, API key (selecting "Azure AI Services" tab within "Libraries")

### 2. Register Jupyter Kernel (Important!)

Make sure you have downloaded the offical [Jupyter VS Code extension](https://marketplace.visualstudio.com/items?itemName=ms-toolsai.jupyter).

**Important:** After opening the notebook file (*.ipynb), make sure to select the correct kernel:
**Important:** After opening the notebook file (\*.ipynb), make sure to select the correct kernel:

1. Install the offcial jupyter extension
1. After opening the notebook file, click on "Select Kernel" and then "Python Environments...":
![alt text](images/image.png)
2. Select "Create Python Environment"
3. Select "venv` → Choose lastest python"
4. Select the one `src\agent\requirements.txt` dependencies to install. Select ok on the prompt.
4. This ensures you're using the local virtual environment, not a global one
1. Select "Create Python Environment"
1. Select "venv` → Choose lastest python"
1. Select the one `src\agent\requirements.txt` dependencies to install. Select ok on the prompt.
1. This ensures you're using the local virtual environment, not a global one

This will create a virtual environment and start installing dependencies.

Expand All @@ -59,6 +65,7 @@ cd ../../mcp/attractions-mcp
# Start the MCP server on HTTP
uv run main.py
```

The server should start on `http://localhost:8008/mcp/` for attractions

```bash
Expand All @@ -68,13 +75,15 @@ cd ../../mcp/weather-mcp
# Start the MCP server on HTTP
uv run main.py
```

The server should start on `http://localhost:8009/mcp/` for weather

### 4. Running the Notebook

Open and run the Jupyter notebook:

You can verify the correct environment by running Cell 0 - it should show:

```
python: *CodeDirectory*\Hackathon\Hackathon-2025\.venv\Scripts\python.exe
uv: *Python install location*\Python313\Scripts\uv.EXE
Expand All @@ -91,33 +100,43 @@ You can hit `run all` at the top of the notebook, or you can run the cells 1 by
The notebook is structured in sequential cells that should be run in order:

### Step 1: Environment Check

- **Cell 0**: Verifies that the virtual environment is being used correctly

### Step 2: Install Dependencies
### Step 2: Install Dependencies

- **Cell 1**: Installs uv and all required packages from requirements.txt

### Step 3: Import and Setup

- **Cell 2**: Imports all necessary libraries for LangChain and MCP integration

### Step 4-5: MCP Client Configuration

- **Cell 3-4**: Sets up the MCP client to connect to the HTTP server on localhost:8008

### Step 6: Agent Initialization

- **Cell 5-6**: Creates and initializes the LangChain agent with MCP tools

### Step 7: User Input Handler

- **Cell 7**: Sets up functions to interact with the AI agent

### Step 8: Connection Testing

- **Cell 8**: Tests the MCP server connection and displays available tools

### Step 9: Example Usage

- **Cell 9**: Demonstrates how to use the agent with example queries

### Step 10: Interactive Chat

- **Cell 10**: Interactive chat loop to converse with the agent

### Step 11: Cleanup

- **Cell 11**: Provides cleanup function for proper resource management

## Available MCP Tools
Expand All @@ -140,11 +159,71 @@ Once the notebook is running, you can ask the assistant questions like:
- "What's a random famous attraction I should visit?"
- "Show me museums in London"

## FastAPI Server (for Frontend Integration)

If you want to expose the agent over HTTP so the React app can call it, run the FastAPI server that lives in `src/agent/server`.

### 1. Configure environment

Create or update your `.env` (or export variables) with either Azure OpenAI or OpenAI credentials:

```bash
# Azure (preferred)
AZURE_OPENAI_ENDPOINT=
AZURE_OPENAI_API_KEY=
AZURE_API_VERSION=2024-12-01-preview
DEPLOYMENT_NAME=

# Optional fallback
OPENAI_API_KEY=
```

Ensure the MCP servers you need (attractions, weather, macros, nutritional-plan, trivia) are running; the server will use their HTTP endpoints.

Default URLs (override in `.env` if needed):

```
ATTRACTIONS_MCP_URL=http://127.0.0.1:8008/mcp/
WEATHER_MCP_URL=http://127.0.0.1:8009/mcp/
MACROS_MCP_URL=http://127.0.0.1:8010/mcp/
NUTRITION_PLAN_MCP_URL=http://127.0.0.1:8011/mcp/
TRIVIA_MCP_URL=http://127.0.0.1:8012/mcp/
```

### 2. Install dependencies & run server

```bash
cd src/agent
python -m pip install -r requirements.txt
python server/main.py
```

The server listens on `http://localhost:8080` by default and exposes:

- `GET /health`
- `POST /init` → `{ sessionId }`
- `POST /chat` with `{ sessionId?, message }` → `{ sessionId, output }`

Each session keeps in-memory chat history. Restarting the server clears sessions.
Errors from MCP tools are returned to the caller as friendly messages in the API response frame.

### 3. Frontend config

Set the frontend environment variable so it knows where to reach the server:

```
src/frontend/.env
VITE_AGENT_URL=http://localhost:8080
```

Then run the frontend (`npm run dev`) and use the chat UI.

## Troubleshooting

### Common Issues:

1. **MCP Server Connection Failed**

- Ensure the MCP server is running on localhost:8008
- Check that no firewall is blocking the connection

Expand All @@ -153,9 +232,11 @@ Once the notebook is running, you can ask the assistant questions like:
- Check that your Azure OpenAI deployment name matches (default: "gpt-5-chat")

### Debug Mode

The agent runs in verbose mode by default, showing the reasoning process. To see detailed logs, check the console output when running cells.

## Project Structure

```
src/agent
├── attractions.ipynb # Main notebook file
Expand All @@ -164,8 +245,9 @@ src/agent
```

## Next Steps

After setting up the notebook:

1. Run through all cells sequentially
3. Try your own travel-related questions
4. Explore different MCP tools and their capabilities
2. Try your own travel-related questions
3. Explore different MCP tools and their capabilities
Loading