sokrates-mcp 0.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- sokrates_mcp-0.2.0/LICENSE +21 -0
- sokrates_mcp-0.2.0/MANIFEST.in +4 -0
- sokrates_mcp-0.2.0/PKG-INFO +307 -0
- sokrates_mcp-0.2.0/README.md +269 -0
- sokrates_mcp-0.2.0/config.yml.example +16 -0
- sokrates_mcp-0.2.0/pyproject.toml +44 -0
- sokrates_mcp-0.2.0/setup.cfg +4 -0
- sokrates_mcp-0.2.0/src/sokrates_mcp/__init__.py +0 -0
- sokrates_mcp-0.2.0/src/sokrates_mcp/main.py +332 -0
- sokrates_mcp-0.2.0/src/sokrates_mcp/mcp_config.py +236 -0
- sokrates_mcp-0.2.0/src/sokrates_mcp/workflow.py +293 -0
- sokrates_mcp-0.2.0/src/sokrates_mcp.egg-info/PKG-INFO +307 -0
- sokrates_mcp-0.2.0/src/sokrates_mcp.egg-info/SOURCES.txt +17 -0
- sokrates_mcp-0.2.0/src/sokrates_mcp.egg-info/dependency_links.txt +1 -0
- sokrates_mcp-0.2.0/src/sokrates_mcp.egg-info/entry_points.txt +2 -0
- sokrates_mcp-0.2.0/src/sokrates_mcp.egg-info/requires.txt +4 -0
- sokrates_mcp-0.2.0/src/sokrates_mcp.egg-info/top_level.txt +2 -0
- sokrates_mcp-0.2.0/src/sokrates_mcp_client/__init__.py +0 -0
- sokrates_mcp-0.2.0/src/sokrates_mcp_client/mcp_client_example.py +97 -0
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2025 Julian Weber
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
@@ -0,0 +1,307 @@
|
|
1
|
+
Metadata-Version: 2.4
|
2
|
+
Name: sokrates-mcp
|
3
|
+
Version: 0.2.0
|
4
|
+
Summary: A templated MCP server for demonstration and quick start.
|
5
|
+
Author-email: Julian Weber <julianweberdev@gmail.com>
|
6
|
+
License: MIT License
|
7
|
+
|
8
|
+
Copyright (c) 2025 Julian Weber
|
9
|
+
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
11
|
+
of this software and associated documentation files (the "Software"), to deal
|
12
|
+
in the Software without restriction, including without limitation the rights
|
13
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
14
|
+
copies of the Software, and to permit persons to whom the Software is
|
15
|
+
furnished to do so, subject to the following conditions:
|
16
|
+
|
17
|
+
The above copyright notice and this permission notice shall be included in all
|
18
|
+
copies or substantial portions of the Software.
|
19
|
+
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
21
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
22
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
23
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
24
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
25
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
26
|
+
SOFTWARE.
|
27
|
+
Project-URL: Homepage, https://github.com/Kubementat/sokrates-mcp
|
28
|
+
Project-URL: Repository, https://github.com/Kubementat/sokrates-mcp
|
29
|
+
Keywords: mcp,llm,tools,system-monitoring,ai,prompt refinement,idea generation
|
30
|
+
Requires-Python: >=3.10
|
31
|
+
Description-Content-Type: text/markdown
|
32
|
+
License-File: LICENSE
|
33
|
+
Requires-Dist: fastmcp
|
34
|
+
Requires-Dist: sokrates
|
35
|
+
Requires-Dist: pydantic
|
36
|
+
Requires-Dist: PyYAML
|
37
|
+
Dynamic: license-file
|
38
|
+
|
39
|
+
# sokrates-mcp
|
40
|
+
|
41
|
+
A MCP server offering tools for prompt refinement and execution workflows using the FastMCP framework and the `sokrates` python library.
|
42
|
+
|
43
|
+
## Features
|
44
|
+
|
45
|
+
- Multiple provider/APU support
|
46
|
+
- Available Model/Provider listing
|
47
|
+
- Prompt refinement with different types (code/default)
|
48
|
+
- External LLM processing
|
49
|
+
- Task breakdown into sub-tasks
|
50
|
+
- Create code reviews for Python source files
|
51
|
+
- Generate random ideas
|
52
|
+
- Generate ideas to a topic
|
53
|
+
|
54
|
+
Have a look at the [sokrates library](https://github.com/Kubementat/sokrates).
|
55
|
+
|
56
|
+
## Installation & Setup
|
57
|
+
|
58
|
+
### Prerequisites
|
59
|
+
|
60
|
+
Ensure you have:
|
61
|
+
* Python 3.10+
|
62
|
+
* uv (fast package installer)
|
63
|
+
|
64
|
+
### Install from PyPi
|
65
|
+
```bash
|
66
|
+
pip install sokrates-mcp
|
67
|
+
|
68
|
+
# or using uv (recommended)
|
69
|
+
## basic version:
|
70
|
+
uv pip install sokrates-mcp
|
71
|
+
```
|
72
|
+
|
73
|
+
### Alternative - Local Configuration from git
|
74
|
+
|
75
|
+
1. Clone the repository if hosted:
|
76
|
+
```bash
|
77
|
+
git clone https://github.com/Kubementat/sokrates-mcp.git
|
78
|
+
cd sokrates-mcp
|
79
|
+
```
|
80
|
+
|
81
|
+
2. Install dependencies using pyproject.toml:
|
82
|
+
```bash
|
83
|
+
uv sync
|
84
|
+
```
|
85
|
+
|
86
|
+
### Setup Server Configuration File
|
87
|
+
|
88
|
+
#### Via git installed version
|
89
|
+
```bash
|
90
|
+
mkdir $HOME/.sokrates-mcp
|
91
|
+
cp config.yml.example $HOME/.sokrates-mcp/config.yml
|
92
|
+
# edit the according endpoints to your use case
|
93
|
+
vim $HOME/.sokrates-mcp/config.yml
|
94
|
+
```
|
95
|
+
|
96
|
+
#### From scratch
|
97
|
+
Create the configuration file:
|
98
|
+
```bash
|
99
|
+
mkdir $HOME/.sokrates-mcp
|
100
|
+
vim $HOME/.sokrates-mcp/config.yml
|
101
|
+
```
|
102
|
+
|
103
|
+
Then use this as template and adjust it to your use case:
|
104
|
+
```yaml
|
105
|
+
refinement_prompt_filename: refine-prompt.md
|
106
|
+
refinement_coding_prompt_filename: refine-coding-v3.md
|
107
|
+
|
108
|
+
# providers
|
109
|
+
default_provider: local
|
110
|
+
providers:
|
111
|
+
- name: local
|
112
|
+
type: openai
|
113
|
+
api_endpoint: http://localhost:1234/v1
|
114
|
+
api_key: "not-required"
|
115
|
+
default_model: "qwen/qwen3-4b-2507"
|
116
|
+
- name: external
|
117
|
+
type: openai
|
118
|
+
api_endpoint: http://CHANGEME/v1
|
119
|
+
api_key: CHANGEME
|
120
|
+
default_model: CHANGEME
|
121
|
+
```
|
122
|
+
|
123
|
+
### Setup as mcp server in other tools (Example for LM Studio)
|
124
|
+
|
125
|
+
#### For local Git installed version
|
126
|
+
```yaml
|
127
|
+
{
|
128
|
+
"mcpServers": {
|
129
|
+
"sokrates": {
|
130
|
+
"command": "uv",
|
131
|
+
"args": [
|
132
|
+
"run",
|
133
|
+
"sokrates-mcp"
|
134
|
+
],
|
135
|
+
"cwd": "YOUR_PATH_TO_sokrates-mcp",
|
136
|
+
"timeout": 600000
|
137
|
+
}
|
138
|
+
}
|
139
|
+
}
|
140
|
+
```
|
141
|
+
|
142
|
+
#### via uvx
|
143
|
+
```yaml
|
144
|
+
{
|
145
|
+
"mcpServers": {
|
146
|
+
"sokrates": {
|
147
|
+
"command": "uvx",
|
148
|
+
"args": [
|
149
|
+
"sokrates-mcp"
|
150
|
+
]
|
151
|
+
}
|
152
|
+
}
|
153
|
+
}
|
154
|
+
```
|
155
|
+
|
156
|
+
## Usage Examples
|
157
|
+
|
158
|
+
### Starting the Server
|
159
|
+
|
160
|
+
```bash
|
161
|
+
uv run sokrates-mcp
|
162
|
+
```
|
163
|
+
|
164
|
+
### Listing available command line options
|
165
|
+
```bash
|
166
|
+
uv run sokrates-mcp --help
|
167
|
+
```
|
168
|
+
|
169
|
+
## Architecture & Technical Details
|
170
|
+
|
171
|
+
The server follows a modular design pattern:
|
172
|
+
1. Tools are registered in `main.py` using FastMCP decorators
|
173
|
+
2. Dependency management via pyproject.toml
|
174
|
+
3. Configuration files stored in `$HOME/.sokrates-mcp/` directory
|
175
|
+
|
176
|
+
|
177
|
+
## Contributing Guidelines
|
178
|
+
|
179
|
+
1. Fork the repository and create feature branches
|
180
|
+
2. Follow PEP8 style guide with 4-space indentation
|
181
|
+
3. Submit pull requests with:
|
182
|
+
- Clear description of changes
|
183
|
+
- Updated tests (see Testing section)
|
184
|
+
- Documentation updates
|
185
|
+
|
186
|
+
## Available Tools
|
187
|
+
|
188
|
+
### main.py
|
189
|
+
|
190
|
+
- **refine_prompt**: Refines a given prompt by enriching it with additional context.
|
191
|
+
- Parameters:
|
192
|
+
- `prompt` (str): The input prompt to be refined
|
193
|
+
- `refinement_type` (str, optional): Type of refinement ('code' or 'default'). Default is 'default'
|
194
|
+
- `model` (str, optional): Model name for refinement. Default is 'default'
|
195
|
+
|
196
|
+
- **refine_and_execute_external_prompt**: Refines a prompt and executes it with an external LLM.
|
197
|
+
- Parameters:
|
198
|
+
- `prompt` (str): The input prompt to be refined and executed
|
199
|
+
- `refinement_model` (str, optional): Model for refinement. Default is 'default'
|
200
|
+
- `execution_model` (str, optional): Model for execution. Default is 'default'
|
201
|
+
- `refinement_type` (str, optional): Type of refinement ('code' or 'default'). Default is 'default'
|
202
|
+
|
203
|
+
- **handover_prompt**: Hands over a prompt to an external LLM for processing.
|
204
|
+
- Parameters:
|
205
|
+
- `prompt` (str): The prompt to be executed externally
|
206
|
+
- `model` (str, optional): Model name for execution. Default is 'default'
|
207
|
+
|
208
|
+
- **breakdown_task**: Breaks down a task into sub-tasks with complexity ratings.
|
209
|
+
- Parameters:
|
210
|
+
- `task` (str): The full task description to break down
|
211
|
+
- `model` (str, optional): Model name for processing. Default is 'default'
|
212
|
+
|
213
|
+
- **list_available_models**: Lists all available large language models accessible by the server.
|
214
|
+
|
215
|
+
### mcp_config.py
|
216
|
+
|
217
|
+
- **MCPConfig** class: Manages configuration settings for the MCP server.
|
218
|
+
- Parameters:
|
219
|
+
- `config_file_path` (str, optional): Path to YAML config file
|
220
|
+
- `api_endpoint` (str, optional): API endpoint URL
|
221
|
+
- `api_key` (str, optional): API key for authentication
|
222
|
+
- `model` (str, optional): Model name
|
223
|
+
|
224
|
+
### workflow.py
|
225
|
+
|
226
|
+
- **Workflow** class: Implements the business logic for prompt refinement and execution.
|
227
|
+
- Methods:
|
228
|
+
- `refine_prompt`: Refines a given prompt
|
229
|
+
- `refine_and_execute_external_prompt`: Refines and executes a prompt with an external LLM
|
230
|
+
- `handover_prompt`: Hands over a prompt to an external LLM for processing
|
231
|
+
- `breakdown_task`: Breaks down a task into sub-tasks
|
232
|
+
- `list_available_models`: Lists all available models
|
233
|
+
|
234
|
+
## Project Structure
|
235
|
+
|
236
|
+
- `src/sokrates_mcp/main.py`: Sets up the MCP server and registers tools
|
237
|
+
- `src/sokrates_mcp/mcp_config.py`: Configuration management
|
238
|
+
- `src/sokrates_mcp/workflow.py`: Business logic for prompt refinement and execution
|
239
|
+
- `pyproject.toml`: Dependency management
|
240
|
+
|
241
|
+
|
242
|
+
## Script List
|
243
|
+
|
244
|
+
### `main.py`
|
245
|
+
Sets up an MCP server using the FastMCP framework to provide tools for prompt refinement and execution workflows.
|
246
|
+
#### Usage
|
247
|
+
- `uv run python main.py` - Start the MCP server (default port: 8000)
|
248
|
+
- `uv run fastmcp dev main.py` - Run in development mode with auto-reload
|
249
|
+
|
250
|
+
### `mcp_config.py`
|
251
|
+
Provides configuration management for the MCP server. Loads configuration from a YAML file and sets default values if needed.
|
252
|
+
#### Usage
|
253
|
+
- Import and use in other scripts:
|
254
|
+
```python
|
255
|
+
from mcp_config import MCPConfig
|
256
|
+
config = MCPConfig(api_endpoint="https://api.example.com", model="my-model")
|
257
|
+
```
|
258
|
+
|
259
|
+
### `workflow.py`
|
260
|
+
Implements the business logic for prompt refinement and execution workflows. Contains methods to refine prompts, execute them with external LLMs, break down tasks, etc.
|
261
|
+
#### Usage
|
262
|
+
- Import and use in other scripts:
|
263
|
+
```python
|
264
|
+
from workflow import Workflow
|
265
|
+
from mcp_config import MCPConfig
|
266
|
+
|
267
|
+
config = MCPConfig()
|
268
|
+
workflow = Workflow(config)
|
269
|
+
result = await workflow.refine_prompt("Write a Python function to sort a list", refinement_type="code")
|
270
|
+
```
|
271
|
+
|
272
|
+
### `src/mcp_client_example.py`
|
273
|
+
Demonstrates a basic Model Context Protocol (MCP) client using the fastmcp library. Defines a simple model and registers it with the client.
|
274
|
+
|
275
|
+
#### Usage
|
276
|
+
- Run as a standalone script:
|
277
|
+
```bash
|
278
|
+
python src/mcp_client_example.py
|
279
|
+
```
|
280
|
+
- Or use with an ASGI server like Uvicorn:
|
281
|
+
```bash
|
282
|
+
uvicorn src.mcp_client_example:main --factory
|
283
|
+
```
|
284
|
+
|
285
|
+
**Common Error:**
|
286
|
+
If you see "ModuleNotFoundError: fastmcp", ensure:
|
287
|
+
1. Dependencies are installed (`uv pip install .`)
|
288
|
+
2. Python virtual environment is activated
|
289
|
+
|
290
|
+
## Changelog
|
291
|
+
|
292
|
+
**0.2.0 (Aug 2025)**
|
293
|
+
- First published version
|
294
|
+
- Update to latest sokrates library version
|
295
|
+
- bugfixes and cleanup
|
296
|
+
- multi provider/API support in the configuration file
|
297
|
+
|
298
|
+
**0.1.5 (July 2025)**
|
299
|
+
- Updated README with comprehensive documentation
|
300
|
+
- Added tool descriptions and usage examples
|
301
|
+
- Improved project structure overview
|
302
|
+
|
303
|
+
**0.1.0 (March 7, 2025)**
|
304
|
+
- Initial release with refinement tools
|
305
|
+
- Basic FastMCP integration
|
306
|
+
|
307
|
+
Bug reports and feature requests: [GitHub Issues](https://github.com/Kubementat/sokrates-mcp/issues)
|
@@ -0,0 +1,269 @@
|
|
1
|
+
# sokrates-mcp
|
2
|
+
|
3
|
+
A MCP server offering tools for prompt refinement and execution workflows using the FastMCP framework and the `sokrates` python library.
|
4
|
+
|
5
|
+
## Features
|
6
|
+
|
7
|
+
- Multiple provider/APU support
|
8
|
+
- Available Model/Provider listing
|
9
|
+
- Prompt refinement with different types (code/default)
|
10
|
+
- External LLM processing
|
11
|
+
- Task breakdown into sub-tasks
|
12
|
+
- Create code reviews for Python source files
|
13
|
+
- Generate random ideas
|
14
|
+
- Generate ideas to a topic
|
15
|
+
|
16
|
+
Have a look at the [sokrates library](https://github.com/Kubementat/sokrates).
|
17
|
+
|
18
|
+
## Installation & Setup
|
19
|
+
|
20
|
+
### Prerequisites
|
21
|
+
|
22
|
+
Ensure you have:
|
23
|
+
* Python 3.10+
|
24
|
+
* uv (fast package installer)
|
25
|
+
|
26
|
+
### Install from PyPi
|
27
|
+
```bash
|
28
|
+
pip install sokrates-mcp
|
29
|
+
|
30
|
+
# or using uv (recommended)
|
31
|
+
## basic version:
|
32
|
+
uv pip install sokrates-mcp
|
33
|
+
```
|
34
|
+
|
35
|
+
### Alternative - Local Configuration from git
|
36
|
+
|
37
|
+
1. Clone the repository if hosted:
|
38
|
+
```bash
|
39
|
+
git clone https://github.com/Kubementat/sokrates-mcp.git
|
40
|
+
cd sokrates-mcp
|
41
|
+
```
|
42
|
+
|
43
|
+
2. Install dependencies using pyproject.toml:
|
44
|
+
```bash
|
45
|
+
uv sync
|
46
|
+
```
|
47
|
+
|
48
|
+
### Setup Server Configuration File
|
49
|
+
|
50
|
+
#### Via git installed version
|
51
|
+
```bash
|
52
|
+
mkdir $HOME/.sokrates-mcp
|
53
|
+
cp config.yml.example $HOME/.sokrates-mcp/config.yml
|
54
|
+
# edit the according endpoints to your use case
|
55
|
+
vim $HOME/.sokrates-mcp/config.yml
|
56
|
+
```
|
57
|
+
|
58
|
+
#### From scratch
|
59
|
+
Create the configuration file:
|
60
|
+
```bash
|
61
|
+
mkdir $HOME/.sokrates-mcp
|
62
|
+
vim $HOME/.sokrates-mcp/config.yml
|
63
|
+
```
|
64
|
+
|
65
|
+
Then use this as template and adjust it to your use case:
|
66
|
+
```yaml
|
67
|
+
refinement_prompt_filename: refine-prompt.md
|
68
|
+
refinement_coding_prompt_filename: refine-coding-v3.md
|
69
|
+
|
70
|
+
# providers
|
71
|
+
default_provider: local
|
72
|
+
providers:
|
73
|
+
- name: local
|
74
|
+
type: openai
|
75
|
+
api_endpoint: http://localhost:1234/v1
|
76
|
+
api_key: "not-required"
|
77
|
+
default_model: "qwen/qwen3-4b-2507"
|
78
|
+
- name: external
|
79
|
+
type: openai
|
80
|
+
api_endpoint: http://CHANGEME/v1
|
81
|
+
api_key: CHANGEME
|
82
|
+
default_model: CHANGEME
|
83
|
+
```
|
84
|
+
|
85
|
+
### Setup as mcp server in other tools (Example for LM Studio)
|
86
|
+
|
87
|
+
#### For local Git installed version
|
88
|
+
```yaml
|
89
|
+
{
|
90
|
+
"mcpServers": {
|
91
|
+
"sokrates": {
|
92
|
+
"command": "uv",
|
93
|
+
"args": [
|
94
|
+
"run",
|
95
|
+
"sokrates-mcp"
|
96
|
+
],
|
97
|
+
"cwd": "YOUR_PATH_TO_sokrates-mcp",
|
98
|
+
"timeout": 600000
|
99
|
+
}
|
100
|
+
}
|
101
|
+
}
|
102
|
+
```
|
103
|
+
|
104
|
+
#### via uvx
|
105
|
+
```yaml
|
106
|
+
{
|
107
|
+
"mcpServers": {
|
108
|
+
"sokrates": {
|
109
|
+
"command": "uvx",
|
110
|
+
"args": [
|
111
|
+
"sokrates-mcp"
|
112
|
+
]
|
113
|
+
}
|
114
|
+
}
|
115
|
+
}
|
116
|
+
```
|
117
|
+
|
118
|
+
## Usage Examples
|
119
|
+
|
120
|
+
### Starting the Server
|
121
|
+
|
122
|
+
```bash
|
123
|
+
uv run sokrates-mcp
|
124
|
+
```
|
125
|
+
|
126
|
+
### Listing available command line options
|
127
|
+
```bash
|
128
|
+
uv run sokrates-mcp --help
|
129
|
+
```
|
130
|
+
|
131
|
+
## Architecture & Technical Details
|
132
|
+
|
133
|
+
The server follows a modular design pattern:
|
134
|
+
1. Tools are registered in `main.py` using FastMCP decorators
|
135
|
+
2. Dependency management via pyproject.toml
|
136
|
+
3. Configuration files stored in `$HOME/.sokrates-mcp/` directory
|
137
|
+
|
138
|
+
|
139
|
+
## Contributing Guidelines
|
140
|
+
|
141
|
+
1. Fork the repository and create feature branches
|
142
|
+
2. Follow PEP8 style guide with 4-space indentation
|
143
|
+
3. Submit pull requests with:
|
144
|
+
- Clear description of changes
|
145
|
+
- Updated tests (see Testing section)
|
146
|
+
- Documentation updates
|
147
|
+
|
148
|
+
## Available Tools
|
149
|
+
|
150
|
+
### main.py
|
151
|
+
|
152
|
+
- **refine_prompt**: Refines a given prompt by enriching it with additional context.
|
153
|
+
- Parameters:
|
154
|
+
- `prompt` (str): The input prompt to be refined
|
155
|
+
- `refinement_type` (str, optional): Type of refinement ('code' or 'default'). Default is 'default'
|
156
|
+
- `model` (str, optional): Model name for refinement. Default is 'default'
|
157
|
+
|
158
|
+
- **refine_and_execute_external_prompt**: Refines a prompt and executes it with an external LLM.
|
159
|
+
- Parameters:
|
160
|
+
- `prompt` (str): The input prompt to be refined and executed
|
161
|
+
- `refinement_model` (str, optional): Model for refinement. Default is 'default'
|
162
|
+
- `execution_model` (str, optional): Model for execution. Default is 'default'
|
163
|
+
- `refinement_type` (str, optional): Type of refinement ('code' or 'default'). Default is 'default'
|
164
|
+
|
165
|
+
- **handover_prompt**: Hands over a prompt to an external LLM for processing.
|
166
|
+
- Parameters:
|
167
|
+
- `prompt` (str): The prompt to be executed externally
|
168
|
+
- `model` (str, optional): Model name for execution. Default is 'default'
|
169
|
+
|
170
|
+
- **breakdown_task**: Breaks down a task into sub-tasks with complexity ratings.
|
171
|
+
- Parameters:
|
172
|
+
- `task` (str): The full task description to break down
|
173
|
+
- `model` (str, optional): Model name for processing. Default is 'default'
|
174
|
+
|
175
|
+
- **list_available_models**: Lists all available large language models accessible by the server.
|
176
|
+
|
177
|
+
### mcp_config.py
|
178
|
+
|
179
|
+
- **MCPConfig** class: Manages configuration settings for the MCP server.
|
180
|
+
- Parameters:
|
181
|
+
- `config_file_path` (str, optional): Path to YAML config file
|
182
|
+
- `api_endpoint` (str, optional): API endpoint URL
|
183
|
+
- `api_key` (str, optional): API key for authentication
|
184
|
+
- `model` (str, optional): Model name
|
185
|
+
|
186
|
+
### workflow.py
|
187
|
+
|
188
|
+
- **Workflow** class: Implements the business logic for prompt refinement and execution.
|
189
|
+
- Methods:
|
190
|
+
- `refine_prompt`: Refines a given prompt
|
191
|
+
- `refine_and_execute_external_prompt`: Refines and executes a prompt with an external LLM
|
192
|
+
- `handover_prompt`: Hands over a prompt to an external LLM for processing
|
193
|
+
- `breakdown_task`: Breaks down a task into sub-tasks
|
194
|
+
- `list_available_models`: Lists all available models
|
195
|
+
|
196
|
+
## Project Structure
|
197
|
+
|
198
|
+
- `src/sokrates_mcp/main.py`: Sets up the MCP server and registers tools
|
199
|
+
- `src/sokrates_mcp/mcp_config.py`: Configuration management
|
200
|
+
- `src/sokrates_mcp/workflow.py`: Business logic for prompt refinement and execution
|
201
|
+
- `pyproject.toml`: Dependency management
|
202
|
+
|
203
|
+
|
204
|
+
## Script List
|
205
|
+
|
206
|
+
### `main.py`
|
207
|
+
Sets up an MCP server using the FastMCP framework to provide tools for prompt refinement and execution workflows.
|
208
|
+
#### Usage
|
209
|
+
- `uv run python main.py` - Start the MCP server (default port: 8000)
|
210
|
+
- `uv run fastmcp dev main.py` - Run in development mode with auto-reload
|
211
|
+
|
212
|
+
### `mcp_config.py`
|
213
|
+
Provides configuration management for the MCP server. Loads configuration from a YAML file and sets default values if needed.
|
214
|
+
#### Usage
|
215
|
+
- Import and use in other scripts:
|
216
|
+
```python
|
217
|
+
from mcp_config import MCPConfig
|
218
|
+
config = MCPConfig(api_endpoint="https://api.example.com", model="my-model")
|
219
|
+
```
|
220
|
+
|
221
|
+
### `workflow.py`
|
222
|
+
Implements the business logic for prompt refinement and execution workflows. Contains methods to refine prompts, execute them with external LLMs, break down tasks, etc.
|
223
|
+
#### Usage
|
224
|
+
- Import and use in other scripts:
|
225
|
+
```python
|
226
|
+
from workflow import Workflow
|
227
|
+
from mcp_config import MCPConfig
|
228
|
+
|
229
|
+
config = MCPConfig()
|
230
|
+
workflow = Workflow(config)
|
231
|
+
result = await workflow.refine_prompt("Write a Python function to sort a list", refinement_type="code")
|
232
|
+
```
|
233
|
+
|
234
|
+
### `src/mcp_client_example.py`
|
235
|
+
Demonstrates a basic Model Context Protocol (MCP) client using the fastmcp library. Defines a simple model and registers it with the client.
|
236
|
+
|
237
|
+
#### Usage
|
238
|
+
- Run as a standalone script:
|
239
|
+
```bash
|
240
|
+
python src/mcp_client_example.py
|
241
|
+
```
|
242
|
+
- Or use with an ASGI server like Uvicorn:
|
243
|
+
```bash
|
244
|
+
uvicorn src.mcp_client_example:main --factory
|
245
|
+
```
|
246
|
+
|
247
|
+
**Common Error:**
|
248
|
+
If you see "ModuleNotFoundError: fastmcp", ensure:
|
249
|
+
1. Dependencies are installed (`uv pip install .`)
|
250
|
+
2. Python virtual environment is activated
|
251
|
+
|
252
|
+
## Changelog
|
253
|
+
|
254
|
+
**0.2.0 (Aug 2025)**
|
255
|
+
- First published version
|
256
|
+
- Update to latest sokrates library version
|
257
|
+
- bugfixes and cleanup
|
258
|
+
- multi provider/API support in the configuration file
|
259
|
+
|
260
|
+
**0.1.5 (July 2025)**
|
261
|
+
- Updated README with comprehensive documentation
|
262
|
+
- Added tool descriptions and usage examples
|
263
|
+
- Improved project structure overview
|
264
|
+
|
265
|
+
**0.1.0 (March 7, 2025)**
|
266
|
+
- Initial release with refinement tools
|
267
|
+
- Basic FastMCP integration
|
268
|
+
|
269
|
+
Bug reports and feature requests: [GitHub Issues](https://github.com/Kubementat/sokrates-mcp/issues)
|
@@ -0,0 +1,16 @@
|
|
1
|
+
refinement_prompt_filename: refine-prompt.md
|
2
|
+
refinement_coding_prompt_filename: refine-coding-v3.md
|
3
|
+
|
4
|
+
# providers
|
5
|
+
default_provider: local
|
6
|
+
providers:
|
7
|
+
- name: local
|
8
|
+
type: openai
|
9
|
+
api_endpoint: http://localhost:1234/v1
|
10
|
+
api_key: "not-required"
|
11
|
+
default_model: "qwen/qwen3-4b-2507"
|
12
|
+
- name: external
|
13
|
+
type: openai
|
14
|
+
api_endpoint: http://CHANGEME/v1
|
15
|
+
api_key: CHANGEME
|
16
|
+
default_model: CHANGEME
|
@@ -0,0 +1,44 @@
|
|
1
|
+
[project]
|
2
|
+
name = "sokrates-mcp"
|
3
|
+
version = "0.2.0"
|
4
|
+
description = "A templated MCP server for demonstration and quick start."
|
5
|
+
readme = "README.md"
|
6
|
+
requires-python = ">=3.10"
|
7
|
+
license = { file = "LICENSE" }
|
8
|
+
authors = [{ name = "Julian Weber", email = "julianweberdev@gmail.com" }]
|
9
|
+
keywords = ["mcp", "llm", "tools", "system-monitoring", "ai", "prompt refinement", "idea generation"]
|
10
|
+
dependencies = [
|
11
|
+
"fastmcp",
|
12
|
+
"sokrates",
|
13
|
+
# "sokrates @ file:///home/verfeinerer/dev/os_projects/sokrates",
|
14
|
+
"pydantic",
|
15
|
+
"PyYAML"
|
16
|
+
]
|
17
|
+
|
18
|
+
[project.urls]
|
19
|
+
Homepage = "https://github.com/Kubementat/sokrates-mcp"
|
20
|
+
Repository = "https://github.com/Kubementat/sokrates-mcp"
|
21
|
+
|
22
|
+
[build-system]
|
23
|
+
requires = ["setuptools>=61.0"]
|
24
|
+
build-backend = "setuptools.build_meta"
|
25
|
+
|
26
|
+
[tool.setuptools.packages.find]
|
27
|
+
where = ["src"]
|
28
|
+
include = ["sokrates*"]
|
29
|
+
|
30
|
+
[project.scripts]
|
31
|
+
sokrates-mcp = "sokrates_mcp.main:main"
|
32
|
+
|
33
|
+
[[tool.uv.index]]
|
34
|
+
name = "pypi"
|
35
|
+
url = "https://pypi.org/simple/"
|
36
|
+
publish-url = "https://upload.pypi.org/legacy/"
|
37
|
+
explicit = true
|
38
|
+
|
39
|
+
# Optional: Define TestPyPI for testing publishes
|
40
|
+
[[tool.uv.index]]
|
41
|
+
name = "testpypi"
|
42
|
+
url = "https://test.pypi.org/simple/"
|
43
|
+
publish-url = "https://test.pypi.org/legacy/"
|
44
|
+
explicit = true
|
File without changes
|