genai-llm-agent-mcp-server

akhil-jr/genai-llm-agent-mcp-server

3.1

If you are the rightful owner of genai-llm-agent-mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

A standalone HTTP MCP server with an integrated agent capable of reading tools from the server.

genai-llm-agent-mcp-server

A Model Context Protocol (MCP) server that provides HTTP-based tool serving capabilities for LangChain agents. Also there is an agent connecting to the mcp server.

Fetures

MCP server

  • can work standalone as FTTP server
  • can also work in stdio mode for local development

Agent

  • Use tools from MCP server
  • Use local tools

Quick Start

1. Setup

git clone https://github.com/akhil-jr/genai-llm-agent-mcp-server.git
cd genai-llm-agent-mcp-server
pip install -r requirements.txt

2. Run the MCP server

Start the mcp server in a seperate window

cd genai-llm-agent-mcp-server
python -m mcp_server.server

3. Run the Agent

In the original console continue to run below queries

cp .env.example .env
#Add your gemini API key in .env file
python -m agent.main

Additional configuration for MCP server

For running with custom params

python server.py --transport http --host 0.0.0.0 --port 8080 --path /mcp

for running in stdio mode (not supported by included agent):

python server.py --transport stdio

Command Line Arguments

  • --transport: Transport protocol (stdio, http, sse) - default: http
  • --host: HTTP server host - default: 127.0.0.1
  • --port: HTTP server port - default: 8000
  • --path: HTTP endpoint path - default: /mcp

Programmatic Usage

Connecting to stdio server

import asyncio
from fastmcp import Client
from src.http_mcp_tools.tools import create_mcp_server

async def main():
    # Create and run server
    mcp = create_mcp_server()
    
    # Connect via client
    async with Client(mcp) as client:
        # Use tools
        result = await client.call_tool("get_customer_details", {"customer_id": "102"})
        print(result.content[0].text)

asyncio.run(main())

Connecting to HTTP Server

import asyncio
from fastmcp import Client

async def connect_to_remote_server():
    async with Client("http://localhost:8000/mcp") as client:
        result = await client.call_tool("get_customer_details", {"customer_id": "102"})
        print(result.content[0].text)

asyncio.run(connect_to_remote_server())