Content Server
Manages environment configuration for the MCP server, specifically handling USER_ID and CONTENT_SERVICE_URL variables.
Used as the web framework for potential future REST API functionality within the MCP server.
Used for development workflows to enforce code quality standards through Git hooks.
Provides data validation for the MCP server's request and response structures.
Powers the testing framework for the MCP server, including unit tests and coverage reporting.
Provides fast Python linting capabilities for the codebase.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Content Server search for content about our quarterly marketing strategy"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
RAG MCP Server (Python)
This is a Python implementation of the RAG (Retrieval-Augmented Generation) MCP (Model Context Protocol) server, equivalent to the Java version. It provides tools for managing organizational content through a content service API.
Features
The server provides the following MCP tools:
listContentNames - List all content names from the organization's database, optionally filtered by name
searchOrganizationContents - Search through the organization's content database using semantic search
deleteOrganizationContent - Delete specific content from the organization's database
uploadContentFileAboutOrganization - Upload content files about the organization
uploadContentUrlAboutOrganization - Upload content URLs about the organization
Related MCP server: OrgX MCP
Prerequisites
Install uv for fast Python package management:
# Install uv
curl -LsSf https://astral.sh/uv/install.sh | sh
# or
pip install uvQuick Start
The fastest way to get started:
# Run tests
./test_uv.sh
# Start the server
./run_server_uv.shInstallation Options
Option 1: Using uv with pyproject.toml (Recommended)
Dependencies are automatically managed from pyproject.toml:
# Run directly (uv reads pyproject.toml automatically)
uv run mcp_server.py
# Or run tests
uv run test_server.py
# Install in development mode
uv sync
# Install with development dependencies
uv sync --devOption 2: Using uv with inline dependencies
No configuration files needed - dependencies declared inline:
# Run directly with inline dependencies
uv run \
--with mcp==1.0.0 \
--with fastapi==0.115.5 \
--with uvicorn==0.32.1 \
--with requests==2.32.3 \
--with python-multipart==0.0.17 \
--with pydantic==2.10.3 \
--with python-dotenv==1.0.1 \
mcp_server.pyOption 3: Traditional Virtual Environment with uv
# Create and activate virtual environment
uv venv
source .venv/bin/activate
# Install dependencies
uv pip install mcp==1.0.0 fastapi==0.115.5 uvicorn==0.32.1 requests==2.32.3 python-multipart==0.0.17 pydantic==2.10.3 python-dotenv==1.0.1
# Run the server
python mcp_server.pyConfiguration
Copy the example environment file:
cp env.example .envEdit
.envfile with your configuration:
USER_ID=your_user_id_here
CONTENT_SERVICE_URL=http://localhost:8080Usage
Running the MCP Server
Option 1: Using the uv startup script (recommended)
./run_server_uv.shScript automatically detects pyproject.toml and uses it, falling back to inline dependencies
Option 2: Using the traditional startup script
./run_server.shOption 3: Direct execution with uv
# With pyproject.toml
uv run mcp_server.py
# Or with inline dependencies
uv run \
--with mcp==1.0.0 \
--with fastapi==0.115.5 \
--with uvicorn==0.32.1 \
--with requests==2.32.3 \
--with python-multipart==0.0.17 \
--with pydantic==2.10.3 \
--with python-dotenv==1.0.1 \
mcp_server.pyThe server will start and listen for MCP protocol messages via stdin/stdout.
Environment Variables
USER_ID: The user ID to use for API calls (defaults to "invalid")CONTENT_SERVICE_URL: The URL of the content service API (defaults to "http://localhost:8080")
Testing
Using uv (recommended)
./test_uv.sh
# or
uv run test_server.py # Uses pyproject.tomlUsing traditional approach
./run_server.sh # This will set up venv and install dependencies
source .venv/bin/activate && python test_server.pyDevelopment
Installing Development Dependencies
# Install all dependencies including dev tools
uv sync --dev
# This includes: pytest, black, ruff, mypy, pre-commitCode Formatting and Linting
# Format code with black
uv run black .
# Lint with ruff
uv run ruff check .
# Type check with mypy
uv run mypy .Running Tests with pytest
# Run all tests
uv run pytest
# Run with coverage
uv run pytest --cov
# Run only unit tests
uv run pytest -m unitArchitecture
The Python MCP server consists of three main components:
1. RagService (rag_service.py)
Handles all HTTP API calls to the content service
Manages file uploads and URL submissions
Provides error handling and logging
2. RagTools (rag_tools.py)
Defines the MCP tools that are exposed to clients
Acts as a bridge between MCP tool calls and the RagService
Handles parameter validation and response formatting
3. MCP Server (mcp_server.py)
Implements the MCP protocol using the Python MCP SDK
Handles tool registration and execution
Manages the server lifecycle and communication
Tool Schemas
listContentNames
{
"name": "listContentNames",
"description": "List all content names from the organization's database optionally filtered by name",
"inputSchema": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "Optional name filter to search for specific content"
}
}
}
}searchOrganizationContents
{
"name": "searchOrganizationContents",
"description": "Search through the organization's content database using semantic search",
"inputSchema": {
"type": "object",
"properties": {
"query": {
"type": "string",
"description": "The search query"
}
},
"required": ["query"]
}
}deleteOrganizationContent
{
"name": "deleteOrganizationContent",
"description": "Delete specific content from the organization's database",
"inputSchema": {
"type": "object",
"properties": {
"contentId": {
"type": "string",
"description": "The ID of the content to delete"
}
},
"required": ["contentId"]
}
}uploadContentFileAboutOrganization
{
"name": "uploadContentFileAboutOrganization",
"description": "Upload content file about the organization",
"inputSchema": {
"type": "object",
"properties": {
"file": {
"type": "string",
"description": "The file content to upload"
},
"fileName": {
"type": "string",
"description": "The file name"
},
"role": {
"type": "string",
"description": "The roles of the user"
}
},
"required": ["file", "fileName"]
}
}uploadContentUrlAboutOrganization
{
"name": "uploadContentUrlAboutOrganization",
"description": "Upload content url about the organization",
"inputSchema": {
"type": "object",
"properties": {
"url": {
"type": "string",
"description": "The URL to upload"
},
"role": {
"type": "string",
"description": "The roles of the user"
}
},
"required": ["url"]
}
}Dependencies
mcp==1.0.0- MCP Python SDKfastapi==0.115.5- Web framework (for potential future REST API)uvicorn==0.32.1- ASGI serverrequests==2.32.3- HTTP client librarypython-multipart==0.0.17- Multipart form data handlingpydantic==2.10.3- Data validationpython-dotenv==1.0.1- Environment variable management
Development Dependencies
pytest>=7.0.0- Testing frameworkpytest-asyncio>=0.21.0- Async testing supportpytest-cov>=4.0.0- Coverage reportingblack>=23.0.0- Code formattingruff>=0.1.0- Fast Python lintermypy>=1.0.0- Type checkingpre-commit>=3.0.0- Git hooks
Dependencies are managed via pyproject.toml with uv for modern Python packaging
File Structure
rag-mcp-py/
├── README.md # This documentation
├── pyproject.toml # Project configuration and dependencies
├── env.example # Environment configuration template
├── .env # Environment configuration (create from template)
├── .gitignore # Git ignore patterns
├── mcp_server.py # Main MCP server implementation
├── rag_service.py # HTTP service layer
├── rag_tools.py # MCP tools definitions
├── test_server.py # Test suite
├── run_server.sh # Traditional startup script (creates .venv)
├── run_server_uv.sh # uv-based startup script (recommended)
└── test_uv.sh # uv-based test scriptComparison with Java Version
This Python implementation mirrors the functionality of the Java MCP server:
Java Component | Python Equivalent | Description |
|
| Main server application |
|
| Tool definitions and handlers |
|
| Business logic and API calls |
The Python version maintains the same API contracts and tool schemas as the Java version, ensuring compatibility with existing MCP clients.
Why uv?
We use uv for package management because it's:
Fast: 10-100x faster than pip (installed 23 packages in 28ms!)
Reliable: Better dependency resolution
Modern: Built with Rust, designed for modern Python workflows
Flexible: Works with pyproject.toml, inline dependencies, or traditional approaches
Standards Compliant: Full support for PEP 621 and modern Python packaging
Troubleshooting
uv not found
# Install uv
curl -LsSf https://astral.sh/uv/install.sh | sh
# Restart your shell or source the pathPermission denied on scripts
chmod +x *.shServer won't start
Check if the content service is running on the configured URL
Verify environment variables in
.envCheck Python version (requires Python 3.10+)
Missing dependencies
Dependencies are automatically managed by uv from pyproject.toml or inline declarations!
Available Tools
5 toolsdeleteOrganizationContentC
Delete specific content from the organization's database
Inputs: contentId (required).
listContentNamesC
List all content names from the organization's database optionally filtered by name
Inputs: name.
searchOrganizationContentsC
Search through the organization's content database using semantic search
Inputs: query (required).
uploadContentFileAboutOrganizationC
Upload content file about the organization
Inputs: file (required), fileName (required), role.
uploadContentUrlAboutOrganizationC
Upload content url about the organization
Inputs: url (required), role.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 5 tools
Most tools have distinct purposes: listing, searching, deleting, and two upload methods (file vs. URL). However, 'listContentNames' and 'searchOrganizationContents' could be confused as both retrieve content, though 'search' implies semantic filtering while 'list' is name-based. The two upload tools are clearly differentiated by input type.
Naming is inconsistent with mixed conventions: 'deleteOrganizationContent' uses camelCase, while 'listContentNames', 'searchOrganizationContents', and the upload tools use a mix of camelCase and descriptive phrases. There's no uniform verb_noun pattern; for example, 'uploadContentFileAboutOrganization' is overly verbose and deviates from simpler naming like 'uploadContentFile'.
With 5 tools, the count is well-scoped for a content management server. It covers core operations (list, search, delete, upload via file, upload via URL) without being overwhelming or too sparse, fitting typical server purposes efficiently.
The toolset covers basic CRUD operations: create (via upload tools), read (list and search), and delete, but lacks an update tool for modifying existing content. This gap could cause agent failures if content needs editing, though agents might work around it by deleting and re-uploading.
Related MCP Connectors
Create and publish one-pagers and boards for your organization. Upload images from the web, update…
Users, organizations, roles, permissions, applications and feature flags.
Organization-scoped BrandPresence evidence and explicitly authorized product actions over MCP.
Location compliance evidence, policies and SOPs with admin-controlled write approvals.
Related MCP Servers
- AlicenseBqualityBmaintenanceEnables AI agents to access and manage project guidelines, documentation, and context through a structured content system with template support and workflow management.3869 PyPIMIT
- FlicenseNot gradedqualityBmaintenanceProvides organizational memory for AI agents, enabling shared company memory, decision recall, artifact management, approval review, task delegation, and initiative tracking.2-
- AlicenseAqualityBmaintenanceServes as a durable catalog for report definitions and gathered outputs, enabling agents to save findings with source URLs and retrieve the freshest output to compile cited reports.10AGPL 3.0
- AlicenseAqualityBmaintenanceServes organizational context to MCP-capable AI agents from a local folder or GitHub repository, and lets agents propose changes that require human approval.410 npmMIT