Labsco
Rommagcom logo

LLM Chat Assistant

โ˜… 2

from Rommagcom

A chat assistant that integrates an MCP client with an LLM and other external MCP servers.

๐Ÿ”ฅ๐Ÿ”ฅโœ“ VerifiedFreeAdvanced setup

LLM Chat Assistant

This project is a chat assistant application that integrates MCP client (MCP host) with an LLM (Large Language Model) and external tools (MCP Servers). It allows users to interact with the LLM, which can either provide direct answers or call external tools (MCP servers) to process user requests.

Supported modes

  • stdio Mode
  • http Mode

Features

  • LLM Integration: Communicates with an LLM using the pydantic-ai library.
  • Tool Execution: Supports external tools - MCP servers that can be executed based on user input.
  • Structured Responses: Handles structured responses from the LLM, including tool calls and direct answers.
  • Server Management: Manages multiple MCP servers for tool execution.

Interaction Example

  • You: echo test (After this request LLM determine to call neccessery Tool from MCP server)

  • Assistant: The result of the echo test is a text containing the message "This is echo test test". (Direct answer from MCP server)

  • You: How is the weather in Phuket ?

  • Assistant: The weather in Phuket is currently being retrieved via the API, with the mock response indicating it's a simulated result.

Add your MCP server

  1. Add to mcp-server folder new .py file like in examples echo.py or weater_server.py or test_http_server.py 2. Add section to servers_config.json like where 'echo' is tool name in .py file -> @mcp.tool(description="A simple echo tool", name="echo") "args": ["mcp-servers/weather_server.py"] full server file path

    {
    	"mcpServers": {
    		"echo": {
    			"command": "python",
    			"args": ["mcp-servers/echo.py"]
    		},
    		"weather_server": {
    			"command": "python",
    			"args": ["mcp-servers/weather_server.py"]
    		}
    	}
    }
    
    For http use case add http(s) MCP server url to config as: "url": "http://127.0.0.1:9000/mcp" and server name like "test_http" as in :
    
    ```Example:
    {
    	"mcpServers": {
    		"test_http": {
      			"url": "http://127.0.0.1:9000/mcp"
    		}
    	}
    }