This project is a powerful and modular AI agent system that generates and posts professional LinkedIn content using OpenAI and LangChain, built with a clean MCP architecture. It takes an input idea from the user, transforms it into a high-quality LinkedIn post using a custom prompt template, and posts it directly to the user's LinkedIn profile using LinkedIn’s API.
- ✨ Human-style LinkedIn post generation with strict tone and structure guidelines
- 🧠 LangChain agent powered by OpenAI LLM (
gpt-4o) - 🧩 Modular MCP design: scalable and extendable with additional tools (e.g., X, Instagram)
- 🔧 Built-in LinkedIn posting tool via LinkedIn REST API
- 🖥️ Streamlit frontend for clean user interaction
- 🔄 FastAPI backend for MCP logic orchestration
- Python — Core backend language
- Streamlit — Web application framework for UI
- FastAPI — Backend API layer for handling requests and MCP orchestration
- OpenAI GPT-4o — LLM used for generating high-quality, human-style LinkedIn posts
- LangChain — Agent framework for chaining prompt execution and tool usage
- LinkedIn REST API — Used to post directly to LinkedIn profiles
/project-root/
├── streamlit_app/
│ └── app.py
│
├── mcp_server/
│ ├── main.py
│ ├── agent_runner.py
│ ├── llm/
│ │ └── llm_config.py
│ ├── agents/
│ │ └── post_writer_agent.py
│ └── tools/
│ └── linkedin_poster.py
├── .env
├── requirements.txt
└── README.md #
git clone https://github.com/vetrivel07/linkedin-post-agent.git
cd linkedin-agent
python -m venv venv
venv\Scripts\activate
source venv/bin/activate
pip install -r requirements.txt
Create a .env file in the project root.
See Environment Variables section below for details.
From the project root:
uvicorn mcp_server.main:app --host 0.0.0.0 --port 8000 --reload
Verify backend is running:
Open browser → http://localhost:8000/docs
Open a second terminal, activate the same virtual environment, then:
streamlit run streamlit_app/app.py
The app will be available at:
http://localhost:8501
- Enter your LinkedIn post idea in the UI
- Click Generate & Post
- The agent:
- Generates a professional post using OpenAI
- Posts it to LinkedIn using your authorized account
Create a .env file in the project root with the following variables:
# OpenAI
OPENAI_API_KEY=sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxx
# LinkedIn OAuth (Application credentials)
LINKEDIN_ACCESS_TOKEN=your_access_token_here
# LinkedIn User Token (generated via OAuth)
LINKEDIN_URN=urn:li:person:your_urn_here
© Created by Vetrivel Maheswaran

