charmlibs-interfaces-mcp
Charm library for the MCP (Model Context Protocol) Juju interface.
Provides McpProvider and McpRequirer classes that charm authors can use
to integrate with the mcp relation interface.
Installation
pip install charmlibs-interfaces-mcp
Usage
Provider (principal charm)
import ops
from charmlibs.interfaces.mcp import McpProvider, McpDefinitions, Tool, ExecHandler
class MyCharm(ops.CharmBase):
def __init__(self, framework):
super().__init__(framework)
self.mcp = McpProvider(self, "mcp")
framework.observe(self.on.mcp_relation_joined, self._on_mcp_joined)
def _on_mcp_joined(self, event):
self.mcp.set_definitions(McpDefinitions(
tools=[
Tool(
name="list-files",
description="List files in a directory",
input_schema={
"type": "object",
"properties": {
"dir": {"type": "string", "description": "Directory path"},
},
"required": ["dir"],
},
handler=ExecHandler(command=["ls", "-la", "{{dir}}"]),
),
],
))
Requirer (mcp-server charm)
import ops
from charmlibs.interfaces.mcp import McpRequirer
class McpServerCharm(ops.CharmBase):
def __init__(self, framework):
super().__init__(framework)
self.mcp = McpRequirer(self, "mcp")
def _on_relation_changed(self, event):
definitions = self.mcp.collect_definitions()
# definitions = {"tools": [...], "prompts": [...], "resources": [...]}
Data models
All models are plain dataclasses (no pydantic):
Tool— an MCP tool with name, description, input_schema, and handlerPrompt— a prompt template with argumentsResource— a readable data sourceExecHandler— runs a command on the machineHttpHandler— calls a local HTTP endpointMcpDefinitions— container for tools, prompts, and resources
Metadata
Release files for charmlibs-interfaces-mcp 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| charmlibs_interfaces_mcp-0.1.2.tar.gz | 37.0 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| charmlibs_interfaces_mcp-0.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 44.6 kB
Release files / charmlibs_interfaces_mcp-0.1.2.tar.gz
| Download URL | charmlibs_interfaces_mcp-0.1.2.tar.gz |
|---|---|
| Size | 37.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
31811fa999e3a7c702baec67101206197be39353c729a7008a07e2cf8d4432af
|
|
BLAKE2b-256 checksum How to use checksums |
383c66b9a3e57a91ceb18ac773f4c82ff0c4791089d5963668792e891d16e987
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 6, 2026.
Transparency logRelease files / charmlibs_interfaces_mcp-0.1.2-py3-none-any.whl
| Download URL | charmlibs_interfaces_mcp-0.1.2-py3-none-any.whl |
|---|---|
| Size | 7.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
37abde76b9854b36ddbdbfb60ebb918644d50ade19135d36f89cdcfcb9ecce41
|
|
BLAKE2b-256 checksum How to use checksums |
a1bdbb79f9fe0117038dc88bfeae3fb1bbe75c42aabe8b5a90ffc38d149499d1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 6, 2026.
Transparency logSecurity for charmlibs-interfaces-mcp 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for charmlibs_interfaces_mcp-0.1.2.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 6, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.