Here is the refined, professional-grade **Requirements Specification** formatted specifically for your `func_req.md` file. You can copy this directly.
---
# Requirements Specification: Confluence MCP System
## 1. Project Overview
This project aims to bridge **Confluence Wiki** and **LLMs (Large Language Models)** using the **Model Context Protocol (MCP)**. It consists of a server that fetches wiki data via Confluence APIs and a simple host client to interact with that data.
## 2. System Architecture
1. **Source**: Confluence Cloud/Server (REST API).
2. **MCP Server**: A containerized Python application that translates Confluence data into MCP-compliant Tools and Resources.
3. **MCP Host**: A lightweight client used to initialize the connection and execute commands against the server.
---
## 3. Functional Requirements\
### [REQ-01] Confluence MCP Server
- **API Integration**: Connect to Confluence REST API using Basic Auth (Email + API Token).
- **Data Transformation**: Convert Confluence Storage Format (XHTML-based) into **Clean Markdown** for better LLM context window efficiency.
- **Exposed Tools**:
- `search_confluence(query)`: Search for pages, blog posts, or attachments.
- `read_page(page_id)`: Fetch the full content of a specific page.
- `list_space_content(space_key)`: List all pages within a specific workspace.
- **Error Handling**: Graceful handling of 404 (Page Not Found) and 401 (Unauthorized) errors.
### [REQ-02] Containerization
- **Docker Integration**: The MCP server must be packaged as a Docker container.
- **Standard I/O**: The containerized server must support communication via `Streamable HTTP` to allow the host to pipe commands.
- **Environment Config**: Sensitive data (Confluence URL, Token, Email) must be passed via env file.
### [REQ-03] Simple MCP Host
- **Connection Management**: Ability to spawn the MCP Server container and establish a persistent session.
- **CLI Interface**: A simple prompt or command-line argument system to trigger server tools.
- **Output Display**: Format the data returned by the server clearly in the MCP Inspector.
---
## 4. Technical Stack & Constraints
- **Language**: Python 3.11+
- **Framework**: `mcp` (Official Python SDK) or `fastmcp`
- **API Client**: `atlassian-python-api` or `httpx`
- **Format**: All data exchanged between server and host must follow the **Model Context Protocol 1.0** specification.
---
## 5. Implementation Roadmap (Tasks)
1. [x] Setup Python environment and install `mcp` and `atlassian-python-api`.
2. [x] Implement `server.py` with `search` and `read` tools.
3. [x] Create `Dockerfile` to containerize the server.
4. [x] Implement `host.py` to test the containerized connection via `Streamable HTTP` with MCP Inspector.
---
### How to use this with Gemini CLI:
Once you have saved this as `func_req.md`, run the following command to start development:
```bash
gemini "$(cat func_req.md) \n\n Based on these requirements, please generate the 'server.py' using the Python MCP SDK and 'atlassian-python-api' library."
```
**Would you like me to generate the `Dockerfile` or the `server.py` boilerplate code based on these requirements first?**