docs: add readme
Browse files- .env.example +2 -2
- README.md +36 -46
- mcp_client.py +6 -0
.env.example
CHANGED
|
@@ -5,5 +5,5 @@ LLM_API_KEY=sk-proj-
|
|
| 5 |
# end LLM configuration
|
| 6 |
|
| 7 |
# MCP server configuration for local testing
|
| 8 |
-
MCP_SERVER_URL=https://dpc-restapi-mcp-server-75k7y.ondigitalocean.app/mcp/
|
| 9 |
-
|
|
|
|
| 5 |
# end LLM configuration
|
| 6 |
|
| 7 |
# MCP server configuration for local testing
|
| 8 |
+
# MCP_SERVER_URL=https://dpc-restapi-mcp-server-75k7y.ondigitalocean.app/mcp/
|
| 9 |
+
MCP_SERVER_URL=http://0.0.0.0:8000/mcp/
|
README.md
CHANGED
|
@@ -1,71 +1,70 @@
|
|
| 1 |
# DPC MCP Client
|
|
|
|
| 2 |
|
| 3 |
-
|
| 4 |
|
| 5 |
-
## 🚀
|
| 6 |
|
| 7 |
-
- LangChain MCP Client
|
| 8 |
-
- Gradio
|
| 9 |
-
- StreamableHTTP
|
| 10 |
-
- Product Catalog API
|
| 11 |
-
- Astral/UV
|
| 12 |
-
- Python 3.13
|
| 13 |
|
| 14 |
-
## 📋
|
| 15 |
|
| 16 |
-
- Python 3.13
|
| 17 |
-
- UV
|
| 18 |
-
-
|
| 19 |
|
| 20 |
```env
|
| 21 |
AGENT_DEBUG=true
|
| 22 |
LLM_PROVIDER=OPENAI
|
| 23 |
LLM_API_KEY=your_api_key_here
|
| 24 |
-
LLM_MODEL=
|
| 25 |
-
MCP_SERVER_URL=
|
| 26 |
```
|
| 27 |
|
| 28 |
-
## 🛠️
|
| 29 |
|
| 30 |
-
1.
|
| 31 |
```bash
|
| 32 |
git clone https://github.com/yourusername/dpc_mcp_client.git
|
| 33 |
cd dpc_mcp_client
|
| 34 |
```
|
| 35 |
|
| 36 |
-
2.
|
| 37 |
```bash
|
| 38 |
-
uv
|
| 39 |
-
source .venv/bin/activate # Linux/Mac
|
| 40 |
-
# veya
|
| 41 |
-
.venv\Scripts\activate # Windows
|
| 42 |
-
uv pip install -e .
|
| 43 |
```
|
| 44 |
|
| 45 |
-
## 🚀
|
| 46 |
|
| 47 |
-
|
| 48 |
|
| 49 |
```bash
|
| 50 |
uv run app.py
|
| 51 |
```
|
| 52 |
|
| 53 |
-
|
|
|
|
| 54 |
|
| 55 |
-
|
|
|
|
| 56 |
|
| 57 |
```
|
| 58 |
dpc_mcp_client/
|
| 59 |
-
├── app.py # Gradio UI
|
| 60 |
-
├── mcp_client.py # MCP Client
|
| 61 |
-
├── resources/ #
|
| 62 |
│ ├── instruction.txt
|
| 63 |
│ └── dpc_restapi_summary.txt
|
| 64 |
-
├── pyproject.toml #
|
| 65 |
└── README.md
|
| 66 |
```
|
| 67 |
|
| 68 |
-
## 🔧
|
| 69 |
|
| 70 |
- environs>=14.2.0
|
| 71 |
- gradio>=5.32.1
|
|
@@ -74,20 +73,11 @@ dpc_mcp_client/
|
|
| 74 |
- langgraph>=0.4.8
|
| 75 |
- loguru>=0.7.3
|
| 76 |
|
| 77 |
-
## 🤝
|
| 78 |
-
|
| 79 |
-
1. Bu depoyu fork edin
|
| 80 |
-
2. Yeni bir özellik dalı oluşturun (`git checkout -b feature/amazing-feature`)
|
| 81 |
-
3. Değişikliklerinizi commit edin (`git commit -m 'Add some amazing feature'`)
|
| 82 |
-
4. Dalınıza push yapın (`git push origin feature/amazing-feature`)
|
| 83 |
-
5. Bir Pull Request oluşturun
|
| 84 |
-
|
| 85 |
-
## 📝 Lisans
|
| 86 |
-
|
| 87 |
-
Bu proje MIT lisansı altında lisanslanmıştır. Daha fazla bilgi için `LICENSE` dosyasına bakın.
|
| 88 |
-
|
| 89 |
-
## 📞 İletişim
|
| 90 |
|
| 91 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 92 |
|
| 93 |
-
Proje Linki: [https://github.com/yourusername/dpc_mcp_client](https://github.com/yourusername/dpc_mcp_client)
|
|
|
|
| 1 |
# DPC MCP Client
|
| 2 |
+
**Desinged to test the DNext Product Catalog REST API MCP Server.**
|
| 3 |
|
| 4 |
+
A Gradio-based chatbot application designed to interact with Product Catalog APIs through FASTMC-Server's streamable-http protocol using LangChain MCP Client.
|
| 5 |
|
| 6 |
+
## 🚀 Features
|
| 7 |
|
| 8 |
+
- LangChain MCP Client integration
|
| 9 |
+
- Gradio-based user interface
|
| 10 |
+
- StreamableHTTP protocol support
|
| 11 |
+
- Product Catalog API integration
|
| 12 |
+
- Astral/UV package manager support
|
| 13 |
+
- Python 3.13 compatibility
|
| 14 |
|
| 15 |
+
## 📋 Requirements
|
| 16 |
|
| 17 |
+
- Python 3.13 or higher
|
| 18 |
+
- UV package manager
|
| 19 |
+
- The following environment variables:
|
| 20 |
|
| 21 |
```env
|
| 22 |
AGENT_DEBUG=true
|
| 23 |
LLM_PROVIDER=OPENAI
|
| 24 |
LLM_API_KEY=your_api_key_here
|
| 25 |
+
LLM_MODEL=gpt-4.1
|
| 26 |
+
MCP_SERVER_URL=http://localhost:8080/mcp/
|
| 27 |
```
|
| 28 |
|
| 29 |
+
## 🛠️ Installation
|
| 30 |
|
| 31 |
+
1. Clone the repository:
|
| 32 |
```bash
|
| 33 |
git clone https://github.com/yourusername/dpc_mcp_client.git
|
| 34 |
cd dpc_mcp_client
|
| 35 |
```
|
| 36 |
|
| 37 |
+
2. Install dependencies using UV:
|
| 38 |
```bash
|
| 39 |
+
uv sync
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
```
|
| 41 |
|
| 42 |
+
## 🚀 Usage
|
| 43 |
|
| 44 |
+
To start the application:
|
| 45 |
|
| 46 |
```bash
|
| 47 |
uv run app.py
|
| 48 |
```
|
| 49 |
|
| 50 |
+
* Once started, the Gradio interface will automatically open in your browser. You can query Product Catalog APIs through this interface.
|
| 51 |
+
* Click the link to open the Gradio interface in your browser: [http://0.0.0.0:7860](http://0.0.0.0:7860)
|
| 52 |
|
| 53 |
+
|
| 54 |
+
## 📁 Project Structure
|
| 55 |
|
| 56 |
```
|
| 57 |
dpc_mcp_client/
|
| 58 |
+
├── app.py # Gradio UI and main application
|
| 59 |
+
├── mcp_client.py # MCP Client implementation
|
| 60 |
+
├── resources/ # Resource files
|
| 61 |
│ ├── instruction.txt
|
| 62 |
│ └── dpc_restapi_summary.txt
|
| 63 |
+
├── pyproject.toml # Project dependencies
|
| 64 |
└── README.md
|
| 65 |
```
|
| 66 |
|
| 67 |
+
## 🔧 Dependencies
|
| 68 |
|
| 69 |
- environs>=14.2.0
|
| 70 |
- gradio>=5.32.1
|
|
|
|
| 73 |
- langgraph>=0.4.8
|
| 74 |
- loguru>=0.7.3
|
| 75 |
|
| 76 |
+
## 🤝 Contributing
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 77 |
|
| 78 |
+
1. Fork the repository
|
| 79 |
+
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
|
| 80 |
+
3. Commit your changes (`git commit -m 'Add some amazing feature'`)
|
| 81 |
+
4. Push to the branch (`git push origin feature/amazing-feature`)
|
| 82 |
+
5. Open a Pull Request
|
| 83 |
|
|
|
mcp_client.py
CHANGED
|
@@ -74,6 +74,12 @@ class MCPClient:
|
|
| 74 |
|
| 75 |
async def initialize(self):
|
| 76 |
logger.info("Initializing MCP client...")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 77 |
self.system_message = "".join([self.instruction, "\n\n", self.api_description])
|
| 78 |
|
| 79 |
async def invoke(self, input_messages):
|
|
|
|
| 74 |
|
| 75 |
async def initialize(self):
|
| 76 |
logger.info("Initializing MCP client...")
|
| 77 |
+
logger.info("Print Environment Variables: \n")
|
| 78 |
+
logger.info(f"LLM_PROVIDER: {LLM_PROVIDER}")
|
| 79 |
+
logger.info(f"LLM_API_KEY: {LLM_API_KEY[:12]}...")
|
| 80 |
+
logger.info(f"LLM_MODEL: {LLM_MODEL}")
|
| 81 |
+
logger.info(f"MCP_SERVER_URL: {MCP_SERVER_URL}")
|
| 82 |
+
|
| 83 |
self.system_message = "".join([self.instruction, "\n\n", self.api_description])
|
| 84 |
|
| 85 |
async def invoke(self, input_messages):
|