Skip to content

Commit 835def4

Browse files
authored
Merge pull request #186 from ShivamGoyal03/main
Implement intelligent Router Agent and improve MCP integration
2 parents d3d8c03 + 1070365 commit 835def4

File tree

4 files changed

+308
-75
lines changed

4 files changed

+308
-75
lines changed

11-mcp/README.md

Lines changed: 118 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,119 @@
1-
## Lesson in Progress
1+
# Lesson 11: Model Context Protocol (MCP) Integration
22

3-
This written lesson is in progress but a code sample has been included.
3+
## Learning Objectives
4+
- Understand what MCP is and its role in AI agent development
5+
- Set up and configure an MCP server for GitHub integration
6+
- Build a multi-agent system using MCP tools
7+
- Implement RAG (Retrieval Augmented Generation) with Azure Cognitive Search
8+
9+
## Prerequisites
10+
- Python 3.8+
11+
- Node.js 14+
12+
- Azure subscription
13+
- GitHub account
14+
- Basic understanding of Semantic Kernel
15+
16+
## Setup Instructions
17+
18+
1. **Environment Setup**
19+
```bash
20+
python -m venv venv
21+
source venv/bin/activate # On Windows: venv\Scripts\activate
22+
pip install -r requirements.txt
23+
```
24+
25+
2. **Configure Azure Services**
26+
- Create an Azure Cognitive Search resource
27+
- Set up Azure OpenAI service
28+
- Configure environment variables in `.env`
29+
30+
3. **MCP Server Setup**
31+
```bash
32+
npm install -g @modelcontextprotocol/server-github
33+
```
34+
35+
## Project Structure
36+
37+
```
38+
11-mcp/
39+
├── code_samples/
40+
│ └── github-mcp/
41+
│ ├── app.py # Main application
42+
│ ├── event-descriptions.md # Event data
43+
│ └── MCP_SETUP.md # Setup guide
44+
├── README.md
45+
└── requirements.txt
46+
```
47+
48+
## Core Components
49+
50+
### 1. Multi-Agent System
51+
- GitHub Agent: Repository analysis
52+
- Hackathon Agent: Project recommendations
53+
- Events Agent: Tech event suggestions
54+
55+
### 2. Azure Integration
56+
- Cognitive Search for event indexing
57+
- Azure OpenAI for agent intelligence
58+
- RAG pattern implementation
59+
60+
### 3. MCP Tools
61+
- GitHub repository analysis
62+
- Code inspection
63+
- Metadata extraction
64+
65+
## Code Walkthrough
66+
67+
The sample demonstrates:
68+
1. MCP server integration
69+
2. Multi-agent orchestration
70+
3. Azure Cognitive Search integration
71+
4. RAG pattern implementation
72+
73+
Key features:
74+
- Real-time GitHub repository analysis
75+
- Intelligent project recommendations
76+
- Event matching using Azure Search
77+
- Streaming responses with Chainlit
78+
79+
## Running the Sample
80+
81+
1. Start the MCP server:
82+
```bash
83+
npx @modelcontextprotocol/server-github
84+
```
85+
86+
2. Launch the application:
87+
```bash
88+
chainlit run app.py -w
89+
```
90+
91+
3. Test the integration:
92+
```
93+
Example query: "Analyze repositories for username: <github_username>"
94+
```
95+
96+
## Troubleshooting
97+
98+
Common issues and solutions:
99+
1. MCP Connection Issues
100+
- Verify server is running
101+
- Check port availability
102+
- Confirm GitHub tokens
103+
104+
2. Azure Search Issues
105+
- Validate connection strings
106+
- Check index existence
107+
- Verify document upload
108+
109+
## Next Steps
110+
- Explore additional MCP tools
111+
- Implement custom agents
112+
- Enhance RAG capabilities
113+
- Add more event sources
114+
115+
## Resources
116+
- [MCP for Beginners](https://aka.ms/mcp-for-beginners)
117+
- [MCP Documentation](https://github.com/microsoft/semantic-kernel/tree/main/python/semantic-kernel/semantic_kernel/connectors/mcp)
118+
- [Azure Cognitive Search Docs](https://learn.microsoft.com/azure/search/)
119+
- [Semantic Kernel Guides](https://learn.microsoft.com/semantic-kernel/)
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# MCP Server Integration Guide
2+
3+
## Prerequisites
4+
- Node.js installed (version 14 or higher)
5+
- npm package manager
6+
- Python environment with required dependencies
7+
8+
## Setup Steps
9+
10+
1. **Install MCP Server Package**
11+
```bash
12+
npm install -g @modelcontextprotocol/server-github
13+
```
14+
15+
2. **Start MCP Server**
16+
```bash
17+
npx @modelcontextprotocol/server-github
18+
```
19+
The server should start and display a connection URL.
20+
21+
3. **Verify Connection**
22+
- Look for the plug icon (🔌) in your Chainlit interface
23+
- A number (1) should appear next to the plug icon indicating successful connection
24+
- The console should show: "GitHub plugin setup completed successfully" (along with additional status lines)
25+
26+
## Troubleshooting
27+
28+
### Common Issues
29+
30+
1. **Port Conflict**
31+
```bash
32+
Error: listen EADDRINUSE: address already in use
33+
```
34+
Solution: Change the port using:
35+
```bash
36+
npx @modelcontextprotocol/server-github --port 3001
37+
```
38+
39+
2. **Authentication Issues**
40+
- Ensure GitHub credentials are properly configured
41+
- Check .env file contains required tokens
42+
- Verify GitHub API access
43+
44+
3. **Connection Failed**
45+
- Confirm server is running on expected port
46+
- Check firewall settings
47+
- Verify Python environment has required packages
48+
49+
## Connection Verification
50+
51+
Your MCP server is properly connected when:
52+
1. Console shows "GitHub plugin setup completed successfully"
53+
2. Connection logs show "✓ MCP Connection Status: Active"
54+
3. GitHub commands work in chat interface
55+
56+
## Environment Variables
57+
58+
Required in your .env file:
59+
```
60+
GITHUB_TOKEN=your_github_token
61+
MCP_SERVER_PORT=3000 # Optional, default is 3000
62+
```
63+
64+
## Testing Connection
65+
66+
Send this test message in chat:
67+
```
68+
Show me the repositories for username: [GitHub Username]
69+
```
70+
A successful response will show repository information.

11-mcp/code_samples/github-mcp/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ After connecting, you should see a (1) next to the plug icon to confirm that its
5858

5959
## Using the Demo
6060

61-
To start the agent workflow of reccomending hackathon projects, you can type a message like:
61+
To start the agent workflow of recommending hackathon projects, you can type a message like:
6262

6363
"Recommend hackathon projects for the Github user koreyspace"
6464

65-
**Currently we have this coded to detect the words "reccomend" and "github" to start this workflow. Later, this will be done by a Router Agent.**
65+
The Router Agent will analyze your request and determine which combination of agents (GitHub, Hackathon, and Events) is best suited to handle your query. The agents work together to provide comprehensive recommendations based on GitHub repository analysis, project ideation, and relevant tech events.

0 commit comments

Comments
 (0)