mcp-server-pp 0.1.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.
- mcp_server_pp-0.1.0/.env.example +1 -0
- mcp_server_pp-0.1.0/.gitignore +5 -0
- mcp_server_pp-0.1.0/LICENSE +21 -0
- mcp_server_pp-0.1.0/Makefile +10 -0
- mcp_server_pp-0.1.0/PKG-INFO +58 -0
- mcp_server_pp-0.1.0/README.md +41 -0
- mcp_server_pp-0.1.0/pyproject.toml +29 -0
- mcp_server_pp-0.1.0/src/mcp_server_pp/__init__.py +5 -0
- mcp_server_pp-0.1.0/src/mcp_server_pp/__main__.py +5 -0
- mcp_server_pp-0.1.0/src/mcp_server_pp/server.py +123 -0
- mcp_server_pp-0.1.0/uv.lock +883 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
PYPI_TOKEN=pypi-YOUR_TOKEN_HERE
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 ELS-RJED Team
|
|
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,10 @@
|
|
|
1
|
+
-include .env
|
|
2
|
+
|
|
3
|
+
.PHONY: publish test
|
|
4
|
+
|
|
5
|
+
publish:
|
|
6
|
+
uv build
|
|
7
|
+
uv publish --token $(PYPI_TOKEN)
|
|
8
|
+
|
|
9
|
+
test:
|
|
10
|
+
printf '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"test","version":"1.0"}}}\n{"jsonrpc":"2.0","method":"notifications/initialized"}\n{"jsonrpc":"2.0","id":2,"method":"tools/list","params":{}}\n' | timeout 5 uv run mcp-server-pp
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: mcp-server-pp
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: MCP server providing tools for PharmaPendium data extraction workflows
|
|
5
|
+
Author: ELS-RJED Team
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
License-File: LICENSE
|
|
8
|
+
Keywords: excel,extraction,mcp,pharmacokinetic,pharmapendium,xlsx
|
|
9
|
+
Classifier: Development Status :: 4 - Beta
|
|
10
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Requires-Python: >=3.11
|
|
13
|
+
Requires-Dist: mcp>=1.0.0
|
|
14
|
+
Requires-Dist: openpyxl>=3.1.5
|
|
15
|
+
Requires-Dist: pandas>=2.0.0
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
|
|
18
|
+
# mcp-server-pp
|
|
19
|
+
|
|
20
|
+
MCP server providing tools for PharmaPendium data extraction workflows.
|
|
21
|
+
|
|
22
|
+
## Tools
|
|
23
|
+
|
|
24
|
+
### `json_to_xlsx`
|
|
25
|
+
|
|
26
|
+
Converts a JSON array of objects into an XLSX file. Each object becomes a row; keys become column headers.
|
|
27
|
+
|
|
28
|
+
**Parameters:**
|
|
29
|
+
- `json_data` (required): JSON array string, e.g. `'[{"col1": "val1", "col2": 2}]'`
|
|
30
|
+
- `file_name` (optional): Output filename. Defaults to `extraction_results.xlsx`
|
|
31
|
+
|
|
32
|
+
## Usage
|
|
33
|
+
|
|
34
|
+
### With uvx (no installation needed)
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
uvx mcp-server-pp
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### Install and run
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
pip install mcp-server-pp
|
|
44
|
+
mcp-server-pp
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### MCP client config (e.g. Codemie, Claude Desktop)
|
|
48
|
+
|
|
49
|
+
```json
|
|
50
|
+
{
|
|
51
|
+
"mcpServers": {
|
|
52
|
+
"pp-tools": {
|
|
53
|
+
"command": "uvx",
|
|
54
|
+
"args": ["mcp-server-pp"]
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
```
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# mcp-server-pp
|
|
2
|
+
|
|
3
|
+
MCP server providing tools for PharmaPendium data extraction workflows.
|
|
4
|
+
|
|
5
|
+
## Tools
|
|
6
|
+
|
|
7
|
+
### `json_to_xlsx`
|
|
8
|
+
|
|
9
|
+
Converts a JSON array of objects into an XLSX file. Each object becomes a row; keys become column headers.
|
|
10
|
+
|
|
11
|
+
**Parameters:**
|
|
12
|
+
- `json_data` (required): JSON array string, e.g. `'[{"col1": "val1", "col2": 2}]'`
|
|
13
|
+
- `file_name` (optional): Output filename. Defaults to `extraction_results.xlsx`
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
### With uvx (no installation needed)
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
uvx mcp-server-pp
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### Install and run
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
pip install mcp-server-pp
|
|
27
|
+
mcp-server-pp
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### MCP client config (e.g. Codemie, Claude Desktop)
|
|
31
|
+
|
|
32
|
+
```json
|
|
33
|
+
{
|
|
34
|
+
"mcpServers": {
|
|
35
|
+
"pp-tools": {
|
|
36
|
+
"command": "uvx",
|
|
37
|
+
"args": ["mcp-server-pp"]
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
```
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "mcp-server-pp"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "MCP server providing tools for PharmaPendium data extraction workflows"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
license = "MIT"
|
|
7
|
+
requires-python = ">=3.11"
|
|
8
|
+
authors = [{ name = "ELS-RJED Team" }]
|
|
9
|
+
keywords = ["mcp", "xlsx", "excel", "pharmacokinetic", "extraction", "pharmapendium"]
|
|
10
|
+
classifiers = [
|
|
11
|
+
"Development Status :: 4 - Beta",
|
|
12
|
+
"Programming Language :: Python :: 3",
|
|
13
|
+
"License :: OSI Approved :: MIT License",
|
|
14
|
+
]
|
|
15
|
+
dependencies = [
|
|
16
|
+
"mcp>=1.0.0",
|
|
17
|
+
"pandas>=2.0.0",
|
|
18
|
+
"openpyxl>=3.1.5",
|
|
19
|
+
]
|
|
20
|
+
|
|
21
|
+
[project.scripts]
|
|
22
|
+
mcp-server-pp = "mcp_server_pp:main"
|
|
23
|
+
|
|
24
|
+
[build-system]
|
|
25
|
+
requires = ["hatchling"]
|
|
26
|
+
build-backend = "hatchling.build"
|
|
27
|
+
|
|
28
|
+
[tool.hatch.build.targets.wheel]
|
|
29
|
+
packages = ["src/mcp_server_pp"]
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
"""
|
|
2
|
+
MCP server providing tools for PharmaPendium data extraction workflows.
|
|
3
|
+
|
|
4
|
+
Tools:
|
|
5
|
+
- json_to_xlsx: Convert a JSON array into a downloadable XLSX file.
|
|
6
|
+
|
|
7
|
+
Usage:
|
|
8
|
+
uvx mcp-server-pp # install from PyPI and run (stdio)
|
|
9
|
+
mcp-server-pp # run directly if installed
|
|
10
|
+
python -m mcp_server_pp # run as module
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
import base64
|
|
14
|
+
import io
|
|
15
|
+
import json
|
|
16
|
+
|
|
17
|
+
import pandas as pd
|
|
18
|
+
from mcp.server import Server
|
|
19
|
+
from mcp.server.stdio import stdio_server
|
|
20
|
+
from mcp.types import (
|
|
21
|
+
BlobResourceContents,
|
|
22
|
+
EmbeddedResource,
|
|
23
|
+
TextContent,
|
|
24
|
+
Tool,
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
server = Server("mcp-server-pp")
|
|
28
|
+
|
|
29
|
+
XLSX_MIME = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
@server.list_tools()
|
|
33
|
+
async def list_tools() -> list[Tool]:
|
|
34
|
+
return [
|
|
35
|
+
Tool(
|
|
36
|
+
name="json_to_xlsx",
|
|
37
|
+
description=(
|
|
38
|
+
"Convert a JSON array of objects into a downloadable XLSX (Excel) file. "
|
|
39
|
+
"Each object becomes a row; keys become column headers. "
|
|
40
|
+
"Returns the file as a downloadable attachment."
|
|
41
|
+
),
|
|
42
|
+
inputSchema={
|
|
43
|
+
"type": "object",
|
|
44
|
+
"properties": {
|
|
45
|
+
"json_data": {
|
|
46
|
+
"type": "string",
|
|
47
|
+
"description": (
|
|
48
|
+
"A JSON array of objects. "
|
|
49
|
+
"Example: '[{\"col1\": \"val1\", \"col2\": 2}, ...]'"
|
|
50
|
+
),
|
|
51
|
+
},
|
|
52
|
+
"file_name": {
|
|
53
|
+
"type": "string",
|
|
54
|
+
"description": (
|
|
55
|
+
"Output filename (with or without .xlsx extension). "
|
|
56
|
+
"Defaults to 'extraction_results'."
|
|
57
|
+
),
|
|
58
|
+
"default": "extraction_results",
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
"required": ["json_data"],
|
|
62
|
+
},
|
|
63
|
+
)
|
|
64
|
+
]
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
@server.call_tool()
|
|
68
|
+
async def call_tool(name: str, arguments: dict) -> list:
|
|
69
|
+
if name != "json_to_xlsx":
|
|
70
|
+
raise ValueError(f"Unknown tool: {name}")
|
|
71
|
+
|
|
72
|
+
json_str = arguments["json_data"]
|
|
73
|
+
file_name = arguments.get("file_name", "extraction_results")
|
|
74
|
+
if not file_name.endswith(".xlsx"):
|
|
75
|
+
file_name += ".xlsx"
|
|
76
|
+
|
|
77
|
+
try:
|
|
78
|
+
data = json.loads(json_str)
|
|
79
|
+
except json.JSONDecodeError as e:
|
|
80
|
+
return [TextContent(type="text", text=f"Invalid JSON: {e}")]
|
|
81
|
+
|
|
82
|
+
if not isinstance(data, list):
|
|
83
|
+
return [TextContent(type="text", text="json_data must be a JSON array")]
|
|
84
|
+
|
|
85
|
+
if len(data) == 0:
|
|
86
|
+
return [TextContent(type="text", text="JSON array is empty, nothing to convert")]
|
|
87
|
+
|
|
88
|
+
df = pd.DataFrame(data)
|
|
89
|
+
|
|
90
|
+
buf = io.BytesIO()
|
|
91
|
+
df.to_excel(buf, index=False, engine="openpyxl")
|
|
92
|
+
buf.seek(0)
|
|
93
|
+
|
|
94
|
+
b64 = base64.standard_b64encode(buf.read()).decode("utf-8")
|
|
95
|
+
|
|
96
|
+
return [
|
|
97
|
+
TextContent(
|
|
98
|
+
type="text",
|
|
99
|
+
text=f"Created {file_name} with {len(df)} rows and {len(df.columns)} columns.",
|
|
100
|
+
),
|
|
101
|
+
EmbeddedResource(
|
|
102
|
+
type="resource",
|
|
103
|
+
resource=BlobResourceContents(
|
|
104
|
+
uri=f"file:///{file_name}",
|
|
105
|
+
mimeType=XLSX_MIME,
|
|
106
|
+
blob=b64,
|
|
107
|
+
),
|
|
108
|
+
),
|
|
109
|
+
]
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
def main():
|
|
113
|
+
import asyncio
|
|
114
|
+
|
|
115
|
+
async def _run():
|
|
116
|
+
async with stdio_server() as (read_stream, write_stream):
|
|
117
|
+
await server.run(
|
|
118
|
+
read_stream,
|
|
119
|
+
write_stream,
|
|
120
|
+
server.create_initialization_options(),
|
|
121
|
+
)
|
|
122
|
+
|
|
123
|
+
asyncio.run(_run())
|