Federal Model Context Protocol - Python implementation
Project description
FedMCP Python Core
Python implementation of the Federal Model Context Protocol (FedMCP) v0.2.
Installation
pip install fedmcp
For development:
pip install -e ".[dev]"
Quick Start
Creating and Signing Artifacts
from uuid import uuid4
from fedmcp import Artifact, ArtifactType, LocalSigner
# Create an artifact
artifact = Artifact(
type=ArtifactType.AGENT_RECIPE,
workspaceId=uuid4(),
jsonBody={
"name": "Healthcare Diagnostic Agent",
"version": "1.0.0",
"capabilities": ["diagnose", "recommend", "monitor"]
}
)
# Sign it
signer = LocalSigner()
jws_token = signer.sign(artifact)
print(f"Signed artifact: {jws_token[:50]}...")
Verifying Artifacts
from fedmcp import Verifier
# Create verifier and add public key
verifier = Verifier()
verifier.add_public_key(signer.get_key_id(), signer.private_key.public_key())
# Verify the artifact
verified_artifact = verifier.verify(jws_token)
print(f"Verified artifact ID: {verified_artifact.id}")
Using the Client
from fedmcp import FedMCPClient
import asyncio
async def main():
client = FedMCPClient(
base_url="http://localhost:8000",
workspace_id=uuid4(),
signer=LocalSigner()
)
# Create an artifact
result = await client.create_artifact(
artifact_type=ArtifactType.LLM_COMPLETION,
json_body={
"model": "gpt-4",
"prompt": "Diagnose patient symptoms",
"completion": "Based on the symptoms..."
}
)
print(f"Created artifact: {result['id']}")
client.close()
asyncio.run(main())
AWS KMS Integration
from fedmcp import KMSSigner, KMSVerifier
# Sign with KMS
kms_signer = KMSSigner(
kms_key_id="arn:aws:kms:us-gov-west-1:123456789012:key/abc-123",
region="us-gov-west-1"
)
jws_token = kms_signer.sign(artifact)
# Verify with KMS
kms_verifier = KMSVerifier(region="us-gov-west-1")
kms_verifier.add_kms_key(
key_id=kms_signer.get_key_id(),
kms_key_id="arn:aws:kms:us-gov-west-1:123456789012:key/abc-123"
)
verified = kms_verifier.verify(jws_token)
Artifact Types
Standard FedMCP artifact types:
SSP_FRAGMENT- System Security Plan fragmentsPOAM_TEMPLATE- Plan of Action & Milestones templatesAGENT_RECIPE- AI agent configurationsBASELINE_MODULE- Security baseline modulesAUDIT_SCRIPT- Audit automation scripts
Healthcare-specific types:
RAG_QUERY- Retrieval-augmented generation queriesLLM_COMPLETION- Language model completionsTOOL_INVOCATION- Tool/function call records
Testing
Run tests with pytest:
pytest
License
Apache 2.0 - See LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
fedmcp-0.2.0.tar.gz
(10.0 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fedmcp-0.2.0.tar.gz.
File metadata
- Download URL: fedmcp-0.2.0.tar.gz
- Upload date:
- Size: 10.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8ec80454d68fdaf5fd1bbae77107a0ffa83628b833fdf8ca9d82e5815d7a0b37
|
|
| MD5 |
1c751eb04c8033f2615d213c43edce26
|
|
| BLAKE2b-256 |
fa28887a80aff2cbc9287e94cef107c7296ebeff6634666fa8bd1dfb8ea850e9
|
File details
Details for the file fedmcp-0.2.0-py3-none-any.whl.
File metadata
- Download URL: fedmcp-0.2.0-py3-none-any.whl
- Upload date:
- Size: 9.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c6a4878fedfa87893e31d594b7f7b4bfe6313e09610a0adccfc86b4e7e187c59
|
|
| MD5 |
d5d9c8b0de64dd4d71dc5da5e0b5efe6
|
|
| BLAKE2b-256 |
981786c6678cd65118a1380a8022c290760fa456ebdc41b52dbc77436ff40e78
|