Name | dcc-mcp-core JSON |
Version |
0.1.0
JSON |
| download |
home_page | None |
Summary | Foundational library for the DCC Model Context Protocol (MCP) ecosystem |
upload_time | 2025-03-19 05:24:58 |
maintainer | None |
docs_url | None |
author | longhao |
requires_python | <4.0,>=3.7 |
license | MIT |
keywords |
|
VCS |
 |
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
|
# dcc-mcp-core
Foundational library for the DCC Model Context Protocol (MCP) ecosystem. It provides common utilities, base classes, and shared functionality that are used across all other DCC-MCP packages.
## Design Philosophy and Workflow
DCC-MCP-Core is a plugin management system designed for Digital Content Creation (DCC) applications, aiming to provide a unified interface that allows AI to interact with various DCC software (such as Maya, Blender, Houdini, etc.).
### Core Workflow
1. **MCP Server**: Acts as a central coordinator, receiving requests from AI
2. **DCC-MCP**: Connects the MCP server and specific DCC software
3. **Plugin Discovery and Loading**: DCC-MCP-Core is responsible for discovering, loading, and managing plugins
4. **Structured Information Return**: Returns plugin information in an AI-friendly structured format to the MCP server
5. **Function Calls and Result Return**: MCP server calls the corresponding plugin functions and returns the results to AI
```mermaid
graph LR
%% 增加图表宽度
classDef default width:120px,height:60px
AI[AI Assistant] -->|"1. Send Request"| MCP[MCP Server]
MCP -->|"2. Forward Request"| DCCMCP[DCC-MCP]
DCCMCP -->|"3. Discover & Load"| Plugins[DCC Plugins]
Plugins -->|"4. Return Info"| DCCMCP
DCCMCP -->|"5. Structured Data"| MCP
MCP -->|"6. Call Function"| DCCMCP
DCCMCP -->|"7. Execute"| DCC[DCC Software]
DCC -->|"8. Operation Result"| DCCMCP
DCCMCP -->|"9. Structured Result"| MCP
MCP -->|"10. Return Result"| AI
%% 使用更鲜明的颜色和更大的节点
classDef ai fill:#f9d,stroke:#333,stroke-width:4px,color:#000,font-weight:bold
classDef mcp fill:#bbf,stroke:#333,stroke-width:4px,color:#000,font-weight:bold
classDef dcc fill:#bfb,stroke:#333,stroke-width:4px,color:#000,font-weight:bold
classDef plugin fill:#fbb,stroke:#333,stroke-width:4px,color:#000,font-weight:bold
class AI ai
class MCP,DCCMCP mcp
class DCC dcc
class Plugins plugin
```
### Plugin Design
Plugins use a simple and intuitive design, allowing developers to easily create new DCC functionality:
- **Metadata Declaration**: Define basic plugin information through simple variables
- **Function Definition**: Implement specific DCC operation functionality
- **Context Passing**: Access DCC software's remote interface through the context parameter
- **Structured Return**: All functions return standardized structured data
### Remote Call Architecture
DCC-MCP-Core uses RPyC to implement remote procedure calls, allowing DCC operations to be executed in different processes or even on different machines:
- **Context Object**: Contains remote DCC client and command interface
- **Transparent Access**: Plugin code can access remote DCC APIs as if they were local
- **Error Handling**: Unified error handling mechanism ensures stable operation
## Features
- Parameter processing and validation
- Standardized logging system
- Common exception hierarchy
- Utility functions for DCC integration
- Version compatibility checking
- Plugin management system for DCC-specific functionality
- AI-friendly structured data interfaces
- Remote procedure call support via RPyC
## Requirements
- Python 3.7+
- Compatible with Windows, macOS, and Linux
- Designed to work within DCC software Python environments
## Installation
```bash
pip install dcc-mcp-core
```
## Usage
### Basic Usage
```python
from dcc_mcp_core import logging, parameters, exceptions
# Configure logging
logger = logging.get_logger("my_module")
logger.info("Starting operation")
# Process parameters
params = parameters.validate({"value": 10}, {"value": {"type": int, "required": True}})
# Handle exceptions
try:
# Your code here
pass
except exceptions.MCPError as e:
logger.error(f"Error occurred: {e}")
```
### Plugin Management
The plugin management system allows you to discover, load, and interact with DCC-specific plugins:
```python
from dcc_mcp_core.plugin_manager import PluginManager
# Create a plugin manager for a specific DCC
manager = PluginManager('maya')
# Discover available plugins
plugin_paths = manager.discover_plugins()
print(f"Found {len(plugin_paths)} plugins for Maya")
# Load all discovered plugins
plugins_info = manager.load_plugins(plugin_paths)
print(f"Loaded plugins: {list(plugins_info.keys())}")
# Get structured information about plugins (AI-friendly format)
plugins_info = manager.get_plugins_info()
# Call a function from a specific plugin
result = manager.call_plugin_function('maya_scene_tools', 'create_primitive',
context=context, primitive_type="cube", size=2.0)
```
### Creating Custom Plugins
Create a Python file with the following structure to make it discoverable by the plugin system:
```python
# my_maya_plugin.py
# Plugin metadata
__plugin_name__ = "My Maya Plugin"
__plugin_version__ = "1.0.0"
__plugin_description__ = "A custom plugin for Maya"
__plugin_author__ = "Your Name"
__plugin_requires__ = ["maya"]
# Using decorators to simplify plugin function development
from functools import wraps
def maya_tool(func):
"""Mark a function as a Maya tool, automatically handling the context parameter."""
@wraps(func)
def wrapper(context, *args, **kwargs):
# Extract Maya client from context
maya_client = context.get("maya_client")
if not maya_client:
return {"error": "Maya client not found"}
# Call the original function
try:
return func(context, *args, **kwargs)
except Exception as e:
return {"status": "error", "message": str(e)}
return wrapper
# Plugin functions
@maya_tool
def create_cube(context, size=1.0, position=None):
"""Create a cube in Maya."""
cmds = context.get("maya_client").cmds
if position is None:
position = [0, 0, 0]
# Create the cube
cube = cmds.polyCube(w=size, h=size, d=size)[0]
cmds.move(position[0], position[1], position[2], cube)
return {
"status": "success",
"result": {
"name": cube,
"type": "cube",
"size": size,
"position": position
}
}
```
## License
MIT
Raw data
{
"_id": null,
"home_page": null,
"name": "dcc-mcp-core",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.7",
"maintainer_email": null,
"keywords": null,
"author": "longhao",
"author_email": "hal.long@outlook.com",
"download_url": "https://files.pythonhosted.org/packages/cc/05/2b88789bc535d64d43d09149dc8ff39752cce111137605ac1d15030a66a2/dcc_mcp_core-0.1.0.tar.gz",
"platform": null,
"description": "# dcc-mcp-core\n\nFoundational library for the DCC Model Context Protocol (MCP) ecosystem. It provides common utilities, base classes, and shared functionality that are used across all other DCC-MCP packages.\n\n## Design Philosophy and Workflow\n\nDCC-MCP-Core is a plugin management system designed for Digital Content Creation (DCC) applications, aiming to provide a unified interface that allows AI to interact with various DCC software (such as Maya, Blender, Houdini, etc.).\n\n### Core Workflow\n\n1. **MCP Server**: Acts as a central coordinator, receiving requests from AI\n2. **DCC-MCP**: Connects the MCP server and specific DCC software\n3. **Plugin Discovery and Loading**: DCC-MCP-Core is responsible for discovering, loading, and managing plugins\n4. **Structured Information Return**: Returns plugin information in an AI-friendly structured format to the MCP server\n5. **Function Calls and Result Return**: MCP server calls the corresponding plugin functions and returns the results to AI\n\n```mermaid\ngraph LR\n %% \u589e\u52a0\u56fe\u8868\u5bbd\u5ea6\n classDef default width:120px,height:60px\n \n AI[AI Assistant] -->|\"1. Send Request\"| MCP[MCP Server]\n MCP -->|\"2. Forward Request\"| DCCMCP[DCC-MCP]\n DCCMCP -->|\"3. Discover & Load\"| Plugins[DCC Plugins]\n Plugins -->|\"4. Return Info\"| DCCMCP\n DCCMCP -->|\"5. Structured Data\"| MCP\n MCP -->|\"6. Call Function\"| DCCMCP\n DCCMCP -->|\"7. Execute\"| DCC[DCC Software]\n DCC -->|\"8. Operation Result\"| DCCMCP\n DCCMCP -->|\"9. Structured Result\"| MCP\n MCP -->|\"10. Return Result\"| AI\n\n %% \u4f7f\u7528\u66f4\u9c9c\u660e\u7684\u989c\u8272\u548c\u66f4\u5927\u7684\u8282\u70b9\n classDef ai fill:#f9d,stroke:#333,stroke-width:4px,color:#000,font-weight:bold\n classDef mcp fill:#bbf,stroke:#333,stroke-width:4px,color:#000,font-weight:bold\n classDef dcc fill:#bfb,stroke:#333,stroke-width:4px,color:#000,font-weight:bold\n classDef plugin fill:#fbb,stroke:#333,stroke-width:4px,color:#000,font-weight:bold\n\n class AI ai\n class MCP,DCCMCP mcp\n class DCC dcc\n class Plugins plugin\n```\n\n### Plugin Design\n\nPlugins use a simple and intuitive design, allowing developers to easily create new DCC functionality:\n\n- **Metadata Declaration**: Define basic plugin information through simple variables\n- **Function Definition**: Implement specific DCC operation functionality\n- **Context Passing**: Access DCC software's remote interface through the context parameter\n- **Structured Return**: All functions return standardized structured data\n\n### Remote Call Architecture\n\nDCC-MCP-Core uses RPyC to implement remote procedure calls, allowing DCC operations to be executed in different processes or even on different machines:\n\n- **Context Object**: Contains remote DCC client and command interface\n- **Transparent Access**: Plugin code can access remote DCC APIs as if they were local\n- **Error Handling**: Unified error handling mechanism ensures stable operation\n\n## Features\n\n- Parameter processing and validation\n- Standardized logging system\n- Common exception hierarchy\n- Utility functions for DCC integration\n- Version compatibility checking\n- Plugin management system for DCC-specific functionality\n- AI-friendly structured data interfaces\n- Remote procedure call support via RPyC\n\n## Requirements\n\n- Python 3.7+\n- Compatible with Windows, macOS, and Linux\n- Designed to work within DCC software Python environments\n\n## Installation\n\n```bash\npip install dcc-mcp-core\n```\n\n## Usage\n\n### Basic Usage\n\n```python\nfrom dcc_mcp_core import logging, parameters, exceptions\n\n# Configure logging\nlogger = logging.get_logger(\"my_module\")\nlogger.info(\"Starting operation\")\n\n# Process parameters\nparams = parameters.validate({\"value\": 10}, {\"value\": {\"type\": int, \"required\": True}})\n\n# Handle exceptions\ntry:\n # Your code here\n pass\nexcept exceptions.MCPError as e:\n logger.error(f\"Error occurred: {e}\")\n```\n\n### Plugin Management\n\nThe plugin management system allows you to discover, load, and interact with DCC-specific plugins:\n\n```python\nfrom dcc_mcp_core.plugin_manager import PluginManager\n\n# Create a plugin manager for a specific DCC\nmanager = PluginManager('maya')\n\n# Discover available plugins\nplugin_paths = manager.discover_plugins()\nprint(f\"Found {len(plugin_paths)} plugins for Maya\")\n\n# Load all discovered plugins\nplugins_info = manager.load_plugins(plugin_paths)\nprint(f\"Loaded plugins: {list(plugins_info.keys())}\")\n\n# Get structured information about plugins (AI-friendly format)\nplugins_info = manager.get_plugins_info()\n\n# Call a function from a specific plugin\nresult = manager.call_plugin_function('maya_scene_tools', 'create_primitive',\n context=context, primitive_type=\"cube\", size=2.0)\n```\n\n### Creating Custom Plugins\n\nCreate a Python file with the following structure to make it discoverable by the plugin system:\n\n```python\n# my_maya_plugin.py\n\n# Plugin metadata\n__plugin_name__ = \"My Maya Plugin\"\n__plugin_version__ = \"1.0.0\"\n__plugin_description__ = \"A custom plugin for Maya\"\n__plugin_author__ = \"Your Name\"\n__plugin_requires__ = [\"maya\"]\n\n# Using decorators to simplify plugin function development\nfrom functools import wraps\n\ndef maya_tool(func):\n \"\"\"Mark a function as a Maya tool, automatically handling the context parameter.\"\"\"\n @wraps(func)\n def wrapper(context, *args, **kwargs):\n # Extract Maya client from context\n maya_client = context.get(\"maya_client\")\n if not maya_client:\n return {\"error\": \"Maya client not found\"}\n\n # Call the original function\n try:\n return func(context, *args, **kwargs)\n except Exception as e:\n return {\"status\": \"error\", \"message\": str(e)}\n return wrapper\n\n# Plugin functions\n@maya_tool\ndef create_cube(context, size=1.0, position=None):\n \"\"\"Create a cube in Maya.\"\"\"\n cmds = context.get(\"maya_client\").cmds\n\n if position is None:\n position = [0, 0, 0]\n\n # Create the cube\n cube = cmds.polyCube(w=size, h=size, d=size)[0]\n cmds.move(position[0], position[1], position[2], cube)\n\n return {\n \"status\": \"success\",\n \"result\": {\n \"name\": cube,\n \"type\": \"cube\",\n \"size\": size,\n \"position\": position\n }\n }\n```\n\n## License\n\nMIT\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Foundational library for the DCC Model Context Protocol (MCP) ecosystem",
"version": "0.1.0",
"project_urls": {
"Homepage": "https://github.com/loonghao/dcc-mcp-core",
"Issues": "https://github.com/loonghao/dcc-mcp-core/issues"
},
"split_keywords": [],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "51a01eb3235e78104ff0151fc2b93e3739a9daa8362df6e2c7600b6094246313",
"md5": "4253db23297a7c8d24a0340179d7f96a",
"sha256": "dd4de25ace18789ffdbec29f6e874f01efef82fcdd9b85f15de8baa899d01405"
},
"downloads": -1,
"filename": "dcc_mcp_core-0.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "4253db23297a7c8d24a0340179d7f96a",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.7",
"size": 19255,
"upload_time": "2025-03-19T05:24:56",
"upload_time_iso_8601": "2025-03-19T05:24:56.536032Z",
"url": "https://files.pythonhosted.org/packages/51/a0/1eb3235e78104ff0151fc2b93e3739a9daa8362df6e2c7600b6094246313/dcc_mcp_core-0.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "cc052b88789bc535d64d43d09149dc8ff39752cce111137605ac1d15030a66a2",
"md5": "fad4a6f3e51cb38660efade67154b42e",
"sha256": "40eb0e911ed2d13c638a1c0cd24d808861c182a6930732e29a89967e01f7fe12"
},
"downloads": -1,
"filename": "dcc_mcp_core-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "fad4a6f3e51cb38660efade67154b42e",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.7",
"size": 19597,
"upload_time": "2025-03-19T05:24:58",
"upload_time_iso_8601": "2025-03-19T05:24:58.498959Z",
"url": "https://files.pythonhosted.org/packages/cc/05/2b88789bc535d64d43d09149dc8ff39752cce111137605ac1d15030a66a2/dcc_mcp_core-0.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-03-19 05:24:58",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "loonghao",
"github_project": "dcc-mcp-core",
"travis_ci": false,
"coveralls": true,
"github_actions": true,
"lcname": "dcc-mcp-core"
}