Confluence Knowledge Base MCP Server
Turns Confluence documentation into an AI-powered knowledge base, enabling natural language questions about your systems with answers retrieved from your actual documentation through semantic search.
README
Confluence Knowledge Base MCP Server
An MCP server that turns your Confluence documentation into an AI-powered knowledge base for Gemini CLI. Ask natural language questions about your systems and get answers from your actual documentation.
Quick Start
One-Command Setup
git clone <this-repo>
cd confluence-knowledge-base
./install.sh
The interactive wizard will:
- ✅ Install dependencies in a virtual environment
- ✅ Ask for your Confluence credentials
- ✅ Discover your spaces
- ✅ Help you choose which spaces to index
- ✅ Build the initial knowledge base
- ✅ Configure Gemini CLI automatically (merges with existing config)
What You'll Need
Before running the installer:
-
Confluence API Token
- Go to: https://id.atlassian.com/manage-profile/security/api-tokens
- Click "Create API token"
- Copy the token (you won't see it again!)
-
Your Confluence URL
- Example:
https://yourcompany.atlassian.net
- Example:
-
Python 3.8+ installed
- The installer creates a virtual environment automatically (no system-wide packages needed)
-
Gemini CLI installed
- Install from: https://github.com/google-gemini/gemini-cli
Usage
Once installed, just start Gemini CLI and ask questions:
gemini
> How does our authentication system work?
> What's the process for deploying to production?
> Explain our database migration strategy
> What are the API rate limits?
Gemini will automatically retrieve relevant documentation and answer your questions!
How It Works
1. Your Confluence docs → Downloaded and indexed (one-time)
2. You ask a question → Semantic search finds relevant chunks
3. Gemini gets context → Answers based on YOUR docs
Technologies Used
- FastMCP - MCP server framework
- ChromaDB - Local vector database
- sentence-transformers - Semantic search
- Confluence REST API - Documentation retrieval
Project Structure
confluence-knowledge-base/
├── install.sh # Interactive setup wizard
├── confluence_knowledge_base.py # Main MCP server
├── confluence_kb_with_staleness.py # Version with auto-reindex
├── find_space_keys.py # Space discovery utility
├── requirements.txt # Python dependencies
├── KNOWLEDGE_BASE_SETUP.md # Detailed setup guide
└── README.md # This file
Configuration
After installation, configuration is stored in:
- Credentials:
~/.confluence_mcp.env - Index:
~/.confluence_mcp/index/ - Gemini Config:
~/.gemini/settings.json - Virtual Environment:
./venv/(in the project directory)
Updating Documentation
When your Confluence docs are updated:
Option 1: Ask Gemini
> Reindex the Confluence documentation
Option 2: Command line
./venv/bin/python confluence_knowledge_base.py
Option 3: Automated (Weekly)
Set up a cron job (see REINDEXING_GUIDE.md)
Customization
Change indexed spaces
Edit ~/.confluence_mcp.env:
export CONFLUENCE_SPACES="ENG,DEVOPS,TEAM"
Then rebuild the index.
Adjust chunk size
In confluence_knowledge_base.py:
CHUNK_SIZE = 1000 # Default: 1000 characters
CHUNK_OVERLAP = 200 # Default: 200 characters
Change embedding model
For better quality (slower, larger):
self.embedding_model = SentenceTransformer('all-mpnet-base-v2')
Troubleshooting
"Connection failed"
Check that:
- Your Confluence URL is correct
- Your API token is valid
- You have internet connectivity
"No spaces found"
You might not have access to any Confluence spaces. Ask your admin for access.
Slow indexing
Normal for large documentation sets (500+ pages). Reduce spaces or run overnight.
Wrong/outdated answers
Your index is cached! Reindex when docs are updated:
rm -rf ~/.confluence_mcp
./install.sh
Advanced Usage
Manual space discovery
source ~/.confluence_mcp.env
python3 find_space_keys.py
Staleness detection
Use the enhanced version with automatic staleness warnings:
# In ~/.gemini/settings.json, change the args to:
"args": ["confluence_kb_with_staleness.py"]
Add environment variables:
export MAX_INDEX_AGE_DAYS=7
export AUTO_REINDEX=true
Scheduled reindexing
See REINDEXING_GUIDE.md for cron job setup.
FAQ
Q: Does this modify my Confluence documentation? A: No, it's read-only. It only downloads and indexes content.
Q: Where is my data stored?
A: Locally in ~/.confluence_mcp/index/. Nothing is sent to external services except Gemini API calls.
Q: How much does it cost? A: The MCP server is free. You only pay for Gemini API usage (queries to the AI).
Q: Can I use this with Claude instead of Gemini? A: Yes! MCP is a standard protocol. Just configure Claude Desktop to use this MCP server.
Q: How often should I reindex? A: Depends on how often your docs are updated. Weekly is common. Daily if very active.
Q: Can I exclude certain pages?
A: Not by default, but you can modify confluence_knowledge_base.py to filter by title, label, etc.
Q: What about attachments/PDFs? A: Currently only page content is indexed. Attachments could be added with additional code.
Documentation
KNOWLEDGE_BASE_SETUP.md- Comprehensive setup guideREINDEXING_GUIDE.md- Strategies for keeping docs fresh
Contributing
Feel free to:
- Add features (write capabilities, attachment support, etc.)
- Improve chunking strategies
- Add better error handling
- Create additional tools
License
[Your license here]
Support
For issues or questions:
- Check the troubleshooting section above
- Review the detailed guides in
/docs - Open an issue on GitHub
Ready to get started? Just run:
./install.sh
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。