AI Agent MCP Server

AI Agent MCP Server

Enables ChatGPT agents to store and retrieve reports in MongoDB Atlas, acting as a bridge between ChatGPT scheduled agents and a persistent database.

Category
Visit Server

README

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)

STEP 1 — MongoDB Atlas Setup (Free)

  1. cloud.mongodb.com pe jao
  2. Free account banao
  3. New Project → Create Cluster → M0 Free select karo
  4. Username aur Password set karo (yaad rakhna!)
  5. Network Access → Add IP Address → Allow from anywhere (0.0.0.0/0)
  6. Connect → Drivers → Node.js → Connection string copy karo:
    mongodb+srv://USERNAME:PASSWORD@cluster0.xxxxx.mongodb.net/ai_agents
    
  7. Yeh 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 main

STEP 3 — Railway pe Deploy Karo (Free)

  1. railway.app pe jao → Free account banao
  2. New Project → Deploy from GitHub repo
  3. Apna ai-agent-mcp repo select karo
  4. Variables tab mein yeh add karo:
    MONGO_URI = mongodb+srv://USERNAME:PASSWORD@cluster0.xxxxx.mongodb.net/ai_agents
    PORT = 3000
    
  5. Deploy click karo
  6. Kuch minutes mein URL milega jaise:
    https://ai-agent-mcp-production.up.railway.app
    
  7. Browser 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

  1. chatgpt.com → Settings → Developer Mode ON karo
  2. Apna Agent open karo (Edit)
  3. Apps → Custom MCP → Enable
  4. MCP Server URL daalo:
    https://ai-agent-mcp-production.up.railway.app/mcp
    
  5. Save karo → Tools appear honge:
    • save_data
    • get_data
    • get_latest
    • log_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 karo

STEP 6 — Data Dekho

Option A: MongoDB Atlas Dashboard

  • cloud.mongodb.com → Apna cluster → Browse Collections
  • ai_agents database → agentdatas collection

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=5

API 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 /mcp path daala?

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured