GitHub Stars
0
User Rating
Not Rated
Forks
0
Issues
0
Views
1
Favorites
0
π§ MCP Server AI Agent
This repository implements an AI agent compatible with Model Context Protocol (MCP), enabling seamless interaction with tools exposed by an MCP-compliant server.
The agent connects to a local or remote MCP server, automatically discovers available tools, and intelligently invokes them based on user input using chain-of-thought prompting and tool planning strategies.
β¨ Features
- β Tool Auto-Discovery via MCP protocol
- π§© Tool Planning using natural language reasoning
- π Flexible Transport Support: STDIO and HTTP/SSE
- π¦ Modular Architecture for extensibility
- π£οΈ LLM-Powered Responses that include tool results
π Getting Started
1. Clone and Install
git clone https://github.com/Mehedy-Tanvir/mcp-server-ai-agent.git
cd mcp-server-ai-agent
npm install
2. Configuration
Create a .env
file in the root directory with the following variables:
MCP_TRANSPORT=stdio # or "http"
MCP_SERVER_URL=http://localhost:3000
LLM_API_KEY=your-openai-or-anthropic-key
3. Run the Agent
npm start
The agent will connect to the MCP server and start handling inputs via the selected transport.
π Project Structure
mcp-server-ai-agent/
β
βββ src/
β βββ agent/ # Agent logic for reasoning, tool calling
β βββ transports/ # Communication layer (STDIO, HTTP/SSE)
β βββ tools/ # Tool invocation and handling
β βββ main.ts # Entry point
β
βββ .env # Configuration file
βββ package.json # Node project metadata
βββ README.md # Project documentation
π§ How It Works
- Agent connects to the MCP server and fetches the list of available tools.
- For each user prompt, it plans tool usage using LLM reasoning.
- Tools are called via MCP, and the result is injected back into the conversation.
- Final response is generated and returned to the user.
π§ͺ Example
Prompt:
What's the weather in Dhaka?
Flow:
- Agent finds a
getWeather(city)
tool - Calls:
getWeather("Dhaka") β "32Β°C, sunny"
- Responds: "Itβs currently 32Β°C and sunny in Dhaka."
π Requirements
- Node.js 18+
- MCP server running locally or remotely
- An LLM API key (e.g. OpenAI, Anthropic)
π€ Contributing
Contributions, improvements, and new ideas are welcome!
Please open issues or submit pull requests with your enhancements.
π License
This project is licensed under the MIT License.
π Credits
Created by Mehedy Tanvir
Inspired by the Anthropic MCP reference
Hi, I'm a Full stack developer passionate about React, Node, Express, and MongoDB. I'm aspiring to become a senior developer in next two years.
5
Followers
157
Repositories
0
Gists
3
Total Contributions