BruceWayne1 commited on
Commit
98e2d01
·
verified ·
1 Parent(s): b98460b

Upload 10 files

Browse files
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ mcp_all_tools_templates_effects_demo.pptx filter=lfs diff=lfs merge=lfs -text
Dockerfile ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Generated by https://smithery.ai. See: https://smithery.ai/docs/config#dockerfile
2
+ FROM python:3.10-alpine
3
+
4
+ # Install system dependencies (if any required, e.g., for pillow)
5
+ RUN apk add --no-cache gcc musl-dev libffi-dev
6
+
7
+ # Set work directory
8
+ WORKDIR /app
9
+
10
+ # Copy the application code
11
+ COPY . .
12
+
13
+ # Install Python dependencies
14
+ RUN pip install --no-cache-dir -r requirements.txt
15
+
16
+ # Expose port if needed (not needed for stdio)
17
+
18
+ # Set the entrypoint to run the MCP server
19
+ ENTRYPOINT ["python", "ppt_mcp_server.py"]
LICENSE ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ MIT License
2
+
3
+ Copyright (c) 2025 GongRzhe
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.
__init__.py ADDED
@@ -0,0 +1 @@
 
 
1
+ # PowerPoint MCP Server
mcp-config.json ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "mcpServers": {
3
+ "ppt": {
4
+ "command": "/Users/gongzhe/GitRepos/Office-PowerPoint-MCP-Server/.venv/bin/python",
5
+ "args": [
6
+ "/Users/gongzhe/GitRepos/Office-PowerPoint-MCP-Server/ppt_mcp_server.py"
7
+ ],
8
+ "env": {
9
+ "PYTHONPATH": "/Users/gongzhe/GitRepos/Office-PowerPoint-MCP-Server",
10
+ "PPT_TEMPLATE_PATH": "/Users/gongzhe/GitRepos/Office-PowerPoint-MCP-Server/templates"
11
+ }
12
+ }
13
+ }
14
+ }
mcp_all_tools_templates_effects_demo.pptx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e2e1c60e525f71854d83ea313089c7e3850d353c894b6f2cd79703f4e9140ccf
3
+ size 124502
mcp_config_sample.json ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "mcpServers": {
3
+ "word-document-server": {
4
+ "command": "D:\\BackDataService\\Office-Word-MCP-Server\\.venv\\Scripts\\python.exe",
5
+ "args": [
6
+ "D:\\BackDataService\\Office-Word-MCP-Server\\word_server.py"
7
+ ],
8
+ "env": {
9
+ "PYTHONPATH": "D:\\BackDataService\\Office-Word-MCP-Server"
10
+ }
11
+ }
12
+ }
13
+ }
pyproject.toml ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "office-powerpoint-mcp-server"
7
+ version = "2.0.6"
8
+ description = "MCP Server for PowerPoint manipulation using python-pptx - Consolidated Edition"
9
+ readme = "README.md"
10
+ license = {file = "LICENSE"}
11
+ authors = [
12
+ {name = "GongRzhe", email = "gongrzhe@gmail.com"}
13
+ ]
14
+ classifiers = [
15
+ "Programming Language :: Python :: 3",
16
+ "License :: OSI Approved :: MIT License",
17
+ "Operating System :: OS Independent",
18
+ ]
19
+ requires-python = ">=3.6"
20
+ dependencies = [
21
+ "python-pptx>=0.6.21",
22
+ "mcp[cli]>=1.3.0",
23
+ "Pillow>=8.0.0",
24
+ "fonttools>=4.0.0",
25
+ ]
26
+
27
+ [project.urls]
28
+ "Homepage" = "https://github.com/GongRzhe/Office-PowerPoint-MCP-Server.git"
29
+ "Bug Tracker" = "https://github.com/GongRzhe/Office-PowerPoint-MCP-Server.git/issues"
30
+
31
+ [tool.hatch.build.targets.wheel]
32
+ only-include = ["ppt_mcp_server.py", "tools/", "utils/", "enhanced_slide_templates.json", "slide_layout_templates.json"]
33
+ sources = ["."]
34
+
35
+ [tool.hatch.build]
36
+ exclude = [
37
+ "public/demo.mp4",
38
+ "public/demo.gif",
39
+ "*.pptx"
40
+ ]
41
+
42
+ [project.scripts]
43
+ ppt_mcp_server = "ppt_mcp_server:main"
setup_mcp.py ADDED
@@ -0,0 +1,561 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Import necessary Python standard libraries
2
+ import os # For operating with file system, handling files and directory paths
3
+ import json # For processing JSON format data
4
+ import subprocess # For creating and managing subprocesses
5
+ import sys # For accessing Python interpreter related variables and functions
6
+ import platform # For getting current operating system information
7
+ import shutil # For checking if executables exist in PATH
8
+
9
+ def check_prerequisites():
10
+ """
11
+ Check if necessary prerequisites are installed
12
+
13
+ Returns:
14
+ tuple: (python_ok, uv_installed, uvx_installed, ppt_server_installed)
15
+ """
16
+ # Check Python version
17
+ python_version = sys.version_info
18
+ python_ok = python_version.major >= 3 and python_version.minor >= 6
19
+
20
+ # Check if uv/uvx is installed
21
+ uv_installed = shutil.which("uv") is not None
22
+ uvx_installed = shutil.which("uvx") is not None
23
+
24
+ # Check if office-powerpoint-mcp-server is already installed via pip
25
+ try:
26
+ result = subprocess.run(
27
+ [sys.executable, "-m", "pip", "show", "office-powerpoint-mcp-server"],
28
+ capture_output=True,
29
+ text=True,
30
+ check=False
31
+ )
32
+ ppt_server_installed = result.returncode == 0
33
+ except Exception:
34
+ ppt_server_installed = False
35
+
36
+ return (python_ok, uv_installed, uvx_installed, ppt_server_installed)
37
+
38
+ def setup_venv():
39
+ """
40
+ Function to set up Python virtual environment
41
+
42
+ Features:
43
+ - Checks if Python version meets requirements (3.6+)
44
+ - Creates Python virtual environment (if it doesn't exist)
45
+ - Installs required dependencies in the newly created virtual environment
46
+
47
+ No parameters required
48
+
49
+ Returns: Path to Python interpreter in the virtual environment
50
+ """
51
+ # Check Python version
52
+ python_version = sys.version_info
53
+ if python_version.major < 3 or (python_version.major == 3 and python_version.minor < 6):
54
+ print("Error: Python 3.6 or higher is required.")
55
+ sys.exit(1)
56
+
57
+ # Get absolute path of the directory containing the current script
58
+ base_path = os.path.abspath(os.path.dirname(__file__))
59
+ # Set virtual environment directory path
60
+ venv_path = os.path.join(base_path, '.venv')
61
+
62
+ # Determine pip and python executable paths based on operating system
63
+ is_windows = platform.system() == "Windows"
64
+ if is_windows:
65
+ pip_path = os.path.join(venv_path, 'Scripts', 'pip.exe')
66
+ python_path = os.path.join(venv_path, 'Scripts', 'python.exe')
67
+ else:
68
+ pip_path = os.path.join(venv_path, 'bin', 'pip')
69
+ python_path = os.path.join(venv_path, 'bin', 'python')
70
+
71
+ # Check if virtual environment already exists and is valid
72
+ venv_exists = os.path.exists(venv_path)
73
+ pip_exists = os.path.exists(pip_path)
74
+
75
+ if not venv_exists or not pip_exists:
76
+ print("Creating new virtual environment...")
77
+ # Remove existing venv if it's invalid
78
+ if venv_exists and not pip_exists:
79
+ print("Existing virtual environment is incomplete, recreating it...")
80
+ try:
81
+ shutil.rmtree(venv_path)
82
+ except Exception as e:
83
+ print(f"Warning: Could not remove existing virtual environment: {e}")
84
+ print("Please delete the .venv directory manually and try again.")
85
+ sys.exit(1)
86
+
87
+ # Create virtual environment
88
+ try:
89
+ subprocess.run([sys.executable, '-m', 'venv', venv_path], check=True)
90
+ print("Virtual environment created successfully!")
91
+ except subprocess.CalledProcessError as e:
92
+ print(f"Error creating virtual environment: {e}")
93
+ sys.exit(1)
94
+ else:
95
+ print("Valid virtual environment already exists.")
96
+
97
+ # Double-check that pip exists after creating venv
98
+ if not os.path.exists(pip_path):
99
+ print(f"Error: pip executable not found at {pip_path}")
100
+ print("Try creating the virtual environment manually with: python -m venv .venv")
101
+ sys.exit(1)
102
+
103
+ # Install or update dependencies
104
+ print("\nInstalling requirements...")
105
+ try:
106
+ # Install mcp package
107
+ subprocess.run([pip_path, 'install', 'mcp[cli]'], check=True)
108
+ # Install python-pptx package
109
+ subprocess.run([pip_path, 'install', 'python-pptx'], check=True)
110
+
111
+ # Also install dependencies from requirements.txt if it exists
112
+ requirements_path = os.path.join(base_path, 'requirements.txt')
113
+ if os.path.exists(requirements_path):
114
+ subprocess.run([pip_path, 'install', '-r', requirements_path], check=True)
115
+
116
+
117
+ print("Requirements installed successfully!")
118
+ except subprocess.CalledProcessError as e:
119
+ print(f"Error installing requirements: {e}")
120
+ sys.exit(1)
121
+ except FileNotFoundError:
122
+ print(f"Error: Could not execute {pip_path}")
123
+ print("Try activating the virtual environment manually and installing requirements:")
124
+ if is_windows:
125
+ print(f".venv\\Scripts\\activate")
126
+ else:
127
+ print("source .venv/bin/activate")
128
+ print("pip install mcp[cli] python-pptx")
129
+ sys.exit(1)
130
+
131
+ return python_path
132
+
133
+ def generate_mcp_config_local(python_path):
134
+ """
135
+ Generate MCP configuration for locally installed office-powerpoint-mcp-server
136
+
137
+ Parameters:
138
+ - python_path: Path to Python interpreter in the virtual environment
139
+
140
+ Returns: Path to the generated config file
141
+ """
142
+ # Get absolute path of the directory containing the current script
143
+ base_path = os.path.abspath(os.path.dirname(__file__))
144
+
145
+ # Path to PowerPoint Server script
146
+ server_script_path = os.path.join(base_path, 'ppt_mcp_server.py')
147
+
148
+ # Path to templates directory
149
+ templates_path = os.path.join(base_path, 'templates')
150
+
151
+ # Create MCP configuration dictionary
152
+ config = {
153
+ "mcpServers": {
154
+ "ppt": {
155
+ "command": python_path,
156
+ "args": [server_script_path],
157
+ "env": {
158
+ "PYTHONPATH": base_path,
159
+ "PPT_TEMPLATE_PATH": templates_path
160
+ }
161
+ }
162
+ }
163
+ }
164
+
165
+ # Save configuration to JSON file
166
+ config_path = os.path.join(base_path, 'mcp-config.json')
167
+ with open(config_path, 'w') as f:
168
+ json.dump(config, f, indent=2) # indent=2 gives the JSON file good formatting
169
+
170
+ return config_path
171
+
172
+ def generate_mcp_config_uvx():
173
+ """
174
+ Generate MCP configuration for PyPI-installed office-powerpoint-mcp-server using UVX
175
+
176
+ Returns: Path to the generated config file
177
+ """
178
+ # Get absolute path of the directory containing the current script
179
+ base_path = os.path.abspath(os.path.dirname(__file__))
180
+
181
+ # Path to templates directory (optional for UVX installs)
182
+ templates_path = os.path.join(base_path, 'templates')
183
+
184
+ # Create MCP configuration dictionary
185
+ env_config = {}
186
+ if os.path.exists(templates_path):
187
+ env_config["PPT_TEMPLATE_PATH"] = templates_path
188
+
189
+ config = {
190
+ "mcpServers": {
191
+ "ppt": {
192
+ "command": "uvx",
193
+ "args": ["--from", "office-powerpoint-mcp-server", "ppt_mcp_server"],
194
+ "env": env_config
195
+ }
196
+ }
197
+ }
198
+
199
+ # Save configuration to JSON file
200
+ config_path = os.path.join(base_path, 'mcp-config.json')
201
+ with open(config_path, 'w') as f:
202
+ json.dump(config, f, indent=2) # indent=2 gives the JSON file good formatting
203
+
204
+ return config_path
205
+
206
+ def generate_mcp_config_module():
207
+ """
208
+ Generate MCP configuration for PyPI-installed office-powerpoint-mcp-server using Python module
209
+
210
+ Returns: Path to the generated config file
211
+ """
212
+ # Get absolute path of the directory containing the current script
213
+ base_path = os.path.abspath(os.path.dirname(__file__))
214
+
215
+ # Path to templates directory (optional for module installs)
216
+ templates_path = os.path.join(base_path, 'templates')
217
+
218
+ # Create MCP configuration dictionary
219
+ env_config = {}
220
+ if os.path.exists(templates_path):
221
+ env_config["PPT_TEMPLATE_PATH"] = templates_path
222
+
223
+ config = {
224
+ "mcpServers": {
225
+ "ppt": {
226
+ "command": sys.executable,
227
+ "args": ["-m", "office_powerpoint_mcp_server"],
228
+ "env": env_config
229
+ }
230
+ }
231
+ }
232
+
233
+ # Save configuration to JSON file
234
+ config_path = os.path.join(base_path, 'mcp-config.json')
235
+ with open(config_path, 'w') as f:
236
+ json.dump(config, f, indent=2) # indent=2 gives the JSON file good formatting
237
+
238
+ return config_path
239
+
240
+ def install_from_pypi():
241
+ """
242
+ Install office-powerpoint-mcp-server from PyPI
243
+
244
+ Returns: True if successful, False otherwise
245
+ """
246
+ print("\nInstalling office-powerpoint-mcp-server from PyPI...")
247
+ try:
248
+ subprocess.run([sys.executable, "-m", "pip", "install", "office-powerpoint-mcp-server"], check=True)
249
+ print("office-powerpoint-mcp-server successfully installed from PyPI!")
250
+ return True
251
+ except subprocess.CalledProcessError:
252
+ print("Failed to install office-powerpoint-mcp-server from PyPI.")
253
+ return False
254
+
255
+ def print_config_instructions(config_path):
256
+ """
257
+ Print instructions for using the generated config
258
+
259
+ Parameters:
260
+ - config_path: Path to the generated config file
261
+ """
262
+ print(f"\nMCP configuration has been written to: {config_path}")
263
+
264
+ with open(config_path, 'r') as f:
265
+ config = json.load(f)
266
+
267
+ print("\nMCP configuration for Claude Desktop:")
268
+ print(json.dumps(config, indent=2))
269
+
270
+ # Provide instructions for adding configuration to Claude Desktop configuration file
271
+ if platform.system() == "Windows":
272
+ claude_config_path = os.path.expandvars("%APPDATA%\\Claude\\claude_desktop_config.json")
273
+ else: # macOS
274
+ claude_config_path = os.path.expanduser("~/Library/Application Support/Claude/claude_desktop_config.json")
275
+
276
+ print(f"\nTo use with Claude Desktop, merge this configuration into: {claude_config_path}")
277
+
278
+ def create_package_structure():
279
+ """
280
+ Create necessary package structure and directories
281
+ """
282
+ # Get absolute path of the directory containing the current script
283
+ base_path = os.path.abspath(os.path.dirname(__file__))
284
+
285
+ # Create __init__.py file
286
+ init_path = os.path.join(base_path, '__init__.py')
287
+ if not os.path.exists(init_path):
288
+ with open(init_path, 'w') as f:
289
+ f.write('# PowerPoint MCP Server')
290
+ print(f"Created __init__.py at: {init_path}")
291
+
292
+ # Create requirements.txt file
293
+ requirements_path = os.path.join(base_path, 'requirements.txt')
294
+ if not os.path.exists(requirements_path):
295
+ with open(requirements_path, 'w') as f:
296
+ f.write('mcp[cli]\npython-pptx\n')
297
+ print(f"Created requirements.txt at: {requirements_path}")
298
+
299
+ # Create templates directory for PowerPoint templates
300
+ templates_dir = os.path.join(base_path, 'templates')
301
+ if not os.path.exists(templates_dir):
302
+ os.makedirs(templates_dir)
303
+ print(f"Created templates directory at: {templates_dir}")
304
+
305
+ # Create a README file in templates directory
306
+ readme_path = os.path.join(templates_dir, 'README.md')
307
+ with open(readme_path, 'w') as f:
308
+ f.write("""# PowerPoint Templates
309
+
310
+ This directory is for storing PowerPoint template files (.pptx or .potx) that can be used with the MCP server.
311
+
312
+ ## Usage
313
+
314
+ 1. Place your template files in this directory
315
+ 2. Use the `create_presentation_from_template` tool with the template filename
316
+ 3. The server will automatically search for templates in this directory
317
+
318
+ ## Supported Formats
319
+
320
+ - `.pptx` - PowerPoint presentation files
321
+ - `.potx` - PowerPoint template files
322
+
323
+ ## Example
324
+
325
+ ```python
326
+ # Create presentation from template
327
+ result = create_presentation_from_template("company_template.pptx")
328
+ ```
329
+
330
+ The server will search for templates in:
331
+ - Current directory
332
+ - ./templates/ (this directory)
333
+ - ./assets/
334
+ - ./resources/
335
+ """)
336
+ print(f"Created templates README at: {readme_path}")
337
+
338
+ # Offer to create a sample template
339
+ create_sample = input("\nWould you like to create a sample template for testing? (y/n): ").lower().strip()
340
+ if create_sample in ['y', 'yes']:
341
+ create_sample_template(templates_dir)
342
+
343
+ def create_sample_template(templates_dir):
344
+ """
345
+ Create a sample PowerPoint template for testing
346
+
347
+ Parameters:
348
+ - templates_dir: Directory where templates are stored
349
+ """
350
+ try:
351
+ # Import required modules for creating a sample template
352
+ from pptx import Presentation
353
+ from pptx.util import Inches, Pt
354
+ from pptx.dml.color import RGBColor
355
+ from pptx.enum.text import PP_ALIGN
356
+
357
+ print("Creating sample template...")
358
+
359
+ # Create a new presentation
360
+ prs = Presentation()
361
+
362
+ # Get the title slide layout
363
+ title_slide_layout = prs.slide_layouts[0]
364
+ slide = prs.slides.add_slide(title_slide_layout)
365
+
366
+ # Set title and subtitle
367
+ title = slide.shapes.title
368
+ subtitle = slide.placeholders[1]
369
+
370
+ title.text = "Sample Company Template"
371
+ subtitle.text = "Professional Presentation Template\nCreated by PowerPoint MCP Server"
372
+
373
+ # Format title
374
+ title_paragraph = title.text_frame.paragraphs[0]
375
+ title_paragraph.font.size = Pt(44)
376
+ title_paragraph.font.bold = True
377
+ title_paragraph.font.color.rgb = RGBColor(31, 73, 125) # Dark blue
378
+
379
+ # Format subtitle
380
+ for paragraph in subtitle.text_frame.paragraphs:
381
+ paragraph.font.size = Pt(18)
382
+ paragraph.font.color.rgb = RGBColor(68, 84, 106) # Gray blue
383
+ paragraph.alignment = PP_ALIGN.CENTER
384
+
385
+ # Add a content slide
386
+ content_slide_layout = prs.slide_layouts[1]
387
+ content_slide = prs.slides.add_slide(content_slide_layout)
388
+
389
+ content_title = content_slide.shapes.title
390
+ content_title.text = "Sample Content Slide"
391
+
392
+ # Add bullet points to content
393
+ content_placeholder = content_slide.placeholders[1]
394
+ text_frame = content_placeholder.text_frame
395
+ text_frame.text = "Key Features"
396
+
397
+ # Add bullet points
398
+ bullet_points = [
399
+ "Professional theme and colors",
400
+ "Custom layouts and placeholders",
401
+ "Ready for content creation",
402
+ "Compatible with MCP server tools"
403
+ ]
404
+
405
+ for point in bullet_points:
406
+ p = text_frame.add_paragraph()
407
+ p.text = point
408
+ p.level = 1
409
+
410
+ # Add a section header slide
411
+ section_slide_layout = prs.slide_layouts[2] if len(prs.slide_layouts) > 2 else prs.slide_layouts[0]
412
+ section_slide = prs.slides.add_slide(section_slide_layout)
413
+
414
+ if section_slide.shapes.title:
415
+ section_slide.shapes.title.text = "Template Features"
416
+
417
+ # Save the sample template
418
+ template_path = os.path.join(templates_dir, 'sample_template.pptx')
419
+ prs.save(template_path)
420
+
421
+ print(f"✅ Sample template created: {template_path}")
422
+ print(" You can now test the template feature with:")
423
+ print(" • get_template_info('sample_template.pptx')")
424
+ print(" • create_presentation_from_template('sample_template.pptx')")
425
+
426
+ except ImportError:
427
+ print("⚠️ Cannot create sample template: python-pptx not installed yet")
428
+ print(" Run the setup first, then manually create templates in the templates/ directory")
429
+ except Exception as e:
430
+ print(f"❌ Failed to create sample template: {str(e)}")
431
+ print(" You can manually add template files to the templates/ directory")
432
+
433
+ # Main execution entry point
434
+ if __name__ == '__main__':
435
+ # Check prerequisites
436
+ python_ok, uv_installed, uvx_installed, ppt_server_installed = check_prerequisites()
437
+
438
+ if not python_ok:
439
+ print("Error: Python 3.6 or higher is required.")
440
+ sys.exit(1)
441
+
442
+ print("PowerPoint MCP Server Setup")
443
+ print("===========================\n")
444
+
445
+ # Create necessary files
446
+ create_package_structure()
447
+
448
+ # If office-powerpoint-mcp-server is already installed, offer config options
449
+ if ppt_server_installed:
450
+ print("office-powerpoint-mcp-server is already installed via pip.")
451
+
452
+ if uvx_installed:
453
+ print("\nOptions:")
454
+ print("1. Generate MCP config for UVX (recommended)")
455
+ print("2. Generate MCP config for Python module")
456
+ print("3. Set up local development environment")
457
+
458
+ choice = input("\nEnter your choice (1-3): ")
459
+
460
+ if choice == "1":
461
+ config_path = generate_mcp_config_uvx()
462
+ print_config_instructions(config_path)
463
+ elif choice == "2":
464
+ config_path = generate_mcp_config_module()
465
+ print_config_instructions(config_path)
466
+ elif choice == "3":
467
+ python_path = setup_venv()
468
+ config_path = generate_mcp_config_local(python_path)
469
+ print_config_instructions(config_path)
470
+ else:
471
+ print("Invalid choice. Exiting.")
472
+ sys.exit(1)
473
+ else:
474
+ print("\nOptions:")
475
+ print("1. Generate MCP config for Python module")
476
+ print("2. Set up local development environment")
477
+
478
+ choice = input("\nEnter your choice (1-2): ")
479
+
480
+ if choice == "1":
481
+ config_path = generate_mcp_config_module()
482
+ print_config_instructions(config_path)
483
+ elif choice == "2":
484
+ python_path = setup_venv()
485
+ config_path = generate_mcp_config_local(python_path)
486
+ print_config_instructions(config_path)
487
+ else:
488
+ print("Invalid choice. Exiting.")
489
+ sys.exit(1)
490
+
491
+ # If office-powerpoint-mcp-server is not installed, offer installation options
492
+ else:
493
+ print("office-powerpoint-mcp-server is not installed.")
494
+
495
+ print("\nOptions:")
496
+ print("1. Install from PyPI (recommended)")
497
+ print("2. Set up local development environment")
498
+
499
+ choice = input("\nEnter your choice (1-2): ")
500
+
501
+ if choice == "1":
502
+ if install_from_pypi():
503
+ if uvx_installed:
504
+ print("\nNow generating MCP config for UVX...")
505
+ config_path = generate_mcp_config_uvx()
506
+ else:
507
+ print("\nUVX not found. Generating MCP config for Python module...")
508
+ config_path = generate_mcp_config_module()
509
+ print_config_instructions(config_path)
510
+ elif choice == "2":
511
+ python_path = setup_venv()
512
+ config_path = generate_mcp_config_local(python_path)
513
+ print_config_instructions(config_path)
514
+ else:
515
+ print("Invalid choice. Exiting.")
516
+ sys.exit(1)
517
+
518
+ print("\nSetup complete! You can now use the PowerPoint MCP server with compatible clients like Claude Desktop.")
519
+
520
+ print("\n" + "="*60)
521
+ print("POWERPOINT MCP SERVER - NEW FEATURES")
522
+ print("="*60)
523
+ print("\n📁 Template Support:")
524
+ print(" • Place PowerPoint templates (.pptx/.potx) in the ./templates/ directory")
525
+ print(" • Use 'create_presentation_from_template' tool to create presentations from templates")
526
+ print(" • Use 'get_template_info' tool to inspect template layouts and properties")
527
+ print(" • Templates preserve branding, themes, and custom layouts")
528
+ print(" • Template path configured via PPT_TEMPLATE_PATH environment variable")
529
+
530
+ print("\n🔧 Available MCP Tools:")
531
+ print(" Presentations:")
532
+ print(" • create_presentation - Create new blank presentation")
533
+ print(" • create_presentation_from_template - Create from template file")
534
+ print(" • get_template_info - Inspect template file details")
535
+ print(" • open_presentation - Open existing presentation")
536
+ print(" • save_presentation - Save presentation to file")
537
+
538
+ print("\n Content:")
539
+ print(" • add_slide - Add slides with various layouts")
540
+ print(" • add_textbox - Add formatted text boxes")
541
+ print(" • add_image - Add images from files or base64")
542
+ print(" • add_table - Add formatted tables")
543
+ print(" • add_shape - Add various auto shapes")
544
+ print(" • add_chart - Add column, bar, line, and pie charts")
545
+
546
+ print("\n📚 Documentation:")
547
+ print(" • Full API documentation available in README.md")
548
+ print(" • Template usage examples included")
549
+ print(" • Check ./templates/README.md for template guidelines")
550
+
551
+ print("\n🚀 Quick Start with Templates:")
552
+ print(" 1. Copy your .pptx template to ./templates/")
553
+ print(" 2. Use: create_presentation_from_template('your_template.pptx')")
554
+ print(" 3. Add slides using template layouts")
555
+ print(" 4. Save your presentation")
556
+ print("\n💡 Custom Template Paths:")
557
+ print(" • Set PPT_TEMPLATE_PATH environment variable for custom locations")
558
+ print(" • Supports multiple paths (colon-separated on Unix, semicolon on Windows)")
559
+ print(" • Example: PPT_TEMPLATE_PATH='/path/to/templates:/path/to/more/templates'")
560
+
561
+ print("\n" + "="*60)
slide_layout_templates.json ADDED
The diff for this file is too large to render. See raw diff
 
smithery.yaml ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Smithery configuration file: https://smithery.ai/docs/config#smitheryyaml
2
+
3
+ startCommand:
4
+ type: stdio
5
+ configSchema:
6
+ # JSON Schema defining the configuration options for the MCP.
7
+ {}
8
+ commandFunction:
9
+ # A JS function that produces the CLI command based on the given config to start the MCP on stdio.
10
+ |-
11
+ (config) => ({
12
+ command: 'python',
13
+ args: ['ppt_mcp_server.py'],
14
+ env: {}
15
+ })
16
+ exampleConfig: {}