A templated MCP server for demonstration and quick start.
Project description
sokrates-mcp
A MCP server offering tools for prompt refinement and execution workflows using the FastMCP framework and the sokrates python library.
Features
- Multiple provider/APU support
- Available Model/Provider listing
- Prompt refinement with different types (code/default)
- External LLM processing
- Task breakdown into sub-tasks
- Create code reviews for Python source files
- Generate random ideas
- Generate ideas to a topic
Have a look at the sokrates library.
Installation & Setup
Prerequisites
Ensure you have:
- Python 3.10+
- uv (fast package installer)
Install from PyPi
pip install sokrates-mcp
# or using uv (recommended)
## basic version:
uv pip install sokrates-mcp
Alternative - Local Configuration from git
- Clone the repository if hosted:
git clone https://github.com/Kubementat/sokrates-mcp.git
cd sokrates-mcp
- Install dependencies using pyproject.toml:
uv sync
Setup Server Configuration File
Via git installed version
mkdir $HOME/.sokrates-mcp
cp config.yml.example $HOME/.sokrates-mcp/config.yml
# edit the according endpoints to your use case
vim $HOME/.sokrates-mcp/config.yml
From scratch
Create the configuration file:
mkdir $HOME/.sokrates-mcp
vim $HOME/.sokrates-mcp/config.yml
Then use this as template and adjust it to your use case:
refinement_prompt_filename: refine-prompt.md
refinement_coding_prompt_filename: refine-coding-v3.md
# providers
default_provider: local
providers:
- name: local
type: openai
api_endpoint: http://localhost:1234/v1
api_key: "not-required"
default_model: "qwen/qwen3-4b-2507"
- name: external
type: openai
api_endpoint: http://CHANGEME/v1
api_key: CHANGEME
default_model: CHANGEME
Setup as mcp server in other tools (Example for LM Studio)
For local Git installed version
{
"mcpServers": {
"sokrates": {
"command": "uv",
"args": [
"run",
"sokrates-mcp"
],
"cwd": "YOUR_PATH_TO_sokrates-mcp",
"timeout": 600000
}
}
}
via uvx
{
"mcpServers": {
"sokrates": {
"command": "uvx",
"args": [
"sokrates-mcp"
]
}
}
}
Usage Examples
Starting the Server
uv run sokrates-mcp
Listing available command line options
uv run sokrates-mcp --help
Architecture & Technical Details
The server follows a modular design pattern:
- Tools are registered in
main.pyusing FastMCP decorators - Dependency management via pyproject.toml
- Configuration files stored in
$HOME/.sokrates-mcp/directory
Contributing Guidelines
- Fork the repository and create feature branches
- Follow PEP8 style guide with 4-space indentation
- Submit pull requests with:
- Clear description of changes
- Updated tests (see Testing section)
- Documentation updates
Available Tools
main.py
-
refine_prompt: Refines a given prompt by enriching it with additional context.
- Parameters:
prompt(str): The input prompt to be refinedrefinement_type(str, optional): Type of refinement ('code' or 'default'). Default is 'default'model(str, optional): Model name for refinement. Default is 'default'
- Parameters:
-
refine_and_execute_external_prompt: Refines a prompt and executes it with an external LLM.
- Parameters:
prompt(str): The input prompt to be refined and executedrefinement_model(str, optional): Model for refinement. Default is 'default'execution_model(str, optional): Model for execution. Default is 'default'refinement_type(str, optional): Type of refinement ('code' or 'default'). Default is 'default'
- Parameters:
-
handover_prompt: Hands over a prompt to an external LLM for processing.
- Parameters:
prompt(str): The prompt to be executed externallymodel(str, optional): Model name for execution. Default is 'default'
- Parameters:
-
breakdown_task: Breaks down a task into sub-tasks with complexity ratings.
- Parameters:
task(str): The full task description to break downmodel(str, optional): Model name for processing. Default is 'default'
- Parameters:
-
list_available_models: Lists all available large language models accessible by the server.
mcp_config.py
- MCPConfig class: Manages configuration settings for the MCP server.
- Parameters:
config_file_path(str, optional): Path to YAML config fileapi_endpoint(str, optional): API endpoint URLapi_key(str, optional): API key for authenticationmodel(str, optional): Model name
- Parameters:
workflow.py
- Workflow class: Implements the business logic for prompt refinement and execution.
- e.g.:
refine_prompt: Refines a given promptrefine_and_execute_external_prompt: Refines and executes a prompt with an external LLMhandover_prompt: Hands over a prompt to an external LLM for processingbreakdown_task: Breaks down a task into sub-taskslist_available_models: Lists all available models
Project Structure
src/sokrates_mcp/main.py: Sets up the MCP server and registers toolssrc/sokrates_mcp/mcp_config.py: Configuration managementsrc/sokrates_mcp/workflow.py: Business logic for prompt refinement and executionpyproject.toml: Dependency management
Script List
main.py
Sets up an MCP server using the FastMCP framework to provide tools for prompt refinement and execution workflows.
Usage
uv run python main.py- Start the MCP server (default port: 8000)uv run fastmcp dev main.py- Run in development mode with auto-reload
mcp_config.py
Provides configuration management for the MCP server. Loads configuration from a YAML file and sets default values if needed.
Usage
- Import and use in other scripts:
from mcp_config import MCPConfig config = MCPConfig(api_endpoint="https://api.example.com", model="my-model")
workflow.py
Implements the business logic for prompt refinement and execution workflows. Contains methods to refine prompts, execute them with external LLMs, break down tasks, etc.
Usage
- Import and use in other scripts:
from workflow import Workflow from mcp_config import MCPConfig config = MCPConfig() workflow = Workflow(config) result = await workflow.refine_prompt("Write a Python function to sort a list", refinement_type="code")
src/mcp_client_example.py
Demonstrates a basic Model Context Protocol (MCP) client using the fastmcp library. Defines a simple model and registers it with the client.
Usage
- Run as a standalone script:
python src/mcp_client_example.py - Or use with an ASGI server like Uvicorn:
uvicorn src.mcp_client_example:main --factory
Common Error: If you see "ModuleNotFoundError: fastmcp", ensure:
- Dependencies are installed (
uv pip install .) - Python virtual environment is activated
Changelog
0.3.0 (Aug 2025)
- adds new tools:
- roll_dice
- read_from_file
- store_to_file
- refactorings - code quality - still ongoing
0.2.0 (Aug 2025)
- First published version
- Update to latest sokrates library version
- bugfixes and cleanup
- multi provider/API support in the configuration file
0.1.5 (July 2025)
- Updated README with comprehensive documentation
- Added tool descriptions and usage examples
- Improved project structure overview
0.1.0 (March 7, 2025)
- Initial release with refinement tools
- Basic FastMCP integration
Bug reports and feature requests: GitHub Issues
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sokrates_mcp-0.3.0.tar.gz.
File metadata
- Download URL: sokrates_mcp-0.3.0.tar.gz
- Upload date:
- Size: 20.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
be04c3843308866ebf563963cf689eb521c19c6fad48b576a19ca458a62b33e4
|
|
| MD5 |
b170f4a1ba1ebfb5b554995263c93154
|
|
| BLAKE2b-256 |
ca9249a287a873b5be5f3cd6d686637a52f08a22e96c3450eac3acee340ddc8c
|
File details
Details for the file sokrates_mcp-0.3.0-py3-none-any.whl.
File metadata
- Download URL: sokrates_mcp-0.3.0-py3-none-any.whl
- Upload date:
- Size: 19.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
debe4935e0ddca0c5997fa3b563d398e4b96c449df904bc14d6502be7ac655c3
|
|
| MD5 |
8d58179a4fab07cff1d53c0a6099fac9
|
|
| BLAKE2b-256 |
71f1b216264696453b95f33d9b9ecc887716dae6a5fec3233f5219c24295fd2e
|