- Home
- MCP servers
- Smart Form Collection
Smart Form Collection
- python
1
GitHub Stars
python
Language
4 months ago
First Indexed
2 months ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
You can deploy and run an MCP server dedicated to intelligent form collection for mediation workflows. It supports standard MCP protocol, streaming outputs, real-time validation, and easy integration with large-model platforms to collect, validate, and submit form data.
How to use
You interact with the server through an MCP client or platform that supports the MCP protocol. Start a collection session, collect required fields from the user, check progress, validate the data, and finally submit the form. The server exposes an HTTP MCP endpoint for programmatic access and can run locally as a Python process or via Docker. When you integrate with a client, use the following high-level flow: start a collection, gather field information, monitor status, validate, and submit.
How to install
Prerequisites you need before installation are Docker with Docker Compose, or a Python 3.12 environment, and a DeepSeek API key for large-model access.
# Prerequisites
# Ensure Docker and Docker Compose are installed
# Option A: Use Docker Compose (recommended)
# See the deployment section for commands
# Option B: Use Python environment
# Install Python 3.12 and create a virtual environment if desired
Configure environment variables using an environment file. Create a copy from the example and edit the values.
# Create and edit environment file
cp env.example .env
vim .env
# Required configuration
# Database URL for MySQL (or compatible) in this format
DATABASE_URL=mysql+aiomysql://username:password@host:port/database
# DeepSeek API key (required)
DEEPSEEK_API_KEY=your_deepseek_api_key_here
Optional configuration items let you tune the LLM provider, streaming, and logging.
# Optional configuration
LLM_PROVIDER=deepseek
LLM_MODEL=deepseek-chat
LLM_STREAM=true
LOG_LEVEL=INFO
SESSION_TIMEOUT=3600
Deployment options
Choose one of the following deployment methods to run the MCP server and expose its MCP endpoint.
# Method 1: Docker Compose (recommended)
# Clone the project, navigate to the mdtj_mcp_server directory, then start
# Clone the project
# git clone <repository-url>
# cd mdtj_mcp_server
docker-compose up -d
docker-compose logs -f
# Health check
curl http://localhost:7000/health
# Method 2: Docker single container
docker build -t mdtj_mcp_server:latest .
docker run -d -p 7000:7000 --name mdtj_mcp_server \
--env-file .env \
mdtj_mcp_server:latest
# Health check
curl http://localhost:7000/health
# Method 3: Local Python startup
# Activate a Python 3.12 venv or use a system Python 3.12
source py312/bin/activate
# Load environment variables
source .env
# Start HTTP MCP server
python http_server.py
# Or start the standard MCP server
python mcp_server_final.py
# Method 4: Management script
./start_server.sh start
./start_server.sh status
./start_server.sh info
./start_server.sh stop
Validation and endpoints
After starting, you can validate the deployment and explore available MCP endpoints.
# Health check
curl http://localhost:7000/health
# List available tools (MCP commands are exposed via the /mcp endpoint using JSON-RPC 2.0)
curl -X POST http://localhost:7000/mcp \
-H "Content-Type: application/json" \
-d '{"jsonrpc": "2.0", "id": 1, "method": "tools/list", "params": {}}'
# Server-Sent Events endpoint for streaming
curl http://localhost:7000/sse
Additional configuration and integration notes
This server stores form sessions and submissions in a MySQL database. It supports integration with Cursor, Dify, and毕昇 platforms using standard MCP endpoints.
-- Example database schema (conceptual)
CREATE TABLE form_sessions (
id BIGINT PRIMARY KEY,
started_at DATETIME,
status VARCHAR(32)
);
CREATE TABLE form_submissions (
id BIGINT PRIMARY KEY,
session_id BIGINT,
submitted_at DATETIME
);
MCP tools
The server exposes a set of MCP tools to manage, gather, validate, and submit form data.
Available tools
start_form_collection
Begin a new form collection session and specify the template name to steer the collection process.
collect_field_info
Gather user-entered field data such as name, contact information, and event details.
get_collection_status
Return the current progress of the active form collection with per-field status.
validate_form_data
Validate the collected form data for completeness and correctness before submission.
submit_form
Submit the completed form and store the final submission record.
get_session_statistics
Provide system-wide statistics related to form collection sessions.