maigp-light-mcp 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*.egg-info/
|
|
5
|
+
dist/
|
|
6
|
+
build/
|
|
7
|
+
.venv/
|
|
8
|
+
.eggs/
|
|
9
|
+
|
|
10
|
+
# Node
|
|
11
|
+
node_modules/
|
|
12
|
+
dist/
|
|
13
|
+
|
|
14
|
+
# Go
|
|
15
|
+
bin/
|
|
16
|
+
|
|
17
|
+
# Rust
|
|
18
|
+
target/
|
|
19
|
+
|
|
20
|
+
# .NET
|
|
21
|
+
bin/
|
|
22
|
+
obj/
|
|
23
|
+
|
|
24
|
+
# Java
|
|
25
|
+
*.class
|
|
26
|
+
out/
|
|
27
|
+
|
|
28
|
+
# IDE
|
|
29
|
+
.idea/
|
|
30
|
+
.vscode/
|
|
31
|
+
.kiro/
|
|
32
|
+
*.swp
|
|
33
|
+
|
|
34
|
+
# OS
|
|
35
|
+
.DS_Store
|
|
36
|
+
Thumbs.db
|
|
37
|
+
|
|
38
|
+
# Secrets (never commit)
|
|
39
|
+
.env
|
|
40
|
+
*.pem
|
|
41
|
+
*.key
|
|
42
|
+
*.pdf
|
|
43
|
+
BACKLOG/
|
|
44
|
+
patent/
|
|
45
|
+
docs/.archive/
|
|
46
|
+
review/
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# AIGP-Light Source Available License
|
|
2
|
+
|
|
3
|
+
Version 1.0, July 2026
|
|
4
|
+
|
|
5
|
+
Copyright (c) 2024-2026 Causum. All rights reserved.
|
|
6
|
+
|
|
7
|
+
## Grant of Rights
|
|
8
|
+
|
|
9
|
+
Permission is hereby granted, free of charge, to any person or organization
|
|
10
|
+
obtaining a copy of this software and associated documentation files (the
|
|
11
|
+
"Software"), to:
|
|
12
|
+
|
|
13
|
+
1. **Use** the Software for any purpose, including commercial applications,
|
|
14
|
+
without restriction.
|
|
15
|
+
|
|
16
|
+
2. **Copy and distribute** the Software in unmodified form, provided this
|
|
17
|
+
license notice is included in all copies.
|
|
18
|
+
|
|
19
|
+
3. **Integrate** the Software into applications, products, and services
|
|
20
|
+
without royalty or fee.
|
|
21
|
+
|
|
22
|
+
## Restrictions
|
|
23
|
+
|
|
24
|
+
The following actions require prior written permission from Causum
|
|
25
|
+
(licensing@causum.com):
|
|
26
|
+
|
|
27
|
+
1. **Modification** — You may not modify, alter, adapt, or create derivative
|
|
28
|
+
works based on the Software without explicit written permission from Causum.
|
|
29
|
+
|
|
30
|
+
2. **Forking for distribution** — You may not distribute modified versions of
|
|
31
|
+
the Software, whether under this name or any other name.
|
|
32
|
+
|
|
33
|
+
3. **Relicensing** — You may not sublicense or apply a different license to
|
|
34
|
+
the Software or any portion thereof.
|
|
35
|
+
|
|
36
|
+
## What This Means in Practice
|
|
37
|
+
|
|
38
|
+
- ✅ Use in production — freely
|
|
39
|
+
- ✅ Use commercially — freely
|
|
40
|
+
- ✅ Bundle in your application — freely
|
|
41
|
+
- ✅ Read and learn from the source — freely
|
|
42
|
+
- ✅ Report issues and suggest changes — welcome
|
|
43
|
+
- ✅ Contribute changes back (via PR) — welcome (subject to CLA)
|
|
44
|
+
- ❌ Modify and distribute your own version — requires permission
|
|
45
|
+
- ❌ Fork and publish under a different name — requires permission
|
|
46
|
+
- ❌ Remove or change this license — prohibited
|
|
47
|
+
|
|
48
|
+
## Contribution
|
|
49
|
+
|
|
50
|
+
Contributions submitted via pull request are welcome. By submitting a
|
|
51
|
+
contribution, you agree to assign copyright of your contribution to Causum
|
|
52
|
+
and agree that your contribution will be distributed under this same license.
|
|
53
|
+
|
|
54
|
+
## No Warranty
|
|
55
|
+
|
|
56
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
57
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
58
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
59
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
60
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
61
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
62
|
+
SOFTWARE.
|
|
63
|
+
|
|
64
|
+
## Contact
|
|
65
|
+
|
|
66
|
+
For modification permissions, commercial licensing inquiries, or questions:
|
|
67
|
+
- Email: licensing@causum.com
|
|
68
|
+
- Repository: https://github.com/owner-spec/aigp-protocol
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
AIGP-Light is part of the AIGP protocol family.
|
|
73
|
+
AIGP is registered with the U.S. Copyright Office (Case #1-15160968741, #1-15180695311).
|
|
74
|
+
Patent-pending.
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: maigp-light-mcp
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: AIGP-Light MCP Adapter — local detect & respond for MCP tool invocations
|
|
5
|
+
Project-URL: Homepage, https://github.com/owner-spec/aigp-protocol
|
|
6
|
+
Project-URL: Repository, https://github.com/owner-spec/aigp-protocol
|
|
7
|
+
Author-email: Causum <engineering@causum.com>
|
|
8
|
+
License: # AIGP-Light Source Available License
|
|
9
|
+
|
|
10
|
+
Version 1.0, July 2026
|
|
11
|
+
|
|
12
|
+
Copyright (c) 2024-2026 Causum. All rights reserved.
|
|
13
|
+
|
|
14
|
+
## Grant of Rights
|
|
15
|
+
|
|
16
|
+
Permission is hereby granted, free of charge, to any person or organization
|
|
17
|
+
obtaining a copy of this software and associated documentation files (the
|
|
18
|
+
"Software"), to:
|
|
19
|
+
|
|
20
|
+
1. **Use** the Software for any purpose, including commercial applications,
|
|
21
|
+
without restriction.
|
|
22
|
+
|
|
23
|
+
2. **Copy and distribute** the Software in unmodified form, provided this
|
|
24
|
+
license notice is included in all copies.
|
|
25
|
+
|
|
26
|
+
3. **Integrate** the Software into applications, products, and services
|
|
27
|
+
without royalty or fee.
|
|
28
|
+
|
|
29
|
+
## Restrictions
|
|
30
|
+
|
|
31
|
+
The following actions require prior written permission from Causum
|
|
32
|
+
(licensing@causum.com):
|
|
33
|
+
|
|
34
|
+
1. **Modification** — You may not modify, alter, adapt, or create derivative
|
|
35
|
+
works based on the Software without explicit written permission from Causum.
|
|
36
|
+
|
|
37
|
+
2. **Forking for distribution** — You may not distribute modified versions of
|
|
38
|
+
the Software, whether under this name or any other name.
|
|
39
|
+
|
|
40
|
+
3. **Relicensing** — You may not sublicense or apply a different license to
|
|
41
|
+
the Software or any portion thereof.
|
|
42
|
+
|
|
43
|
+
## What This Means in Practice
|
|
44
|
+
|
|
45
|
+
- ✅ Use in production — freely
|
|
46
|
+
- ✅ Use commercially — freely
|
|
47
|
+
- ✅ Bundle in your application — freely
|
|
48
|
+
- ✅ Read and learn from the source — freely
|
|
49
|
+
- ✅ Report issues and suggest changes — welcome
|
|
50
|
+
- ✅ Contribute changes back (via PR) — welcome (subject to CLA)
|
|
51
|
+
- ❌ Modify and distribute your own version — requires permission
|
|
52
|
+
- ❌ Fork and publish under a different name — requires permission
|
|
53
|
+
- ❌ Remove or change this license — prohibited
|
|
54
|
+
|
|
55
|
+
## Contribution
|
|
56
|
+
|
|
57
|
+
Contributions submitted via pull request are welcome. By submitting a
|
|
58
|
+
contribution, you agree to assign copyright of your contribution to Causum
|
|
59
|
+
and agree that your contribution will be distributed under this same license.
|
|
60
|
+
|
|
61
|
+
## No Warranty
|
|
62
|
+
|
|
63
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
64
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
65
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
66
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
67
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
68
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
69
|
+
SOFTWARE.
|
|
70
|
+
|
|
71
|
+
## Contact
|
|
72
|
+
|
|
73
|
+
For modification permissions, commercial licensing inquiries, or questions:
|
|
74
|
+
- Email: licensing@causum.com
|
|
75
|
+
- Repository: https://github.com/owner-spec/aigp-protocol
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
AIGP-Light is part of the AIGP protocol family.
|
|
80
|
+
AIGP is registered with the U.S. Copyright Office (Case #1-15160968741, #1-15180695311).
|
|
81
|
+
Patent-pending.
|
|
82
|
+
License-File: LICENSE.md
|
|
83
|
+
Keywords: aigp,detect,governance,mcp,respond,tools
|
|
84
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
85
|
+
Classifier: Intended Audience :: Developers
|
|
86
|
+
Classifier: Programming Language :: Python :: 3
|
|
87
|
+
Classifier: Topic :: Security
|
|
88
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
89
|
+
Requires-Python: >=3.10
|
|
90
|
+
Requires-Dist: maigp-light>=1.0.0
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
"""AIGP-Light MCP Adapter — Local detect & respond for MCP tool invocations.
|
|
2
|
+
|
|
3
|
+
No external governance service. Monitors tool call behavior (latency, error rate,
|
|
4
|
+
cost) and responds with circuit breakers, rate limiting, alerts.
|
|
5
|
+
|
|
6
|
+
Usage:
|
|
7
|
+
from aigp_light_mcp import LightMCPClient
|
|
8
|
+
|
|
9
|
+
governed = LightMCPClient(mcp_client, policy="aigp-light-mcp.yaml")
|
|
10
|
+
result = await governed.call_tool("wiz", "listVulnerabilities", {"severity": "HIGH"})
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
__version__ = "1.0.0"
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
|
|
17
|
+
import time
|
|
18
|
+
from typing import Any, Protocol
|
|
19
|
+
|
|
20
|
+
from aigp_light import AigpLight
|
|
21
|
+
from aigp_light.responses import CircuitOpenError, GovernanceBlockedError
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class MCPClientProtocol(Protocol):
|
|
25
|
+
"""Protocol for any MCP client that can call tools."""
|
|
26
|
+
async def call_tool(self, server_id: str, tool_name: str, arguments: dict) -> Any: ...
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
class LightMCPClient:
|
|
30
|
+
"""AIGP-Light governed MCP client.
|
|
31
|
+
|
|
32
|
+
Wraps MCP tool calls with local detect & respond:
|
|
33
|
+
- Monitors latency, error rate, cost per tool/server
|
|
34
|
+
- Circuit breaks degraded servers
|
|
35
|
+
- Rate limits expensive tools
|
|
36
|
+
- Emits RFC-010 traces for every call
|
|
37
|
+
|
|
38
|
+
No external service required. Policy from YAML/JSON.
|
|
39
|
+
"""
|
|
40
|
+
|
|
41
|
+
def __init__(self, mcp_client: Any, policy: str | dict):
|
|
42
|
+
"""Initialize with an MCP client and policy config.
|
|
43
|
+
|
|
44
|
+
Args:
|
|
45
|
+
mcp_client: Any object with call_tool(server_id, tool_name, arguments)
|
|
46
|
+
policy: Path to YAML/JSON config, or dict
|
|
47
|
+
"""
|
|
48
|
+
self._client = mcp_client
|
|
49
|
+
if isinstance(policy, str):
|
|
50
|
+
self._gov = AigpLight.from_yaml(policy)
|
|
51
|
+
else:
|
|
52
|
+
self._gov = AigpLight.from_dict(policy)
|
|
53
|
+
|
|
54
|
+
async def call_tool(
|
|
55
|
+
self,
|
|
56
|
+
server_id: str,
|
|
57
|
+
tool_name: str,
|
|
58
|
+
arguments: dict | None = None,
|
|
59
|
+
*,
|
|
60
|
+
agent_id: str = "",
|
|
61
|
+
) -> Any:
|
|
62
|
+
"""Call an MCP tool with local governance.
|
|
63
|
+
|
|
64
|
+
Monitors behavior and enforces policy. No external service calls.
|
|
65
|
+
|
|
66
|
+
Args:
|
|
67
|
+
server_id: MCP server ID (e.g. "wiz", "github")
|
|
68
|
+
tool_name: Tool name (e.g. "listVulnerabilities")
|
|
69
|
+
arguments: Tool arguments
|
|
70
|
+
agent_id: Optional calling agent identity (included in traces)
|
|
71
|
+
|
|
72
|
+
Returns:
|
|
73
|
+
Tool result (passthrough from MCP server)
|
|
74
|
+
|
|
75
|
+
Raises:
|
|
76
|
+
CircuitOpenError: Server is circuit-broken
|
|
77
|
+
GovernanceBlockedError: Policy blocks this call
|
|
78
|
+
"""
|
|
79
|
+
arguments = arguments or {}
|
|
80
|
+
|
|
81
|
+
# Use aigp-light's call() to wrap the async MCP tool invocation
|
|
82
|
+
# We need to bridge async → the sync call interface
|
|
83
|
+
result = await self._gov.acall(
|
|
84
|
+
self._client.call_tool,
|
|
85
|
+
server_id, tool_name, arguments,
|
|
86
|
+
)
|
|
87
|
+
return result
|
|
88
|
+
|
|
89
|
+
async def check_health(self, server_id: str) -> dict:
|
|
90
|
+
"""Check governance health for a specific server.
|
|
91
|
+
|
|
92
|
+
Returns current detection signals relevant to this server.
|
|
93
|
+
"""
|
|
94
|
+
metrics = self._gov.metrics
|
|
95
|
+
return {
|
|
96
|
+
"server_id": server_id,
|
|
97
|
+
"circuit_open": metrics.get("circuit_open", False),
|
|
98
|
+
"error_rate": metrics.get("error_rate", 0),
|
|
99
|
+
"latency_p95_ms": metrics.get("latency_p95_ms", 0),
|
|
100
|
+
"total_calls": metrics.get("total_calls", 0),
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
@property
|
|
104
|
+
def metrics(self) -> dict:
|
|
105
|
+
"""Current governance metrics."""
|
|
106
|
+
return self._gov.metrics
|
|
107
|
+
|
|
108
|
+
@property
|
|
109
|
+
def traces(self) -> list[dict]:
|
|
110
|
+
"""All emitted traces."""
|
|
111
|
+
return self._gov.traces
|
|
112
|
+
|
|
113
|
+
def flush(self) -> None:
|
|
114
|
+
"""Flush trace buffer."""
|
|
115
|
+
self._gov.flush()
|
|
116
|
+
|
|
117
|
+
def reset(self) -> None:
|
|
118
|
+
"""Reset all state."""
|
|
119
|
+
self._gov.reset()
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "maigp-light-mcp"
|
|
7
|
+
version = "1.0.0"
|
|
8
|
+
description = "AIGP-Light MCP Adapter — local detect & respond for MCP tool invocations"
|
|
9
|
+
license = {file = "LICENSE.md"}
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
authors = [{name = "Causum", email = "engineering@causum.com"}]
|
|
12
|
+
dependencies = ["maigp-light>=1.0.0"]
|
|
13
|
+
keywords = ["aigp", "mcp", "governance", "detect", "respond", "tools"]
|
|
14
|
+
classifiers = [
|
|
15
|
+
"Development Status :: 5 - Production/Stable",
|
|
16
|
+
"Intended Audience :: Developers",
|
|
17
|
+
"Programming Language :: Python :: 3",
|
|
18
|
+
"Topic :: Software Development :: Libraries",
|
|
19
|
+
"Topic :: Security",
|
|
20
|
+
]
|
|
21
|
+
|
|
22
|
+
[project.urls]
|
|
23
|
+
Homepage = "https://github.com/owner-spec/aigp-protocol"
|
|
24
|
+
Repository = "https://github.com/owner-spec/aigp-protocol"
|
|
25
|
+
|
|
26
|
+
[tool.hatch.build.targets.wheel]
|
|
27
|
+
packages = ["aigp_light_mcp"]
|