AI Agent with MCP Integration
A simple, modular AI agent that can chat and use MCP (Model Context Protocol) servers for various capabilities.
Features
✅ Conversational AI - Chat naturally with the agent
✅ MCP Integration - Uses MCP servers for extended capabilities
✅ Echo Server - Test server for debugging MCP connections
✅ Filesystem Access - Read/write local files through MCP
🔜 Flight APIs - Ready for Amadeus/Duffel integration (API keys required)
Quick Start
- Install dependencies:```bash
npm install
2. **Start the chat interface:**```bash
npm run chat
- Run tests:```bash
npm run test
## Project Structure```
ai-agent-mcp/
├── .claude/
│ └── claude_desktop_config.json # Claude Desktop MCP config
├── config/
│ └── mcp-servers.json # MCP server configurations
├── src/
│ ├── Agent.js # Main agent logic
│ ├── MCPClient.js # MCP client wrapper
│ ├── chat.js # Interactive chat interface
│ └── test.js # Test script
├── workspace/ # Filesystem MCP working directory
└── package.json
Available Commands
When chatting with the agent:
help- Show available commandsshow tools- List MCP capabilitiesecho [message]- Test echo serverread file "filename"- Read a filewrite file "filename" with "content"- Write to a filelist files- Show files in workspaceexit- Quit the chat
Adding New MCP Servers
Edit config/mcp-servers.json to add new servers:```json
{
"servers": {
"your-server": {
"enabled": true,
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-name"],
"env": {
"API_KEY": "your-key-here"
},
"description": "Your server description"
}
}
}
## Example Chat Session```
You > help
Agent > [Shows help menu with available commands]
You > echo Hello World!
Agent > 🔊 Echo server response: Hello World!
You > write file "notes.txt" with "My first note"
Agent > ✅ Successfully wrote to notes.txt
You > read file "notes.txt"
Agent > 📄 File contents of notes.txt:
My first note
You > list files
Agent > 📁 Files in workspace:
notes.txt
README.md
Extending the Agent
The project is designed to be modular:
- Add new MCP servers in
config/mcp-servers.json - Extend Agent.js to handle new conversation patterns
- Update MCPClient.js for custom tool handling
Troubleshooting
- MCP server connection failed: Ensure npx can download and run the MCP servers
- File operations not working: Check that the
workspacedirectory exists - Tools not showing: Verify MCP servers are enabled in config
Future Enhancements
- [ ] Add persistent conversation history
- [ ] Integrate with OpenAI/Anthropic APIs
- [ ] Add more MCP servers (weather, database, etc.)
- [ ] Implement conversation context management
- [ ] Add web UI interface
