aspose-cells-cloud-mcp 26.4.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.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Aspose.Cells Cloud Product Family
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,141 @@
1
+ Metadata-Version: 2.4
2
+ Name: aspose-cells-cloud-mcp
3
+ Version: 26.4.0
4
+ Summary: MCP server for Aspose.Cells Cloud automation (FastMCP-based)
5
+ Author-email: Aspose Cloud <support@aspose.com>
6
+ License: MIT License
7
+
8
+ Copyright (c) 2025 Aspose.Cells Cloud Product Family
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
+
28
+ Project-URL: Documentation, https://github.com/aspose-cells-cloud/Aspose.Cells-Cloud-MCP-Server#readme
29
+ Project-URL: Repository, https://github.com/aspose-cells-cloud/Aspose.Cells-Cloud-MCP-Server
30
+ Project-URL: Free Support, https://forum.aspose.cloud/c/cells/7
31
+ Keywords: MCP,Aspose,Aspose.Cells Cloud,Excel,Xlsx,PDF,server
32
+ Classifier: Development Status :: 3 - Alpha
33
+ Classifier: License :: OSI Approved :: MIT License
34
+ Classifier: Programming Language :: Python
35
+ Classifier: Programming Language :: Python :: 3
36
+ Classifier: Programming Language :: Python :: 3.11
37
+ Classifier: Programming Language :: Python :: 3.12
38
+ Classifier: Programming Language :: Python :: 3.13
39
+ Classifier: Operating System :: OS Independent
40
+ Classifier: Topic :: Office/Business
41
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
42
+ Requires-Python: <3.14,>=3.11
43
+ Description-Content-Type: text/markdown
44
+ License-File: LICENSE
45
+ Requires-Dist: fastmcp
46
+ Requires-Dist: asposecellscloud
47
+ Dynamic: license-file
48
+
49
+ ![](https://img.shields.io/badge/aspose.cells%20Cloud%20MCP-26.4.0-green?style=for-the-badge&logo=python)
50
+ ![Python Version](https://img.shields.io/badge/python-3.11%2B-blue?style=for-the-badge&logo=python)
51
+ ![License](https://img.shields.io/badge/license-MIT-green?style=for-the-badge&logo=python)
52
+
53
+ ## Overview
54
+
55
+ **Aspose.Cells Cloud MCP Server** is a FastMCP-based MCP server built on top of [Aspose.Cells Cloud SDK for Python](https://products.aspose.cloud/cells/python/). It automates the creation and editing of Microsoft Excel spreadsheets and exposes operations as MCP tools that any MCP-compatible client can call. Supported transports: `stdio`, `streamable-http`, `sse`.
56
+
57
+ ## Features
58
+
59
+ - convert spreadsheet
60
+
61
+ ## Requirements
62
+
63
+ - Python 3.11+
64
+ - [Aspose.Cells Cloud SDK for Python](https://products.aspose.cloud/cells/python/). This library is a [commercial product](https://purchase.aspose.cloud/buy/cells/python).
65
+ You'll need to obtain a valid license for Aspose.Cells Cloud. The package will install this dependency, but you're responsible for complying with Aspose's licensing terms.
66
+
67
+ ## Installation
68
+
69
+ ```powershell
70
+
71
+ python -m pip install aspose-cells-cloud-mcp
72
+
73
+ ```
74
+
75
+ From source (download repo and install requirements):
76
+
77
+ ```powershell
78
+
79
+ git clone https://github.com/aspose-cells-cloud/Aspose.Cells-Cloud-MCP-Server
80
+ cd Aspose.Cells-Cloud-MCP-Server
81
+ python -m pip install -r requirements.txt
82
+
83
+ ```
84
+
85
+ ## Command Line Interface
86
+
87
+ After installation, the CLI command is available:
88
+
89
+ ```bash
90
+ aspose-cells-cloud-mcp
91
+ ```
92
+
93
+ By default, the server runs with the `stdio` transport.
94
+
95
+ Run without installation:
96
+
97
+ ```bash
98
+ python mcp_server.py
99
+ ```
100
+
101
+ ## Transports and Configuration
102
+
103
+ Supported MCP transports: `stdio`, `streamable-http`, `sse`.
104
+
105
+ ### Environment Variables
106
+
107
+ - `MCP_TRANSPORT` — `stdio` | `streamable-http` | `sse` (default `stdio`)
108
+ - `MCP_HOST` — host address (default `0.0.0.0`)
109
+ - `MCP_PORT` — port (default `8080`)
110
+ - `MCP_PATH` — HTTP path for `streamable-http` (default `/mcp`)
111
+ - `MCP_SSE_PATH` — events path for `sse` (default `/sse`)
112
+ - `LOG_LEVEL` — logging level (`INFO`, `DEBUG`, ...)
113
+
114
+ ## How to run Aspose Cells Cloud MCP Server in Docker Container
115
+
116
+ ### Build Docker Image
117
+
118
+ ```cmd
119
+
120
+ docker build -t aspose-cells-cloud-mcp-server:26.4.0 .
121
+
122
+ ```
123
+
124
+ ### Run Docker Image
125
+
126
+ ```cmd
127
+
128
+ docker run -itdp 28080:8080 -e MCP_TRANSPORT="streamable-http" -e ASPOSE_CLOUD_CLIENT_ID="yourt-aspose-cloud-client_id" -e ASPOSE_CLOUD_CLIENT_SECRET="your-aspose-cloud-client-secret" --isolation hyperv --name my-aspose-cells-cloud-mcp-instance aspose-cells-cloud-mcp-server:26.4.0
129
+
130
+ ```
131
+
132
+ ## License
133
+
134
+ This package is licensed under the MIT [LICENSE](LICENSE). However, it depends on Aspose.Cells Cloud SDK for Python is an open-source library.
135
+
136
+ You must obtain [valid client credentials](https://purchase.aspose.cloud/) for Aspose.Cells Cloud.
137
+
138
+ ## Integration with MCP Clients
139
+
140
+ - Claude Desktop MCP: add this server with `streamable-http` or `sse` transport and the URL printed by the server at startup.
141
+ - Any MCP (JSON) clients — configure the matching transport and path.
@@ -0,0 +1,93 @@
1
+ ![](https://img.shields.io/badge/aspose.cells%20Cloud%20MCP-26.4.0-green?style=for-the-badge&logo=python)
2
+ ![Python Version](https://img.shields.io/badge/python-3.11%2B-blue?style=for-the-badge&logo=python)
3
+ ![License](https://img.shields.io/badge/license-MIT-green?style=for-the-badge&logo=python)
4
+
5
+ ## Overview
6
+
7
+ **Aspose.Cells Cloud MCP Server** is a FastMCP-based MCP server built on top of [Aspose.Cells Cloud SDK for Python](https://products.aspose.cloud/cells/python/). It automates the creation and editing of Microsoft Excel spreadsheets and exposes operations as MCP tools that any MCP-compatible client can call. Supported transports: `stdio`, `streamable-http`, `sse`.
8
+
9
+ ## Features
10
+
11
+ - convert spreadsheet
12
+
13
+ ## Requirements
14
+
15
+ - Python 3.11+
16
+ - [Aspose.Cells Cloud SDK for Python](https://products.aspose.cloud/cells/python/). This library is a [commercial product](https://purchase.aspose.cloud/buy/cells/python).
17
+ You'll need to obtain a valid license for Aspose.Cells Cloud. The package will install this dependency, but you're responsible for complying with Aspose's licensing terms.
18
+
19
+ ## Installation
20
+
21
+ ```powershell
22
+
23
+ python -m pip install aspose-cells-cloud-mcp
24
+
25
+ ```
26
+
27
+ From source (download repo and install requirements):
28
+
29
+ ```powershell
30
+
31
+ git clone https://github.com/aspose-cells-cloud/Aspose.Cells-Cloud-MCP-Server
32
+ cd Aspose.Cells-Cloud-MCP-Server
33
+ python -m pip install -r requirements.txt
34
+
35
+ ```
36
+
37
+ ## Command Line Interface
38
+
39
+ After installation, the CLI command is available:
40
+
41
+ ```bash
42
+ aspose-cells-cloud-mcp
43
+ ```
44
+
45
+ By default, the server runs with the `stdio` transport.
46
+
47
+ Run without installation:
48
+
49
+ ```bash
50
+ python mcp_server.py
51
+ ```
52
+
53
+ ## Transports and Configuration
54
+
55
+ Supported MCP transports: `stdio`, `streamable-http`, `sse`.
56
+
57
+ ### Environment Variables
58
+
59
+ - `MCP_TRANSPORT` — `stdio` | `streamable-http` | `sse` (default `stdio`)
60
+ - `MCP_HOST` — host address (default `0.0.0.0`)
61
+ - `MCP_PORT` — port (default `8080`)
62
+ - `MCP_PATH` — HTTP path for `streamable-http` (default `/mcp`)
63
+ - `MCP_SSE_PATH` — events path for `sse` (default `/sse`)
64
+ - `LOG_LEVEL` — logging level (`INFO`, `DEBUG`, ...)
65
+
66
+ ## How to run Aspose Cells Cloud MCP Server in Docker Container
67
+
68
+ ### Build Docker Image
69
+
70
+ ```cmd
71
+
72
+ docker build -t aspose-cells-cloud-mcp-server:26.4.0 .
73
+
74
+ ```
75
+
76
+ ### Run Docker Image
77
+
78
+ ```cmd
79
+
80
+ docker run -itdp 28080:8080 -e MCP_TRANSPORT="streamable-http" -e ASPOSE_CLOUD_CLIENT_ID="yourt-aspose-cloud-client_id" -e ASPOSE_CLOUD_CLIENT_SECRET="your-aspose-cloud-client-secret" --isolation hyperv --name my-aspose-cells-cloud-mcp-instance aspose-cells-cloud-mcp-server:26.4.0
81
+
82
+ ```
83
+
84
+ ## License
85
+
86
+ This package is licensed under the MIT [LICENSE](LICENSE). However, it depends on Aspose.Cells Cloud SDK for Python is an open-source library.
87
+
88
+ You must obtain [valid client credentials](https://purchase.aspose.cloud/) for Aspose.Cells Cloud.
89
+
90
+ ## Integration with MCP Clients
91
+
92
+ - Claude Desktop MCP: add this server with `streamable-http` or `sse` transport and the URL printed by the server at startup.
93
+ - Any MCP (JSON) clients — configure the matching transport and path.
@@ -0,0 +1,141 @@
1
+ Metadata-Version: 2.4
2
+ Name: aspose-cells-cloud-mcp
3
+ Version: 26.4.0
4
+ Summary: MCP server for Aspose.Cells Cloud automation (FastMCP-based)
5
+ Author-email: Aspose Cloud <support@aspose.com>
6
+ License: MIT License
7
+
8
+ Copyright (c) 2025 Aspose.Cells Cloud Product Family
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
+
28
+ Project-URL: Documentation, https://github.com/aspose-cells-cloud/Aspose.Cells-Cloud-MCP-Server#readme
29
+ Project-URL: Repository, https://github.com/aspose-cells-cloud/Aspose.Cells-Cloud-MCP-Server
30
+ Project-URL: Free Support, https://forum.aspose.cloud/c/cells/7
31
+ Keywords: MCP,Aspose,Aspose.Cells Cloud,Excel,Xlsx,PDF,server
32
+ Classifier: Development Status :: 3 - Alpha
33
+ Classifier: License :: OSI Approved :: MIT License
34
+ Classifier: Programming Language :: Python
35
+ Classifier: Programming Language :: Python :: 3
36
+ Classifier: Programming Language :: Python :: 3.11
37
+ Classifier: Programming Language :: Python :: 3.12
38
+ Classifier: Programming Language :: Python :: 3.13
39
+ Classifier: Operating System :: OS Independent
40
+ Classifier: Topic :: Office/Business
41
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
42
+ Requires-Python: <3.14,>=3.11
43
+ Description-Content-Type: text/markdown
44
+ License-File: LICENSE
45
+ Requires-Dist: fastmcp
46
+ Requires-Dist: asposecellscloud
47
+ Dynamic: license-file
48
+
49
+ ![](https://img.shields.io/badge/aspose.cells%20Cloud%20MCP-26.4.0-green?style=for-the-badge&logo=python)
50
+ ![Python Version](https://img.shields.io/badge/python-3.11%2B-blue?style=for-the-badge&logo=python)
51
+ ![License](https://img.shields.io/badge/license-MIT-green?style=for-the-badge&logo=python)
52
+
53
+ ## Overview
54
+
55
+ **Aspose.Cells Cloud MCP Server** is a FastMCP-based MCP server built on top of [Aspose.Cells Cloud SDK for Python](https://products.aspose.cloud/cells/python/). It automates the creation and editing of Microsoft Excel spreadsheets and exposes operations as MCP tools that any MCP-compatible client can call. Supported transports: `stdio`, `streamable-http`, `sse`.
56
+
57
+ ## Features
58
+
59
+ - convert spreadsheet
60
+
61
+ ## Requirements
62
+
63
+ - Python 3.11+
64
+ - [Aspose.Cells Cloud SDK for Python](https://products.aspose.cloud/cells/python/). This library is a [commercial product](https://purchase.aspose.cloud/buy/cells/python).
65
+ You'll need to obtain a valid license for Aspose.Cells Cloud. The package will install this dependency, but you're responsible for complying with Aspose's licensing terms.
66
+
67
+ ## Installation
68
+
69
+ ```powershell
70
+
71
+ python -m pip install aspose-cells-cloud-mcp
72
+
73
+ ```
74
+
75
+ From source (download repo and install requirements):
76
+
77
+ ```powershell
78
+
79
+ git clone https://github.com/aspose-cells-cloud/Aspose.Cells-Cloud-MCP-Server
80
+ cd Aspose.Cells-Cloud-MCP-Server
81
+ python -m pip install -r requirements.txt
82
+
83
+ ```
84
+
85
+ ## Command Line Interface
86
+
87
+ After installation, the CLI command is available:
88
+
89
+ ```bash
90
+ aspose-cells-cloud-mcp
91
+ ```
92
+
93
+ By default, the server runs with the `stdio` transport.
94
+
95
+ Run without installation:
96
+
97
+ ```bash
98
+ python mcp_server.py
99
+ ```
100
+
101
+ ## Transports and Configuration
102
+
103
+ Supported MCP transports: `stdio`, `streamable-http`, `sse`.
104
+
105
+ ### Environment Variables
106
+
107
+ - `MCP_TRANSPORT` — `stdio` | `streamable-http` | `sse` (default `stdio`)
108
+ - `MCP_HOST` — host address (default `0.0.0.0`)
109
+ - `MCP_PORT` — port (default `8080`)
110
+ - `MCP_PATH` — HTTP path for `streamable-http` (default `/mcp`)
111
+ - `MCP_SSE_PATH` — events path for `sse` (default `/sse`)
112
+ - `LOG_LEVEL` — logging level (`INFO`, `DEBUG`, ...)
113
+
114
+ ## How to run Aspose Cells Cloud MCP Server in Docker Container
115
+
116
+ ### Build Docker Image
117
+
118
+ ```cmd
119
+
120
+ docker build -t aspose-cells-cloud-mcp-server:26.4.0 .
121
+
122
+ ```
123
+
124
+ ### Run Docker Image
125
+
126
+ ```cmd
127
+
128
+ docker run -itdp 28080:8080 -e MCP_TRANSPORT="streamable-http" -e ASPOSE_CLOUD_CLIENT_ID="yourt-aspose-cloud-client_id" -e ASPOSE_CLOUD_CLIENT_SECRET="your-aspose-cloud-client-secret" --isolation hyperv --name my-aspose-cells-cloud-mcp-instance aspose-cells-cloud-mcp-server:26.4.0
129
+
130
+ ```
131
+
132
+ ## License
133
+
134
+ This package is licensed under the MIT [LICENSE](LICENSE). However, it depends on Aspose.Cells Cloud SDK for Python is an open-source library.
135
+
136
+ You must obtain [valid client credentials](https://purchase.aspose.cloud/) for Aspose.Cells Cloud.
137
+
138
+ ## Integration with MCP Clients
139
+
140
+ - Claude Desktop MCP: add this server with `streamable-http` or `sse` transport and the URL printed by the server at startup.
141
+ - Any MCP (JSON) clients — configure the matching transport and path.
@@ -0,0 +1,19 @@
1
+ LICENSE
2
+ README.md
3
+ mcp_server.py
4
+ pyproject.toml
5
+ aspose_cells_cloud_mcp.egg-info/PKG-INFO
6
+ aspose_cells_cloud_mcp.egg-info/SOURCES.txt
7
+ aspose_cells_cloud_mcp.egg-info/dependency_links.txt
8
+ aspose_cells_cloud_mcp.egg-info/entry_points.txt
9
+ aspose_cells_cloud_mcp.egg-info/requires.txt
10
+ aspose_cells_cloud_mcp.egg-info/top_level.txt
11
+ core/__init__.py
12
+ core/convert.py
13
+ core/io.py
14
+ core/utils/__init__.py
15
+ core/utils/spreadsheet_util.py
16
+ tests/test_cells_cloud_mcp_docker.py
17
+ tests/test_cells_cloud_mcp_http.py
18
+ tests/test_cells_cloud_mcp_stdio.py
19
+ tests/test_data_handler.py
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ aspose-cells-cloud-mcp = mcp_server:run_server
@@ -0,0 +1,2 @@
1
+ fastmcp
2
+ asposecellscloud
File without changes
@@ -0,0 +1,47 @@
1
+ import os
2
+ from asposecellscloud.requests import *
3
+ from asposecellscloud.apis import *
4
+ import base64
5
+
6
+ from core.utils.spreadsheet_util import get_cells_cloud_client
7
+
8
+ def convert_spreadsheet_to_pdf( spreadsheet_b64string :str ) -> str:
9
+ request = ConvertSpreadsheetToPdfRequest( base64.b64decode( spreadsheet_b64string.strip()) )
10
+ temp_file_path = get_cells_cloud_client().convert_spreadsheet_to_pdf( request)
11
+ with open(temp_file_path, "rb") as file:
12
+ file_bytes = file.read()
13
+ os.remove(temp_file_path)
14
+ return base64.b64encode(file_bytes)
15
+
16
+ def convert_spreadsheet_to_html( spreadsheet_b64string :str ) -> str:
17
+ request = ConvertSpreadsheetRequest( base64.b64decode( spreadsheet_b64string.strip()),"html" )
18
+ temp_file_path = get_cells_cloud_client().convert_spreadsheet( request)
19
+ with open(temp_file_path, "rb") as file:
20
+ file_bytes = file.read()
21
+ os.remove(temp_file_path)
22
+ return base64.b64encode(file_bytes)
23
+
24
+ def convert_excel_to_csv( spreadsheet_b64string :str ) -> str:
25
+ request = ConvertSpreadsheetToCsvRequest( base64.b64decode( spreadsheet_b64string.strip()) )
26
+ temp_file_path = get_cells_cloud_client().convert_spreadsheet_to_csv( request)
27
+ with open(temp_file_path, "rb") as file:
28
+ file_bytes = file.read()
29
+ os.remove(temp_file_path)
30
+ return base64.b64encode(file_bytes)
31
+
32
+ def convert_spreadsheet_to_json( spreadsheet_b64string :str ) -> str:
33
+ request = ConvertSpreadsheetToJsonRequest( base64.b64decode( spreadsheet_b64string.strip()) )
34
+ temp_file_path = get_cells_cloud_client().convert_spreadsheet_to_json( request)
35
+ with open(temp_file_path, "rb") as file:
36
+ file_bytes = file.read()
37
+ os.remove(temp_file_path)
38
+ return base64.b64encode(file_bytes)
39
+
40
+ def convert_spreadsheet( spreadsheet_b64string :str , format:str) ->str:
41
+ request = ConvertSpreadsheetRequest( base64.b64decode( spreadsheet_b64string), format=format )
42
+ temp_file_path = get_cells_cloud_client().convert_spreadsheet(request)
43
+ with open(temp_file_path, "rb") as file:
44
+ file_bytes = file.read()
45
+ os.remove(temp_file_path)
46
+ return base64.b64encode(file_bytes)
47
+
@@ -0,0 +1,26 @@
1
+ from utils.spreadsheet_util import *
2
+ from asposecellscloud.requests import SaveSpreadsheetAsRequest
3
+ from asposecellscloud.models import *
4
+ import base64
5
+
6
+
7
+ def upload_file(file_content_b64string:str, file_path :str,storage_name:str =None):
8
+ request = UploadFileRequest( base64.b64decode( file_content_b64string.strip()) , file_path ,storage_name)
9
+ get_cells_cloud_client().upload_file(request)
10
+
11
+ def create_spreadsheet(spreadsheet_name:str ,format:str, folder:str, storage_name :str =None ):
12
+ path = folder.repace("\\","/")
13
+ if not path.endswith('/'):
14
+ path = path + '/'
15
+ path = path +spreadsheet_name
16
+ request = CreateSpreadsheetRequest(format , None, path,storage_name)
17
+ get_cells_cloud_client().create_spreadsheet(request)
18
+
19
+ def save_spreadsheet_as(spreadsheet_name:str ,format:str, save_path:str = None ,folder:str=None ,storage_name :str =None ):
20
+ request = SaveSpreadsheetAsRequest( spreadsheet_name, format )
21
+ request
22
+ if save_path is not None:
23
+ save_options_data = SaveOptionsData()
24
+ save_options_data.filename = save_path
25
+ request.save_options_data = save_options_data
26
+ get_cells_cloud_client().save_spreadsheet_as(request)
File without changes
@@ -0,0 +1,11 @@
1
+ import os
2
+
3
+ from asposecellscloud import CellsApi
4
+
5
+ def apply_license(client_id:str, client_secret:str):
6
+ os.environ["ASPOSE_CLOUD_CLIENT_ID"] = client_id
7
+ os.environ["ASPOSE_CLOUD_CLIENT_SECRET"] =client_secret
8
+ cells_cloud_client = get_cells_cloud_client()
9
+
10
+ def get_cells_cloud_client()->CellsApi:
11
+ return CellsApi( os.getenv("ASPOSE_CLOUD_CLIENT_ID"), os.getenv("ASPOSE_CLOUD_CLIENT_SECRET"))
@@ -0,0 +1,159 @@
1
+ import logging
2
+ import os
3
+ from fastmcp import FastMCP
4
+
5
+ import core.convert
6
+
7
+ mcp = FastMCP('Aspose.Cells Cloud MCP Server')
8
+
9
+ def _setup_logging():
10
+ level = os.getenv('LOG_LEVEL', '')
11
+ logging.basicConfig(level=getattr(logging, level, logging.INFO), format='%(asctime)s - %(levelname)s - %(message)s')
12
+ return logging.getLogger('mcp')
13
+
14
+ def register_tools() -> None:
15
+ @mcp.tool(description="Upload file content (provided as a Base64 string) to Aspose Cloud Storage at a specified path.")
16
+ def upload_file(file_b64string: str, file_path :str,storage_name:str =None):
17
+ """
18
+ Uploads a file to Aspose Cloud Storage using Base64 encoded content.
19
+
20
+ Use this tool when you have file data (e.g., from a conversion result or user upload)
21
+ and need to persist it to the cloud.
22
+
23
+ Parameters:
24
+ - file_b64string: The content of the file encoded as a Base64 string. Do not pass a file path here.
25
+ - file_path: The destination path in the cloud storage where the file will be saved (e.g., '/folder/filename.pdf').
26
+ - storage_name: (Optional) The name of the storage.
27
+
28
+ Returns:
29
+ - The storage path of the successfully uploaded file.
30
+ """
31
+ return core.io.upload_file(file_b64string,file_path,storage_name)
32
+
33
+ @mcp.tool(description="Convert a spreadsheet in Aspose Cloud Storage to a different format (e.g., XLSX to PDF) and save it as a new file.")
34
+ def save_spreadsheet_as( filename :str, target_format:str,target_file_path:str , folder: str= None, storage_name:str =None):
35
+ """
36
+ Converts a source spreadsheet to a specified format and saves it to a new path.
37
+
38
+ Parameters:
39
+ - filename: The name of the source file (e.g., 'data.xlsx').
40
+ - target_format: The desired output format (e.g., 'PDF', 'CSV', 'XLSX').
41
+ - target_file_path: The full path where the converted file should be saved (e.g., '/converted/data.pdf').
42
+ - folder: (Optional) The folder path of the source file.
43
+ - storage_name: (Optional) The name of the storage.
44
+ """
45
+ return core.io.save_spreadsheet_as(filename,target_format,target_file_path,folder,storage_name)
46
+
47
+ @mcp.tool(description="Convert Spreadsheet content (provided as a Base64 string) to a specified format such as PDF, CSV, HTML, or XPS.")
48
+ def convert_spreadsheet(spreadsheet_b64string: str, format:str):
49
+ """
50
+ Converts a Spreadsheet file to various other formats.
51
+
52
+ This tool accepts the raw content of a Spreadsheet file encoded as a Base64 string
53
+ and a target format string, returning the converted file content.
54
+
55
+ Parameters:
56
+ - spreadsheet_b64string: The content of the Spreadsheet file (e.g., .xlsx, .ods, .txt, .json, .xml, .xls, and so on) encoded as a Base64 string.
57
+ Note: Do not pass a file path; the file content must be read and encoded first.
58
+ - format: The desired output format (e.g., 'PDF', 'CSV', 'HTML', 'XPS', 'ODS').
59
+ """
60
+ return core.convert.convert_spreadsheet( spreadsheet_b64string , format=format )
61
+
62
+ @mcp.tool(name="convert_excel_to_pdf", description="Convert an Excel file to PDF. Input must be provided as a Base64 encoded string.")
63
+ def convert_excel_to_pdf(spreadsheet_b64string: str):
64
+ """
65
+ Converts Excel content (XLSX/XLS) to a PDF document.
66
+
67
+ This tool accepts the raw file content encoded in Base64 and returns the converted PDF.
68
+ Use this when the user wants to transform a spreadsheet into a non-editable format.
69
+
70
+ Parameters:
71
+ - spreadsheet_b64string: The content of the Excel file encoded as a Base64 string.
72
+ Do not pass a file path; the content must be read and encoded first.
73
+ """
74
+ return core.convert.convert_spreadsheet_to_pdf(spreadsheet_b64string)
75
+
76
+ @mcp.tool(name="convert_ods_to_pdf",description="Convert a ODS file to PDF. Input must be provided as a Base64 encoded string.")
77
+ def convert_ods_to_pdf(ods_b64string: str):
78
+ """
79
+ Converts Open Document content (ods) to a PDF document.
80
+
81
+ This tool accepts the raw file content encoded in Base64 and returns the converted PDF.
82
+ Use this when the user wants to transform a spreadsheet into a non-editable format.
83
+
84
+ Parameters:
85
+ - ods_b64string: The content of the Open Document file encoded as a Base64 string.
86
+ Do not pass a file path; the content must be read and encoded first.
87
+ """
88
+ return core.convert.convert_spreadsheet_to_pdf(ods_b64string)
89
+
90
+ @mcp.tool(name="convert_excel_to_csv",description="Convert Excel content (provided as a Base64 string) to CSV format.")
91
+ def convert_excel_to_csv(spreadsheet_b64string: str):
92
+ """
93
+ Converts an Excel file to CSV format.
94
+
95
+ This tool accepts the raw content of an Excel file encoded as a Base64 string
96
+ and returns the converted CSV data (usually as a string or Base64).
97
+
98
+ Parameters:
99
+ - spreadsheet_b64string: The content of the Excel file (.xlsx or .xls) encoded as a Base64 string.
100
+ Note: Do not pass a file path; the file content must be read and encoded first.
101
+ """
102
+ return core.convert.convert_excel_to_csv(spreadsheet_b64string)
103
+
104
+ @mcp.tool(name="convert_excel_to_json",description="Convert Excel content (provided as a Base64 string) to JSON format")
105
+ def convert_excel_to_json(spreadsheet_b64string: str):
106
+ """
107
+ Converts an Excel file to JSON format.
108
+
109
+ This tool accepts the raw content of an Excel file encoded as a Base64 string
110
+ and returns the converted JSON data representing the spreadsheet rows and columns.
111
+
112
+ Parameters:
113
+ - spreadsheet_b64string: The content of the Excel file (.xlsx or .xls) encoded as a Base64 string.
114
+ Note: Do not pass a file path; the file content must be read and encoded first.
115
+ """
116
+ return core.convert.convert_spreadsheet_to_json(spreadsheet_b64string)
117
+
118
+ @mcp.tool(name ="convert_excel",
119
+ description="Convert Excel content (provided as a Base64 string) to a specified format such as PDF, CSV, HTML, or XPS.")
120
+ def convert_excel(spreadsheet_b64string: str, format: str):
121
+ """
122
+ Converts an Excel file to various other formats.
123
+
124
+ This tool accepts the raw content of an Excel file encoded as a Base64 string
125
+ and a target format string, returning the converted file content.
126
+
127
+ Parameters:
128
+ - spreadsheet_b64string: The content of the Excel file (.xlsx or .xls) encoded as a Base64 string.
129
+ Note: Do not pass a file path; the file content must be read and encoded first.
130
+ - format: The desired output format (e.g., 'PDF', 'CSV', 'HTML', 'XPS', 'ODS').
131
+ """
132
+ return core.convert.convert_spreadsheet(spreadsheet_b64string, format)
133
+
134
+ def run_server(transport: str | None=None, host: str='0.0.0.0', port: int=8080, path: str='/mcp', client_id: str | None=None, client_secret: str| None=None) -> None:
135
+ logger = _setup_logging()
136
+ register_tools()
137
+ tr = (transport or os.getenv('MCP_TRANSPORT') or os.getenv('TRANSPORT') or 'stdio').strip().lower()
138
+ logger.info(
139
+ f"Client ID( {os.getenv('ASPOSE_CLOUD_CLIENT_ID')}) and Client Secret ({os.getenv('ASPOSE_CLOUD_CLIENT_SECRET')})")
140
+ if client_id is not None and client_secret is not None:
141
+
142
+ os.environ['ASPOSE_CLOUD_CLIENT_ID'] = client_id
143
+ os.environ['ASPOSE_CLOUD_CLIENT_SECRET'] = client_secret
144
+
145
+ host_env = (os.getenv('MCP_HOST') or os.getenv('HOST') or host)
146
+ port_env = int(os.getenv('MCP_PORT') or os.getenv('PORT') or port)
147
+ path_http_env = (os.getenv('MCP_PATH') or path)
148
+ path_sse_env = (os.getenv('MCP_SSE_PATH') or '/sse')
149
+ logger.info('Starting Aspose.Cells Cloud MCP Server (FastMCP)...')
150
+ logger.info(f'Transport: %s', tr)
151
+ if tr in {'streamable-http', 'sse'}:
152
+ path_for_tr = path_sse_env if tr == 'sse' else path_http_env
153
+ logger.info('Listening on http://%s:%s%s (%s)', host_env, port_env, path_for_tr, tr)
154
+ mcp.run(transport=tr, host=host_env, port=port_env, path=path_for_tr)
155
+ else:
156
+ mcp.run(transport='stdio')
157
+
158
+ if __name__ == '__main__':
159
+ run_server()
@@ -0,0 +1,56 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "aspose-cells-cloud-mcp"
7
+ version = "26.4.0"
8
+ description = "MCP server for Aspose.Cells Cloud automation (FastMCP-based)"
9
+ readme = "README.md"
10
+ requires-python = ">=3.11,<3.14"
11
+ authors = [
12
+ { name = "Aspose Cloud", email = "support@aspose.com" }
13
+ ]
14
+ license = { file = "LICENSE" }
15
+ dependencies = [
16
+ "fastmcp",
17
+ "asposecellscloud",
18
+ ]
19
+
20
+ keywords = [
21
+ "MCP",
22
+ "Aspose",
23
+ "Aspose.Cells Cloud",
24
+ "Excel",
25
+ "Xlsx",
26
+ "PDF",
27
+ "server",
28
+ ]
29
+
30
+ classifiers = [
31
+ "Development Status :: 3 - Alpha",
32
+ "License :: OSI Approved :: MIT License",
33
+ "Programming Language :: Python",
34
+ "Programming Language :: Python :: 3",
35
+ "Programming Language :: Python :: 3.11",
36
+ "Programming Language :: Python :: 3.12",
37
+ "Programming Language :: Python :: 3.13",
38
+ "Operating System :: OS Independent",
39
+ "Topic :: Office/Business",
40
+ "Topic :: Software Development :: Libraries :: Python Modules",
41
+ ]
42
+
43
+ [project.urls]
44
+ "Documentation" = "https://github.com/aspose-cells-cloud/Aspose.Cells-Cloud-MCP-Server#readme"
45
+ "Repository" = "https://github.com/aspose-cells-cloud/Aspose.Cells-Cloud-MCP-Server"
46
+ "Free Support" = "https://forum.aspose.cloud/c/cells/7"
47
+
48
+ [tool.setuptools]
49
+ py-modules = ["mcp_server"]
50
+
51
+ [tool.setuptools.packages.find]
52
+ include = ["core*"]
53
+
54
+ [project.scripts]
55
+ aspose-cells-cloud-mcp = "mcp_server:run_server"
56
+
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,59 @@
1
+ import os
2
+
3
+ import pytest
4
+ import asyncio
5
+ import base64
6
+ import binascii
7
+ from fastmcp import Client
8
+
9
+ def get_book1_xlsx()->str:
10
+ try:
11
+ with open("D:\\cells.cloud-4.0\\src\\testdata\\Book1.xlsx", "rb") as f:
12
+ binary_data = f.read()
13
+ base64_bytes = base64.b64encode(binary_data)
14
+ base64_str = base64_bytes.decode('utf-8')
15
+ return base64_str
16
+ except Exception as e:
17
+ print(e)
18
+ return ""
19
+
20
+ config = {
21
+ "mcpServers": {
22
+ "my-aspose-server": {
23
+ "url": "http://127.0.0.1:28080/mcp",
24
+ "transport": "streamable-http"
25
+ }
26
+ }
27
+ }
28
+
29
+
30
+ @pytest.mark.asyncio
31
+ class TestCellsCloudMCPHttp:
32
+
33
+ async def test_full_workflow(self):
34
+
35
+ async with Client(config) as client:
36
+ # 2. Test by listing all available tools to verify that the service has started and is interactive
37
+ tools = await client.list_tools()
38
+ tool_names = [t.name for t in tools]
39
+
40
+ print(f"Available tools: {tool_names}")
41
+ assert "convert_excel_to_pdf" in tool_names, "Expected 'convert_excel_to_pdf' tool to be registered."
42
+
43
+ # 3. Use the tool for normal testing
44
+ book1_xlsx = get_book1_xlsx()
45
+ if book1_xlsx is None or len(book1_xlsx) == 0:
46
+ print("Do not get book1.xlsx")
47
+ # print(book1_xlsx)
48
+ result = await client.call_tool(
49
+ name='convert_excel_to_pdf',
50
+ arguments = {'spreadsheet_b64string': book1_xlsx}
51
+ )
52
+ if result.is_error:
53
+ assert False
54
+ else:
55
+ success_message = "".join([c.text for c in result.content if hasattr(c, 'text')])
56
+ filedata = base64.b64decode(success_message)
57
+ with open("Book1-Http.pdf", "wb") as file:
58
+ file.write(filedata)
59
+ assert True
@@ -0,0 +1,72 @@
1
+ import os
2
+
3
+ import pytest
4
+ import asyncio
5
+ import base64
6
+ import binascii
7
+ from fastmcp import Client
8
+
9
+ def get_book1_xlsx()->str:
10
+ try:
11
+ with open("D:\\cells.cloud-4.0\\src\\testdata\\Book1.xlsx", "rb") as f:
12
+ binary_data = f.read()
13
+ base64_bytes = base64.b64encode(binary_data)
14
+ base64_str = base64_bytes.decode('utf-8')
15
+ return base64_str
16
+ except Exception as e:
17
+ print(e)
18
+ return ""
19
+
20
+ config = {
21
+ "mcpServers": {
22
+ "my-aspose-server": {
23
+ "url": "http://127.0.0.1:8080/mcp", # 你的服务端地址
24
+ "transport": "streamable-http"
25
+ }
26
+ }
27
+ }
28
+
29
+
30
+ @pytest.mark.asyncio
31
+ class TestCellsCloudMCPHttp:
32
+
33
+ async def test_full_workflow(self):
34
+
35
+ async with Client(config) as client:
36
+ # 2. Test by listing all available tools to verify that the service has started and is interactive
37
+ tools = await client.list_tools()
38
+ tool_names = [t.name for t in tools]
39
+
40
+ print(f"Available tools: {tool_names}")
41
+ assert "convert_excel_to_pdf" in tool_names, "Expected 'convert_excel_to_pdf' tool to be registered."
42
+
43
+ # 3. Use the tool for normal testing
44
+ book1_xlsx = get_book1_xlsx()
45
+ if book1_xlsx is None or len(book1_xlsx) == 0:
46
+ print("Do not get book1.xlsx")
47
+ # print(book1_xlsx)
48
+ result = await client.call_tool(
49
+ name='convert_excel_to_pdf',
50
+ arguments = {'spreadsheet_b64string': book1_xlsx}
51
+ )
52
+ if result.is_error:
53
+ assert False
54
+ else:
55
+ success_message = "".join([c.text for c in result.content if hasattr(c, 'text')])
56
+ filedata = base64.b64decode(success_message)
57
+ with open("Book1-Http.pdf", "wb") as file:
58
+ file.write(filedata)
59
+ assert True
60
+
61
+ # # 4. Test abnormal situation
62
+ # try:
63
+ # await client.call_tool(
64
+ # "convert_excel_to_pdf",
65
+ # {"file_name": "bad_file.csv", "output_name": "out.pdf"}
66
+ # )
67
+ # # If no exception is thrown above, the test fails
68
+ # assert False, "Expected a ValueError for invalid file format"
69
+ # except Exception as e:
70
+ # # Caught the expected exception
71
+ # print(f"❌ Expected error caught: {e}")
72
+ # assert "Only support .xlsx" in str(e)
@@ -0,0 +1,205 @@
1
+ import os
2
+
3
+ import pytest
4
+ import asyncio
5
+ import base64
6
+ import binascii
7
+ from fastmcp import Client
8
+ from fastmcp.client import StdioTransport
9
+
10
+ from tests.test_data_handler import get_book_text_ods, get_book1_xlsx
11
+
12
+ SERVER_FILE_PATH = "mcp_server.py"
13
+
14
+
15
+ @pytest.mark.asyncio
16
+ class TestCellsCloudMCPStdio:
17
+
18
+ async def test_full_workflow(self):
19
+ """
20
+ Test the complete stdio workflow: connect -> initialize -> list tools -> call tools
21
+ The Client of FastMCP automatically handles stdio communication.
22
+ """
23
+ # 1. Start the client, it will automatically start the server.py subprocess
24
+ # Note: Here, a file path is passed, not a module instance
25
+ env_vars = {"ASPOSE_CLOUD_CLIENT_ID": os.getenv("CellsCloudClientId"),"ASPOSE_CLOUD_CLIENT_SECRET": os.getenv("CellsCloudClientSecret")}
26
+ transport = StdioTransport(
27
+ command="python",
28
+ args=[SERVER_FILE_PATH],
29
+ env=env_vars
30
+ )
31
+ async with Client(transport) as client:
32
+ # 2. Test by listing all available tools to verify that the service has started and is interactive
33
+ tools = await client.list_tools()
34
+ tool_names = [t.name for t in tools]
35
+
36
+ print(f"Available tools: {tool_names}")
37
+ assert "convert_spreadsheet" in tool_names, "Expected 'convert_spreadsheet' tool to be registered."
38
+
39
+ # 3. Use the tool for normal testing
40
+ book1_xlsx = get_book1_xlsx()
41
+ if book1_xlsx is None or len(book1_xlsx) == 0:
42
+ print("Do not get book1.xlsx")
43
+
44
+ result = await client.call_tool(
45
+ name='convert_spreadsheet',
46
+ arguments = {'spreadsheet_b64string': book1_xlsx,'format':'pdf'}
47
+ )
48
+
49
+ if result.is_error:
50
+ assert False
51
+ else:
52
+
53
+ success_message = "".join([c.text for c in result.content if hasattr(c, 'text')])
54
+ filedata = base64.b64decode(success_message)
55
+ with open("convert_spreadsheet.pdf", "wb") as file:
56
+ file.write(filedata)
57
+ assert True
58
+
59
+ # # 4. Test abnormal situation
60
+ # try:
61
+ # await client.call_tool(
62
+ # "convert_excel_to_pdf",
63
+ # {"file_name": "bad_file.csv", "output_name": "out.pdf"}
64
+ # )
65
+ # # If no exception is thrown above, the test fails
66
+ # assert False, "Expected a ValueError for invalid file format"
67
+ # except Exception as e:
68
+ # # Caught the expected exception
69
+ # print(f"❌ Expected error caught: {e}")
70
+ # assert "Only support .xlsx" in str(e)
71
+ async def test_convert_excel_to_csv_workflow(self):
72
+ """
73
+ Test the complete stdio workflow: connect -> initialize -> list tools -> call tools
74
+ The Client of FastMCP automatically handles stdio communication.
75
+ """
76
+ # 1. Start the client, it will automatically start the server.py subprocess
77
+ # Note: Here, a file path is passed, not a module instance
78
+ env_vars = {"ASPOSE_CLOUD_CLIENT_ID": os.getenv("CellsCloudClientId"),"ASPOSE_CLOUD_CLIENT_SECRET": os.getenv("CellsCloudClientSecret")}
79
+ transport = StdioTransport(
80
+ command="python",
81
+ args=[SERVER_FILE_PATH],
82
+ env=env_vars
83
+ )
84
+ async with Client(transport) as client:
85
+ # 3. Use the tool for normal testing
86
+ book1_xlsx = get_book1_xlsx()
87
+ if book1_xlsx is None or len(book1_xlsx) == 0:
88
+ print("Do not get book1.xlsx")
89
+
90
+ result = await client.call_tool(
91
+ name='convert_excel_to_csv',
92
+ arguments = {'spreadsheet_b64string': book1_xlsx}
93
+ )
94
+
95
+ if result.is_error:
96
+ assert False
97
+ else:
98
+
99
+ success_message = "".join([c.text for c in result.content if hasattr(c, 'text')])
100
+ filedata = base64.b64decode(success_message)
101
+ with open("test_convert_excel_to_csv_workflow.csv", "wb") as file:
102
+ file.write(filedata)
103
+ assert True
104
+ async def test_convert_excel_to_pdf_workflow(self):
105
+ """
106
+ Test the complete stdio workflow: connect -> initialize -> list tools -> call tools
107
+ The Client of FastMCP automatically handles stdio communication.
108
+ """
109
+ # 1. Start the client, it will automatically start the server.py subprocess
110
+ # Note: Here, a file path is passed, not a module instance
111
+ env_vars = {"ASPOSE_CLOUD_CLIENT_ID": os.getenv("CellsCloudClientId"),"ASPOSE_CLOUD_CLIENT_SECRET": os.getenv("CellsCloudClientSecret")}
112
+ transport = StdioTransport(
113
+ command="python",
114
+ args=[SERVER_FILE_PATH],
115
+ env=env_vars
116
+ )
117
+ async with Client(transport) as client:
118
+ # 3. Use the tool for normal testing
119
+ book1_xlsx = get_book1_xlsx()
120
+ if book1_xlsx is None or len(book1_xlsx) == 0:
121
+ print("Do not get book1.xlsx")
122
+
123
+ result = await client.call_tool(
124
+ name='convert_excel_to_pdf',
125
+ arguments = {'spreadsheet_b64string': book1_xlsx}
126
+ )
127
+
128
+ if result.is_error:
129
+ assert False
130
+ else:
131
+
132
+ success_message = "".join([c.text for c in result.content if hasattr(c, 'text')])
133
+ filedata = base64.b64decode(success_message)
134
+ with open("test_convert_excel_to_pdf_workflow.pdf", "wb") as file:
135
+ file.write(filedata)
136
+ assert True
137
+ async def test_convert_ods_to_pdf_workflow(self):
138
+ """
139
+ Test the complete stdio workflow: connect -> initialize -> list tools -> call tools
140
+ The Client of FastMCP automatically handles stdio communication.
141
+ """
142
+ # 1. Start the client, it will automatically start the server.py subprocess
143
+ # Note: Here, a file path is passed, not a module instance
144
+ env_vars = {"ASPOSE_CLOUD_CLIENT_ID": os.getenv("CellsCloudClientId"),"ASPOSE_CLOUD_CLIENT_SECRET": os.getenv("CellsCloudClientSecret")}
145
+ transport = StdioTransport(
146
+ command="python",
147
+ args=[SERVER_FILE_PATH],
148
+ env=env_vars
149
+ )
150
+ async with Client(transport) as client:
151
+ # 3. Use the tool for normal testing
152
+ book1_xlsx = get_book_text_ods()
153
+ if book1_xlsx is None or len(book1_xlsx) == 0:
154
+ print("Do not get book1.xlsx")
155
+
156
+ result = await client.call_tool(
157
+ name='convert_ods_to_pdf',
158
+ arguments = {'ods_b64string': book1_xlsx}
159
+ )
160
+
161
+ if result.is_error:
162
+ assert False
163
+ else:
164
+
165
+ success_message = "".join([c.text for c in result.content if hasattr(c, 'text')])
166
+ filedata = base64.b64decode(success_message)
167
+ with open("test_convert_ods_to_pdf_workflow.pdf", "wb") as file:
168
+ file.write(filedata)
169
+ assert True
170
+
171
+
172
+ async def test_convert_excel_to_json_workflow(self):
173
+ """
174
+ Test the complete stdio workflow: connect -> initialize -> list tools -> call tools
175
+ The Client of FastMCP automatically handles stdio communication.
176
+ """
177
+ # 1. Start the client, it will automatically start the server.py subprocess
178
+ # Note: Here, a file path is passed, not a module instance
179
+ env_vars = {"ASPOSE_CLOUD_CLIENT_ID": os.getenv("CellsCloudClientId"),
180
+ "ASPOSE_CLOUD_CLIENT_SECRET": os.getenv("CellsCloudClientSecret")}
181
+ transport = StdioTransport(
182
+ command="python",
183
+ args=[SERVER_FILE_PATH],
184
+ env=env_vars
185
+ )
186
+ async with Client(transport) as client:
187
+ # 3. Use the tool for normal testing
188
+ book1_xlsx = get_book1_xlsx()
189
+ if book1_xlsx is None or len(book1_xlsx) == 0:
190
+ print("Do not get book1.xlsx")
191
+
192
+ result = await client.call_tool(
193
+ name='convert_excel_to_json',
194
+ arguments={'spreadsheet_b64string': book1_xlsx}
195
+ )
196
+
197
+ if result.is_error:
198
+ assert False
199
+ else:
200
+
201
+ success_message = "".join([c.text for c in result.content if hasattr(c, 'text')])
202
+ filedata = base64.b64decode(success_message)
203
+ with open("test_convert_excel_to_json_workflow.json", "wb") as file:
204
+ file.write(filedata)
205
+ assert True
@@ -0,0 +1,23 @@
1
+ import base64
2
+
3
+ def get_book1_xlsx()->str:
4
+ try:
5
+ with open("D:\\cells.cloud-4.0\\src\\testdata\\Book1.xlsx", "rb") as f:
6
+ binary_data = f.read()
7
+ base64_bytes = base64.b64encode(binary_data)
8
+ base64_str = base64_bytes.decode('utf-8')
9
+ return base64_str
10
+ except Exception as e:
11
+ print(e)
12
+ return ""
13
+
14
+ def get_book_text_ods()->str:
15
+ try:
16
+ with open("D:\\cells.cloud-4.0\\src\\testdata\\BookText.ods", "rb") as f:
17
+ binary_data = f.read()
18
+ base64_bytes = base64.b64encode(binary_data)
19
+ base64_str = base64_bytes.decode('utf-8')
20
+ return base64_str
21
+ except Exception as e:
22
+ print(e)
23
+ return ""