AI Agent MCP Server
Saves and retrieves data from MongoDB Atlas, enabling ChatGPT agents to permanently store reports, activity logs, and other structured data.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@AI Agent MCP ServerSave SEO scan result for example.com: status success, score 85"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
AI Agent MCP Server
ChatGPT Agent Reports ko MongoDB mein store karo ā Step by Step Guide
Yeh Kya Hai?
ChatGPT ke scheduled agents kaam karte hain aur reports apni chat mein store karte hain. Yeh server ek bridge hai jo:
ChatGPT Agent se data receive karta hai (Custom MCP ya REST API)
MongoDB Atlas mein permanently store karta hai
Kisi bhi time data retrieve karne deta hai
ā° ChatGPT Scheduled Agent
ā
š§ Yeh MCP Server (/mcp endpoint)
ā
š¾ MongoDB Atlas Database
ā
š Kabhi bhi data dekho (API ya Atlas Dashboard)Related MCP server: Team Manager MCP
STEP 1 ā MongoDB Atlas Setup (Free)
cloud.mongodb.com pe jao
Free account banao
New Project ā Create Cluster ā M0 Free select karo
Username aur Password set karo (yaad rakhna!)
Network Access ā Add IP Address ā Allow from anywhere (0.0.0.0/0)
Connect ā Drivers ā Node.js ā Connection string copy karo:
mongodb+srv://USERNAME:PASSWORD@cluster0.xxxxx.mongodb.net/ai_agentsYeh string save kar lo ā baad mein chahiye hogi
STEP 2 ā GitHub pe Upload Karo
# Project folder mein jao
cd ai-agent-mcp
# Git initialize karo
git init
git add .
git commit -m "Initial commit"
# GitHub pe new repository banao: github.com/new
# Phir yeh commands chalao:
git remote add origin https://github.com/TERA_USERNAME/ai-agent-mcp.git
git push -u origin mainSTEP 3 ā Railway pe Deploy Karo (Free)
railway.app pe jao ā Free account banao
New Project ā Deploy from GitHub repo
Apna
ai-agent-mcprepo select karoVariables tab mein yeh add karo:
MONGO_URI = mongodb+srv://USERNAME:PASSWORD@cluster0.xxxxx.mongodb.net/ai_agents PORT = 3000Deploy click karo
Kuch minutes mein URL milega jaise:
https://ai-agent-mcp-production.up.railway.appBrowser mein kholo ā
{"status": "ā AI Agent MCP Server is running!"}dikhega
Yeh URL save kar lo ā ChatGPT mein daalna hai!
STEP 4 ā ChatGPT mein Custom MCP Connect Karo
chatgpt.com ā Settings ā Developer Mode ON karo
Apna Agent open karo (Edit)
Apps ā Custom MCP ā Enable
MCP Server URL daalo:
https://ai-agent-mcp-production.up.railway.app/mcpSave karo ā Tools appear honge:
save_dataget_dataget_latestlog_activity
STEP 5 ā Agent Instructions Update Karo
Agent ke Instructions mein yeh add karo:
IMPORTANT: Har task complete karne ke baad HAMESHA yeh karo:
1. Apna kaam karo (SEO check / analysis / report)
2. save_data tool call karo:
- agentName: "[TERA AGENT KA NAAM]"
- taskType: "[kya kiya, e.g. seo_scan]"
- status: "success" ya "failed"
- payload: {
summary: "kya mila",
details: [...findings...],
recommendations: [...suggestions...]
}
- metadata: {
url: "[website jo check ki]",
model: "gpt-4",
duration: "[kitna time laga]"
}
3. Kabhi bhi sirf chat mein result mat rakho
4. Hamesha database mein save karoSTEP 6 ā Data Dekho
Option A: MongoDB Atlas Dashboard
cloud.mongodb.com ā Apna cluster ā Browse Collections
ai_agentsdatabase āagentdatascollection
Option B: API se
# Sab agents dekho
GET https://tera-server.up.railway.app/api/agents
# Specific agent ki reports
GET https://tera-server.up.railway.app/api/reports/SEO%20Agent
# Latest report
GET https://tera-server.up.railway.app/api/latest/SEO%20Agent
# Filter karo
GET https://tera-server.up.railway.app/api/reports/SEO%20Agent?taskType=seo_scan&limit=5API Reference
POST /api/save
{
"agentName": "SEO Agent",
"taskType": "seo_scan",
"status": "success",
"payload": {
"website": "example.com",
"score": 85,
"issues": ["Missing meta description", "Slow page speed"],
"recommendations": ["Add meta tags", "Optimize images"]
},
"metadata": {
"url": "https://example.com",
"checkedAt": "2024-01-15T09:00:00Z"
}
}GET /api/reports/:agentName
Query params: limit, page, taskType, status
GET /api/latest/:agentName
GET /api/agents
Local Testing (Optional)
# Dependencies install karo
npm install
# .env file banao
cp .env.example .env
# .env mein MONGO_URI daalo
# Server start karo
npm run dev
# Test karo
curl -X POST http://localhost:3000/api/save \
-H "Content-Type: application/json" \
-d '{"agentName":"Test Agent","taskType":"test","payload":{"message":"Hello!"}}'Project Structure
ai-agent-mcp/
āāā server.js ā Main entry point
āāā package.json ā Dependencies
āāā railway.toml ā Railway deploy config
āāā .env.example ā Environment variables template
āāā .gitignore
āāā models/
ā āāā AgentData.js ā MongoDB schema
āāā routes/
ā āāā api.js ā REST API endpoints
āāā mcp/
āāā tools.js ā MCP tools (save_data, get_data, etc.)Problem Aaye Toh?
Problem | Solution |
MongoDB connect nahi | IP whitelist check karo (0.0.0.0/0 hona chahiye) |
Railway deploy fail | Logs check karo ā Variables mein MONGO_URI sahi daala? |
ChatGPT MCP nahi dikha | Developer Mode ON hai? Business/Plus plan chahiye |
Tools appear nahi | MCP URL mein |
This server cannot be deployed
Maintenance
Related MCP Connectors
An agent-native database over MCP: shared, validated, structured records in every AI chat.
Persistent memory for AI agents across Claude, ChatGPT and any MCP client.
Shared, governed long-term memory for AI agents across tools and sessions via MCP and REST.
Universal persistent memory and knowledge retrieval layer for AI agents and LLMs.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables LLMs to interact with MongoDB databases through a complete suite of CRUD operations, administrative tasks, and index management tools. It supports database and collection handling, aggregation pipelines, and comprehensive server monitoring via the Model Context Protocol.3MIT
- FlicenseNot gradedqualityDmaintenanceEnables users to plan, coordinate, and govern multi-agent teams using MongoDB for shared context, token budgets, and checkpoint recovery.2-
- FlicenseNot gradedqualityDmaintenanceEnables AI agents to query MongoDB databases and project management REST APIs through a universal MCP interface, providing read-time access to workspace data.-
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to interact with MongoDB databases through natural language, supporting document CRUD, aggregation, collection listing, and statistics.71,399Apache 2.0