# MCP Mesh Python Runtime
Python runtime for the MCP Mesh service mesh framework.
## Installation
```bash
pip install mcp-mesh
```
## Quick Start
```python
import mesh
# Import types from public API
from mesh.types import McpMeshAgent
# Define your agent
@mesh.agent(name="hello-world", http_port=9090)
class HelloWorldAgent:
"""Hello World agent demonstrating MCP Mesh features."""
pass
# Create a greeting function with dependency injection
@mesh.tool(
capability="greeting",
dependencies=["date_service"],
description="Greeting function with date dependency injection"
)
def greet(name: str = "World", systemDate: McpMeshAgent = None) -> str:
"""Greeting function with automatic dependency injection."""
if systemDate is not None:
try:
current_date = systemDate()
return f"Hello, {name}! Today is {current_date}"
except Exception:
pass
return f"Hello, {name}!"
# The runtime auto-initializes when you import mcp_mesh
# Your functions are automatically registered with the mesh registry
```
## Features
- **Automatic Registration**: Functions are automatically registered with the Go registry
- **Health Monitoring**: Built-in health checks and heartbeats
- **Dependency Injection**: Inject dependencies into your functions
- **Service Discovery**: Find and use other services in the mesh
- **Graceful Degradation**: Works even if registry is unavailable
## Configuration
The runtime can be configured via environment variables:
- `MCP_MESH_ENABLED`: Enable/disable runtime (default: "true")
- `MCP_MESH_REGISTRY_URL`: Registry URL (default: "http://localhost:8080")
- `MCP_MESH_AGENT_NAME`: Custom agent name (auto-generated if not set)
## API Architecture
MCP Mesh uses a clear separation between public and private APIs:
- **`mesh`** - Public user API for decorators and types
- **`_mcp_mesh`** - Private internal implementation (do not import directly)
The underscore prefix on `_mcp_mesh` follows Python conventions to indicate internal/private packages. Users should only import from the `mesh` package to ensure compatibility across versions.
## Documentation
See the [main repository](https://github.com/dhyansraj/mcp-mesh) for complete documentation.
Raw data
{
"_id": null,
"home_page": null,
"name": "mcp-mesh",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.11",
"maintainer_email": null,
"keywords": "agents, ai, distributed, kubernetes, mcp, microservices, orchestration",
"author": null,
"author_email": "MCP Mesh Contributors <noreply@mcp-mesh.dev>",
"download_url": "https://files.pythonhosted.org/packages/1f/59/e44469765b1e4a9a125b45f1fc9dce94f2f19307c9321eda1f4549554af3/mcp_mesh-0.4.0.tar.gz",
"platform": null,
"description": "# MCP Mesh Python Runtime\n\nPython runtime for the MCP Mesh service mesh framework.\n\n## Installation\n\n```bash\npip install mcp-mesh\n```\n\n## Quick Start\n\n```python\nimport mesh\n\n# Import types from public API\nfrom mesh.types import McpMeshAgent\n\n# Define your agent\n@mesh.agent(name=\"hello-world\", http_port=9090)\nclass HelloWorldAgent:\n \"\"\"Hello World agent demonstrating MCP Mesh features.\"\"\"\n pass\n\n# Create a greeting function with dependency injection\n@mesh.tool(\n capability=\"greeting\",\n dependencies=[\"date_service\"],\n description=\"Greeting function with date dependency injection\"\n)\ndef greet(name: str = \"World\", systemDate: McpMeshAgent = None) -> str:\n \"\"\"Greeting function with automatic dependency injection.\"\"\"\n if systemDate is not None:\n try:\n current_date = systemDate()\n return f\"Hello, {name}! Today is {current_date}\"\n except Exception:\n pass\n\n return f\"Hello, {name}!\"\n\n# The runtime auto-initializes when you import mcp_mesh\n# Your functions are automatically registered with the mesh registry\n```\n\n## Features\n\n- **Automatic Registration**: Functions are automatically registered with the Go registry\n- **Health Monitoring**: Built-in health checks and heartbeats\n- **Dependency Injection**: Inject dependencies into your functions\n- **Service Discovery**: Find and use other services in the mesh\n- **Graceful Degradation**: Works even if registry is unavailable\n\n## Configuration\n\nThe runtime can be configured via environment variables:\n\n- `MCP_MESH_ENABLED`: Enable/disable runtime (default: \"true\")\n- `MCP_MESH_REGISTRY_URL`: Registry URL (default: \"http://localhost:8080\")\n- `MCP_MESH_AGENT_NAME`: Custom agent name (auto-generated if not set)\n\n## API Architecture\n\nMCP Mesh uses a clear separation between public and private APIs:\n\n- **`mesh`** - Public user API for decorators and types\n- **`_mcp_mesh`** - Private internal implementation (do not import directly)\n\nThe underscore prefix on `_mcp_mesh` follows Python conventions to indicate internal/private packages. Users should only import from the `mesh` package to ensure compatibility across versions.\n\n## Documentation\n\nSee the [main repository](https://github.com/dhyansraj/mcp-mesh) for complete documentation.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Kubernetes-native platform for distributed MCP applications",
"version": "0.4.0",
"project_urls": {
"Discussions": "https://github.com/dhyansraj/mcp-mesh/discussions",
"Documentation": "https://github.com/dhyansraj/mcp-mesh/tree/main/docs",
"Homepage": "https://github.com/dhyansraj/mcp-mesh",
"Issues": "https://github.com/dhyansraj/mcp-mesh/issues",
"Repository": "https://github.com/dhyansraj/mcp-mesh"
},
"split_keywords": [
"agents",
" ai",
" distributed",
" kubernetes",
" mcp",
" microservices",
" orchestration"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "0023a7f008c99d6cc2faaa43b482f2da4d822c0d633aa247ce021c2fed957a0d",
"md5": "c1bc04fb2f382ff5eaed8e49e7e4a372",
"sha256": "c9b3721224bf97c3eb5b1fe76402d1244dadd138bf084ac44be1295a92a8802a"
},
"downloads": -1,
"filename": "mcp_mesh-0.4.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "c1bc04fb2f382ff5eaed8e49e7e4a372",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.11",
"size": 200197,
"upload_time": "2025-07-31T22:35:30",
"upload_time_iso_8601": "2025-07-31T22:35:30.230766Z",
"url": "https://files.pythonhosted.org/packages/00/23/a7f008c99d6cc2faaa43b482f2da4d822c0d633aa247ce021c2fed957a0d/mcp_mesh-0.4.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "1f59e44469765b1e4a9a125b45f1fc9dce94f2f19307c9321eda1f4549554af3",
"md5": "8b389eb7b69d062d195aafc57fea89d5",
"sha256": "ae8257a3714d73e1ee5e112d1057671b2ad2ece35ce8bc7c74522e081803f1f3"
},
"downloads": -1,
"filename": "mcp_mesh-0.4.0.tar.gz",
"has_sig": false,
"md5_digest": "8b389eb7b69d062d195aafc57fea89d5",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.11",
"size": 117359,
"upload_time": "2025-07-31T22:35:31",
"upload_time_iso_8601": "2025-07-31T22:35:31.821401Z",
"url": "https://files.pythonhosted.org/packages/1f/59/e44469765b1e4a9a125b45f1fc9dce94f2f19307c9321eda1f4549554af3/mcp_mesh-0.4.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-07-31 22:35:31",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "dhyansraj",
"github_project": "mcp-mesh",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "mcp-mesh"
}