albertshao_wiki_mcp_server

albertshao_wiki_mcp_server

3.5

An MCP (Model Context Protocol) Server implementation for managing Confluence wiki pages.

๐Ÿ“š Wiki MCP Server

An MCP (Model Context Protocol) Server implementation for managing Confluence wiki pages.

Supports:

  • Creating new wiki pages
  • Updating existing wiki pages
  • Deleting wiki pages
  • Searching wiki pages by keyword
  • Auto-selecting correct Confluence knowledge base (alm, wpb, etc.) based on user query

Built with FastAPI, following MCP Server Best Practices, and ready for production deployment.


๐Ÿš€ Tech Stack

  • Python 3.10+
  • FastAPI
  • MCP SDK
  • Requests (for Confluence API interaction)
  • ContextVars (for session management)

๐Ÿ“ฆ Project Structure

wiki_mcp_server/
โ”œโ”€โ”€ src/wiki_mcp_server/
โ”‚   โ”œโ”€โ”€ server.py          # MCP server entry point
โ”‚   โ”œโ”€โ”€ service.py         # Business logic (Confluence API interactions)
โ”‚   โ”œโ”€โ”€ tools.py           # MCP tool definitions
โ”‚   โ”œโ”€โ”€ prompts.py         # MCP prompt definitions
โ”‚   โ”œโ”€โ”€ resources.py       # MCP resource definitions
โ”‚   โ”œโ”€โ”€ utils.py           # Helper functions (wiki_type inference etc.)
โ”‚   โ”œโ”€โ”€ utils/session_context.py  # Session context manager
โ”‚   โ””โ”€โ”€ middleware.py      # Authentication and session initialization middleware
โ”œโ”€โ”€ Dockerfile             # Container configuration
โ”œโ”€โ”€ requirements.txt       # Python dependencies
โ”œโ”€โ”€ README.md              # Project documentation
โ”œโ”€โ”€ smithery.yaml          # Smithery integration config (optional)
โ””โ”€โ”€ pyproject.toml         # Python project metadata

โš™๏ธ Installation

  1. Clone the repository:
git clone https://your-repo-url/wiki_mcp_server.git
cd wiki_mcp_server
  1. Install dependencies:
pip install -r requirements.txt
  1. (Optional) Configure your environment variables if needed.

๐Ÿ›  Running Locally

Run the server:

cd src
uvicorn wiki_mcp_server.server:app --host 0.0.0.0 --port 9999 --reload

After startup, you can visit:


๐Ÿงช Example Request

Headers Required:

KeyExample Value
user_name
alm_confluence_base_urlhttps://your-confluence-site/wiki/rest/api
alm_confluence_api_tokenyour-api-token
wpb_confluence_base_url(optional if available)
wpb_confluence_api_token(optional if available)

โš ๏ธ If headers are missing or invalid, server will return HTTP 400 error.


Example: Create Page

POST /create_page

{
  "space_key": "TEST",
  "title": "Test Page Created by MCP Server",
  "content": "<p>Hello, World!</p>",
  "user_query": "Please create a page in GSNA knowledge base."
}

Behavior:

  • Server will infer wiki_type=alm from user_query.
  • Create the page in Confluence and return page metadata.

๐Ÿง  Auto Inference Logic

  • If the query mentions gsna, global, alm-confluence โ†’ alm
  • If the query mentions wpb, wealth โ†’ wpb
  • Otherwise default to alm

(You can also manually specify wiki_type in input)


๐Ÿณ Docker (Optional)

Build and run containerized server:

docker build -t wiki-mcp-server .
docker run -d -p 9999:9999 --name wiki-mcp-server wiki-mcp-server

๐Ÿ“œ License

MIT License.


๐Ÿ“ž Contact

For issues or collaboration requests, please contact:

  • Developer: Shawn
  • Email:
  • Project maintained by internal MCP Working Group

---# wiki_mcp_server