mcpkernel 0.1.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.
Files changed (109) hide show
  1. mcpkernel-0.1.0/.github/FUNDING.yml +1 -0
  2. mcpkernel-0.1.0/.github/ISSUE_TEMPLATE/bug_report.yml +97 -0
  3. mcpkernel-0.1.0/.github/ISSUE_TEMPLATE/config.yml +8 -0
  4. mcpkernel-0.1.0/.github/ISSUE_TEMPLATE/feature_request.yml +72 -0
  5. mcpkernel-0.1.0/.github/PULL_REQUEST_TEMPLATE.md +37 -0
  6. mcpkernel-0.1.0/.github/copilot-instructions.md +89 -0
  7. mcpkernel-0.1.0/.github/instructions/policy-writing.instructions.md +27 -0
  8. mcpkernel-0.1.0/.github/instructions/python-conventions.instructions.md +30 -0
  9. mcpkernel-0.1.0/.github/instructions/testing-guidelines.instructions.md +55 -0
  10. mcpkernel-0.1.0/.github/skills/docs-sync/SKILL.md +57 -0
  11. mcpkernel-0.1.0/.github/skills/research-and-improve/SKILL.md +53 -0
  12. mcpkernel-0.1.0/.github/skills/search-and-fix/SKILL.md +42 -0
  13. mcpkernel-0.1.0/.github/skills/test-and-merge/SKILL.md +64 -0
  14. mcpkernel-0.1.0/.github/workflows/ci.yml +70 -0
  15. mcpkernel-0.1.0/.github/workflows/release.yml +66 -0
  16. mcpkernel-0.1.0/.github/workflows/security.yml +30 -0
  17. mcpkernel-0.1.0/.gitignore +73 -0
  18. mcpkernel-0.1.0/.pre-commit-config.yaml +28 -0
  19. mcpkernel-0.1.0/CHANGELOG.md +37 -0
  20. mcpkernel-0.1.0/CODE_OF_CONDUCT.md +77 -0
  21. mcpkernel-0.1.0/CONTRIBUTING.md +94 -0
  22. mcpkernel-0.1.0/Dockerfile +22 -0
  23. mcpkernel-0.1.0/KANBAN.md +104 -0
  24. mcpkernel-0.1.0/LICENSE +190 -0
  25. mcpkernel-0.1.0/PKG-INFO +367 -0
  26. mcpkernel-0.1.0/README.md +294 -0
  27. mcpkernel-0.1.0/SECURITY.md +69 -0
  28. mcpkernel-0.1.0/deploy/prometheus.yml +9 -0
  29. mcpkernel-0.1.0/docker-compose.yml +27 -0
  30. mcpkernel-0.1.0/docs/USAGE.md +276 -0
  31. mcpkernel-0.1.0/examples/autogen/autogen_example.py +53 -0
  32. mcpkernel-0.1.0/examples/copilot_guard/copilot_guard_example.py +59 -0
  33. mcpkernel-0.1.0/examples/crewai/crewai_example.py +56 -0
  34. mcpkernel-0.1.0/examples/langchain/langchain_example.py +53 -0
  35. mcpkernel-0.1.0/policies/custom_template.yaml +49 -0
  36. mcpkernel-0.1.0/policies/minimal.yaml +34 -0
  37. mcpkernel-0.1.0/policies/owasp_asi_2026_strict.yaml +143 -0
  38. mcpkernel-0.1.0/pyproject.toml +167 -0
  39. mcpkernel-0.1.0/src/mcpkernel/__init__.py +27 -0
  40. mcpkernel-0.1.0/src/mcpkernel/agent_manifest/__init__.py +19 -0
  41. mcpkernel-0.1.0/src/mcpkernel/agent_manifest/hooks.py +71 -0
  42. mcpkernel-0.1.0/src/mcpkernel/agent_manifest/loader.py +326 -0
  43. mcpkernel-0.1.0/src/mcpkernel/agent_manifest/policy_bridge.py +505 -0
  44. mcpkernel-0.1.0/src/mcpkernel/agent_manifest/tool_validator.py +138 -0
  45. mcpkernel-0.1.0/src/mcpkernel/audit/__init__.py +11 -0
  46. mcpkernel-0.1.0/src/mcpkernel/audit/exporter.py +106 -0
  47. mcpkernel-0.1.0/src/mcpkernel/audit/logger.py +203 -0
  48. mcpkernel-0.1.0/src/mcpkernel/cli.py +398 -0
  49. mcpkernel-0.1.0/src/mcpkernel/config.py +272 -0
  50. mcpkernel-0.1.0/src/mcpkernel/context/__init__.py +14 -0
  51. mcpkernel-0.1.0/src/mcpkernel/context/dependency_graph.py +102 -0
  52. mcpkernel-0.1.0/src/mcpkernel/context/pruning.py +56 -0
  53. mcpkernel-0.1.0/src/mcpkernel/context/reducer.py +142 -0
  54. mcpkernel-0.1.0/src/mcpkernel/dee/__init__.py +16 -0
  55. mcpkernel-0.1.0/src/mcpkernel/dee/drift.py +131 -0
  56. mcpkernel-0.1.0/src/mcpkernel/dee/envelope.py +128 -0
  57. mcpkernel-0.1.0/src/mcpkernel/dee/replay.py +83 -0
  58. mcpkernel-0.1.0/src/mcpkernel/dee/snapshot.py +54 -0
  59. mcpkernel-0.1.0/src/mcpkernel/dee/trace_store.py +157 -0
  60. mcpkernel-0.1.0/src/mcpkernel/ebpf/__init__.py +10 -0
  61. mcpkernel-0.1.0/src/mcpkernel/ebpf/probe.py +179 -0
  62. mcpkernel-0.1.0/src/mcpkernel/ebpf/redirector.py +70 -0
  63. mcpkernel-0.1.0/src/mcpkernel/observability/__init__.py +14 -0
  64. mcpkernel-0.1.0/src/mcpkernel/observability/health.py +70 -0
  65. mcpkernel-0.1.0/src/mcpkernel/observability/metrics.py +91 -0
  66. mcpkernel-0.1.0/src/mcpkernel/observability/tracing.py +67 -0
  67. mcpkernel-0.1.0/src/mcpkernel/policy/__init__.py +13 -0
  68. mcpkernel-0.1.0/src/mcpkernel/policy/engine.py +215 -0
  69. mcpkernel-0.1.0/src/mcpkernel/policy/loader.py +88 -0
  70. mcpkernel-0.1.0/src/mcpkernel/proxy/__init__.py +12 -0
  71. mcpkernel-0.1.0/src/mcpkernel/proxy/auth.py +87 -0
  72. mcpkernel-0.1.0/src/mcpkernel/proxy/hooks.py +188 -0
  73. mcpkernel-0.1.0/src/mcpkernel/proxy/interceptor.py +178 -0
  74. mcpkernel-0.1.0/src/mcpkernel/proxy/rate_limit.py +85 -0
  75. mcpkernel-0.1.0/src/mcpkernel/proxy/server.py +292 -0
  76. mcpkernel-0.1.0/src/mcpkernel/proxy/transform.py +40 -0
  77. mcpkernel-0.1.0/src/mcpkernel/sandbox/__init__.py +41 -0
  78. mcpkernel-0.1.0/src/mcpkernel/sandbox/base.py +102 -0
  79. mcpkernel-0.1.0/src/mcpkernel/sandbox/docker_backend.py +150 -0
  80. mcpkernel-0.1.0/src/mcpkernel/sandbox/firecracker_backend.py +131 -0
  81. mcpkernel-0.1.0/src/mcpkernel/sandbox/microsandbox_backend.py +101 -0
  82. mcpkernel-0.1.0/src/mcpkernel/sandbox/wasm_backend.py +93 -0
  83. mcpkernel-0.1.0/src/mcpkernel/taint/__init__.py +23 -0
  84. mcpkernel-0.1.0/src/mcpkernel/taint/propagation.py +134 -0
  85. mcpkernel-0.1.0/src/mcpkernel/taint/report.py +42 -0
  86. mcpkernel-0.1.0/src/mcpkernel/taint/sinks.py +110 -0
  87. mcpkernel-0.1.0/src/mcpkernel/taint/sources.py +142 -0
  88. mcpkernel-0.1.0/src/mcpkernel/taint/static_analysis.py +149 -0
  89. mcpkernel-0.1.0/src/mcpkernel/taint/tracker.py +121 -0
  90. mcpkernel-0.1.0/src/mcpkernel/utils.py +188 -0
  91. mcpkernel-0.1.0/tests/__init__.py +0 -0
  92. mcpkernel-0.1.0/tests/conftest.py +99 -0
  93. mcpkernel-0.1.0/tests/test_agent_manifest.py +689 -0
  94. mcpkernel-0.1.0/tests/test_audit.py +82 -0
  95. mcpkernel-0.1.0/tests/test_cli_commands.py +496 -0
  96. mcpkernel-0.1.0/tests/test_comprehensive_coverage.py +1267 -0
  97. mcpkernel-0.1.0/tests/test_config.py +53 -0
  98. mcpkernel-0.1.0/tests/test_context.py +90 -0
  99. mcpkernel-0.1.0/tests/test_coverage_gaps.py +483 -0
  100. mcpkernel-0.1.0/tests/test_dee.py +131 -0
  101. mcpkernel-0.1.0/tests/test_hooks.py +154 -0
  102. mcpkernel-0.1.0/tests/test_integration.py +1180 -0
  103. mcpkernel-0.1.0/tests/test_observability.py +72 -0
  104. mcpkernel-0.1.0/tests/test_policy.py +159 -0
  105. mcpkernel-0.1.0/tests/test_policy_regex_safety.py +85 -0
  106. mcpkernel-0.1.0/tests/test_proxy.py +149 -0
  107. mcpkernel-0.1.0/tests/test_sprint1_fixes.py +154 -0
  108. mcpkernel-0.1.0/tests/test_taint.py +175 -0
  109. mcpkernel-0.1.0/tests/test_utils.py +124 -0
@@ -0,0 +1 @@
1
+ github: [piyushptiwari1]
@@ -0,0 +1,97 @@
1
+ name: Bug Report
2
+ description: Report a bug in MCPKernel
3
+ title: "[Bug]: "
4
+ labels: ["bug", "triage"]
5
+ body:
6
+ - type: markdown
7
+ attributes:
8
+ value: |
9
+ Thanks for taking the time to report a bug! Please fill in the details below.
10
+
11
+ - type: input
12
+ id: version
13
+ attributes:
14
+ label: MCPKernel Version
15
+ description: "Output of `mcpkernel --version` or commit hash"
16
+ placeholder: "0.1.0 or abc1234"
17
+ validations:
18
+ required: true
19
+
20
+ - type: dropdown
21
+ id: component
22
+ attributes:
23
+ label: Component
24
+ description: Which MCPKernel component is affected?
25
+ options:
26
+ - Proxy Gateway
27
+ - Policy Engine
28
+ - Taint Tracking
29
+ - Sandbox (Docker/Firecracker/WASM)
30
+ - DEE (Deterministic Execution Envelopes)
31
+ - Audit Logging
32
+ - Context Minimization
33
+ - eBPF
34
+ - Observability
35
+ - CLI
36
+ - Other
37
+ validations:
38
+ required: true
39
+
40
+ - type: textarea
41
+ id: description
42
+ attributes:
43
+ label: Bug Description
44
+ description: A clear description of what the bug is
45
+ placeholder: "When I do X, Y happens instead of Z"
46
+ validations:
47
+ required: true
48
+
49
+ - type: textarea
50
+ id: reproduce
51
+ attributes:
52
+ label: Steps to Reproduce
53
+ description: Minimal steps to reproduce the issue
54
+ value: |
55
+ 1.
56
+ 2.
57
+ 3.
58
+ validations:
59
+ required: true
60
+
61
+ - type: textarea
62
+ id: expected
63
+ attributes:
64
+ label: Expected Behavior
65
+ description: What should have happened?
66
+ validations:
67
+ required: true
68
+
69
+ - type: textarea
70
+ id: logs
71
+ attributes:
72
+ label: Logs / Error Output
73
+ description: Paste any relevant logs or error messages
74
+ render: shell
75
+
76
+ - type: dropdown
77
+ id: python
78
+ attributes:
79
+ label: Python Version
80
+ options:
81
+ - "3.10"
82
+ - "3.11"
83
+ - "3.12"
84
+ validations:
85
+ required: true
86
+
87
+ - type: dropdown
88
+ id: os
89
+ attributes:
90
+ label: Operating System
91
+ options:
92
+ - Linux
93
+ - macOS
94
+ - Windows (WSL)
95
+ - Other
96
+ validations:
97
+ required: true
@@ -0,0 +1,8 @@
1
+ blank_issues_enabled: false
2
+ contact_links:
3
+ - name: Security Vulnerability
4
+ url: https://github.com/piyushptiwari1/mcpkernel/security/advisories/new
5
+ about: Report a security vulnerability privately via GitHub Security Advisories
6
+ - name: Questions & Discussion
7
+ url: https://github.com/piyushptiwari1/mcpkernel/discussions
8
+ about: Ask questions and share ideas in GitHub Discussions
@@ -0,0 +1,72 @@
1
+ name: Feature Request
2
+ description: Suggest a new feature or improvement for MCPKernel
3
+ title: "[Feature]: "
4
+ labels: ["enhancement"]
5
+ body:
6
+ - type: markdown
7
+ attributes:
8
+ value: |
9
+ Thanks for suggesting an improvement! Please describe your idea below.
10
+
11
+ - type: dropdown
12
+ id: component
13
+ attributes:
14
+ label: Component
15
+ description: Which area does this feature relate to?
16
+ options:
17
+ - Proxy Gateway
18
+ - Policy Engine
19
+ - Taint Tracking
20
+ - Sandbox (Docker/Firecracker/WASM)
21
+ - DEE (Deterministic Execution Envelopes)
22
+ - Audit Logging
23
+ - Context Minimization
24
+ - eBPF
25
+ - Observability
26
+ - CLI
27
+ - New Component
28
+ - Documentation
29
+ - Other
30
+ validations:
31
+ required: true
32
+
33
+ - type: textarea
34
+ id: problem
35
+ attributes:
36
+ label: Problem Statement
37
+ description: What problem does this feature solve? Is it related to a frustration?
38
+ placeholder: "I'm always frustrated when..."
39
+ validations:
40
+ required: true
41
+
42
+ - type: textarea
43
+ id: solution
44
+ attributes:
45
+ label: Proposed Solution
46
+ description: How should this work? Include API examples, config snippets, or diagrams if helpful.
47
+ validations:
48
+ required: true
49
+
50
+ - type: textarea
51
+ id: alternatives
52
+ attributes:
53
+ label: Alternatives Considered
54
+ description: What other approaches did you consider?
55
+
56
+ - type: dropdown
57
+ id: priority
58
+ attributes:
59
+ label: Priority (your estimate)
60
+ options:
61
+ - "Nice to have"
62
+ - "Important"
63
+ - "Critical for my use case"
64
+ validations:
65
+ required: true
66
+
67
+ - type: checkboxes
68
+ id: contribution
69
+ attributes:
70
+ label: Contribution
71
+ options:
72
+ - label: I'm willing to submit a PR for this feature
@@ -0,0 +1,37 @@
1
+ ## Description
2
+
3
+ <!-- What does this PR do? Link to the related issue if applicable. -->
4
+
5
+ Fixes #
6
+
7
+ ## Changes
8
+
9
+ <!-- List the key changes in this PR -->
10
+
11
+ -
12
+
13
+ ## Type of Change
14
+
15
+ - [ ] Bug fix (non-breaking change that fixes an issue)
16
+ - [ ] New feature (non-breaking change that adds functionality)
17
+ - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
18
+ - [ ] Documentation update
19
+ - [ ] Refactoring (no functional changes)
20
+ - [ ] Test improvements
21
+
22
+ ## Checklist
23
+
24
+ - [ ] My code follows MCPKernel's [coding conventions](CONTRIBUTING.md)
25
+ - [ ] I have added tests that prove my fix/feature works
26
+ - [ ] All tests pass: `python -m pytest tests/ -v --tb=short`
27
+ - [ ] Linting passes: `ruff check src/ tests/`
28
+ - [ ] I have updated documentation (if applicable)
29
+ - [ ] I have used conventional commit messages (`feat:`, `fix:`, `docs:`, etc.)
30
+ - [ ] My changes don't introduce security vulnerabilities
31
+
32
+ ## Test Results
33
+
34
+ <!-- Paste output of `python -m pytest tests/ -v --tb=short` -->
35
+
36
+ ```
37
+ ```
@@ -0,0 +1,89 @@
1
+ # MCPKernel — Project Context for All Agents
2
+
3
+ ## Project Overview
4
+ MCPKernel is an open-source **Execution Sovereignty Stack** — a mandatory, deterministic MCP/A2A gateway that makes every agent tool call provably replayable, taint-safe, and policy-enforced. Licensed under Apache 2.0.
5
+
6
+ **Repository**: `piyushptiwari1/mcpkernel`
7
+
8
+ ## Architecture
9
+ - **11 packages** in `src/mcpkernel/`: proxy, sandbox, dee, taint, context, ebpf, policy, audit, observability, cli, agent_manifest
10
+ - **Proxy**: AsyncIO MCP/A2A transparent gateway with SSE/stdio transport
11
+ - **Policy**: YAML-based rules engine with OWASP ASI 2026 mappings
12
+ - **Taint**: Multi-mode taint tracking (FULL/LIGHT/OFF) for secrets, PII, user input
13
+ - **Sandbox**: Docker, Firecracker, WASM, Microsandbox backends
14
+ - **DEE**: Deterministic Execution Envelopes — hashed, Sigstore-signed, replayable
15
+ - **Audit**: Tamper-proof append-only logs with SIEM export (CEF, JSONL, CSV)
16
+ - **Context**: Environment snapshots and drift detection
17
+ - **Observability**: OpenTelemetry metrics and Prometheus export
18
+ - **eBPF**: Kernel-level syscall filtering
19
+ - **Agent Manifest**: agent.yaml loader, policy bridge, tool validator, proxy hook
20
+
21
+ ## Code Standards
22
+ - Python >=3.12 (tested on 3.12 and 3.13, developed on 3.13.12)
23
+ - Async-first using `asyncio`
24
+ - Type hints on all public APIs
25
+ - Tests in `tests/` using `pytest` with async support
26
+ - All 443 tests must pass before merging to main
27
+ - Coverage must be ≥80% (`python -m pytest --cov=mcpkernel`)
28
+ - Lint clean: `ruff check src/ tests/` must show zero errors
29
+ - Format clean: `ruff format --check src/ tests/` must pass
30
+
31
+ ## Build & Test
32
+ ```bash
33
+ # Install (using uv)
34
+ uv venv --python 3.13
35
+ source .venv/bin/activate
36
+ uv pip install -e ".[dev]"
37
+
38
+ # Run all tests
39
+ python -m pytest tests/ -v --tb=short
40
+
41
+ # Run specific test module
42
+ python -m pytest tests/test_proxy.py -v
43
+
44
+ # Lint + Format
45
+ ruff check src/ tests/
46
+ ruff format --check src/ tests/
47
+
48
+ # Type check
49
+ mypy src/mcpkernel/
50
+ ```
51
+
52
+ ## Git Workflow
53
+ - `main` branch: stable, all tests passing
54
+ - `development` branch: active work, may have failing tests
55
+ - Feature branches: `feature/<description>` off development
56
+ - Bug fix branches: `fix/<description>` off development
57
+ - Always run tests before merging to main
58
+ - Use conventional commits: `feat:`, `fix:`, `docs:`, `test:`, `refactor:`, `chore:`
59
+
60
+ ## Key Files
61
+ - `README.md` — Project overview and quick start
62
+ - `docs/USAGE.md` — Detailed usage guide
63
+ - `CHANGELOG.md` — Version history
64
+ - `CONTRIBUTING.md` — Contribution guidelines
65
+ - `pyproject.toml` — Project metadata and dependencies
66
+ - `policies/` — Example YAML policy files
67
+ - `src/mcpkernel/agent_manifest/` — Agent manifest loader, policy bridge, tool validator, hooks
68
+
69
+ ## Agent Team Guidelines
70
+ - When making changes, always run `python -m pytest tests/ -v --tb=short` to validate
71
+ - When fixing issues, create a test that reproduces the bug first
72
+ - When adding features, add corresponding tests
73
+ - Update `README.md` and `docs/USAGE.md` when public APIs change
74
+ - Track all work through GitHub Issues with appropriate labels
75
+
76
+ ## Agent System Overview (16 agents — internal tooling only, not shipped)
77
+ - **Control**: team-lead (orchestrator), planner (spec writer)
78
+ - **Intelligence**: issue-hunter (external + internal structural scan), repo-scout, researcher, use-case-scout, contributor-booster
79
+ - **Execution**: code-improver, test-writer, test-runner
80
+ - **Quality**: code-quality-agent (lint, type check, format, coverage, compatibility — NEW Sprint 2)
81
+ - **Validation**: security-agent (hard gate), reviewer (hard gate)
82
+ - **Support**: docs-updater, branch-manager (PR-only, never merges to main)
83
+ - **Meta**: agent-architect (proposal-only, read-only — now detects quality blind spots)
84
+ - Execution chain: `code-improver → test-writer → test-runner → code-quality-agent → security-agent → reviewer → docs-updater → branch-manager`
85
+ - Destructive operations (file/function deletion) emit `⚠️ DESTRUCTIVE` tag and halt pipeline for human review
86
+ - `pyproject.toml` auto-grant exception: if test-runner fails with `ModuleNotFoundError`, code-improver may add the missing dependency without human gate
87
+ - Sequence lock: docs-updater always finishes before contributor-booster touches README.md
88
+ - Agent definitions live in `.github/agents/` (gitignored)
89
+ - Project board at `.agent-workspace/board.json` (gitignored)
@@ -0,0 +1,27 @@
1
+ ---
2
+ description: "Use when working with MCPKernel YAML policy files. Covers policy syntax, rule structure, OWASP ASI mappings, and best practices for writing security policies."
3
+ applyTo: "policies/**/*.yaml"
4
+ ---
5
+
6
+ # MCPKernel Policy Writing Guide
7
+
8
+ ## Policy Structure
9
+ ```yaml
10
+ version: "1.0"
11
+ rules:
12
+ - id: "rule-unique-id"
13
+ description: "What this rule does"
14
+ tool: "tool_name" # or "*" for all tools
15
+ action: "allow|deny|audit"
16
+ conditions:
17
+ - field: "argument_name"
18
+ operator: "equals|contains|matches|not_contains"
19
+ value: "match_value"
20
+ owasp_asi: "ASI-XX" # Optional OWASP mapping
21
+ ```
22
+
23
+ ## Best Practices
24
+ - Use specific tool names over wildcards when possible
25
+ - Always include `description` for audit trail clarity
26
+ - Map rules to OWASP ASI categories for compliance reporting
27
+ - Test policies with: `python -m pytest tests/test_policy.py -v`
@@ -0,0 +1,30 @@
1
+ ---
2
+ description: "Use when writing or modifying Python code in MCPKernel. Covers async patterns, type hints, structlog logging, error handling, and module conventions."
3
+ applyTo: "src/**/*.py"
4
+ ---
5
+
6
+ # MCPKernel Python Conventions
7
+
8
+ ## Async-First
9
+ - All I/O-bound functions must be `async def`
10
+ - Use `asyncio.gather()` for concurrent operations
11
+ - Never use blocking I/O in async functions (use `aiofiles`, `aiohttp`, etc.)
12
+
13
+ ## Type Hints
14
+ - All public functions and methods must have type annotations
15
+ - Use `from __future__ import annotations` for forward references
16
+ - Use `Optional[X]` not `X | None` (Python 3.10 compatibility)
17
+
18
+ ## Logging
19
+ - Use `structlog` — NOT stdlib `logging`
20
+ - Get logger: `logger = structlog.get_logger(__name__)`
21
+ - Include context: `logger.info("action_description", key=value)`
22
+
23
+ ## Error Handling
24
+ - Define custom exceptions per package in `exceptions.py`
25
+ - Catch specific exceptions, not broad `Exception`
26
+ - For async retry: use exponential backoff with jitter
27
+
28
+ ## Imports
29
+ - stdlib → third-party → local (separated by blank lines)
30
+ - Use absolute imports: `from mcpkernel.policy.engine import PolicyEngine`
@@ -0,0 +1,55 @@
1
+ ---
2
+ description: "Use when writing or modifying tests for MCPKernel. Covers pytest patterns, async testing, fixtures, and test structure."
3
+ applyTo: "tests/**/*.py"
4
+ ---
5
+
6
+ # MCPKernel Testing Guidelines
7
+
8
+ ## Framework
9
+ - pytest with `pytest-asyncio` for async tests
10
+ - Mark async tests: `@pytest.mark.asyncio`
11
+ - Shared fixtures in `tests/conftest.py`
12
+
13
+ ## Test Structure
14
+ ```python
15
+ class TestFeatureName:
16
+ """Tests for feature_name."""
17
+
18
+ def test_expected_behavior(self):
19
+ """Test that X does Y when Z."""
20
+ # Arrange
21
+ ...
22
+ # Act
23
+ result = function_under_test(...)
24
+ # Assert
25
+ assert result == expected
26
+
27
+ @pytest.mark.asyncio
28
+ async def test_async_behavior(self):
29
+ """Test async operation."""
30
+ result = await async_function(...)
31
+ assert result is not None
32
+ ```
33
+
34
+ ## Naming
35
+ - Files: `test_<module>.py`
36
+ - Classes: `TestClassName`
37
+ - Functions: `test_<behavior>_<condition>`
38
+
39
+ ## Commands
40
+ ```bash
41
+ # All tests
42
+ python -m pytest tests/ -v --tb=short
43
+
44
+ # Single file
45
+ python -m pytest tests/test_proxy.py -v
46
+
47
+ # Single test
48
+ python -m pytest tests/test_proxy.py::TestProxy::test_name -v
49
+ ```
50
+
51
+ ## Rules
52
+ - Tests must not depend on external services
53
+ - Use mocks for I/O — `unittest.mock.AsyncMock` for async
54
+ - Each test must be independent and idempotent
55
+ - Target: all 106+ existing tests must continue to pass
@@ -0,0 +1,57 @@
1
+ ---
2
+ name: docs-sync
3
+ description: 'Multi-step workflow to audit MCPKernel documentation against the codebase and update README.md, docs/USAGE.md, CHANGELOG.md. Use when synchronizing documentation with code changes, auditing doc accuracy, or before releases.'
4
+ ---
5
+
6
+ # Documentation Sync Workflow
7
+
8
+ ## When to Use
9
+ - After a batch of code changes to sync docs
10
+ - Before preparing a release
11
+ - When public APIs have changed
12
+ - Regular documentation audits
13
+
14
+ ## Procedure
15
+
16
+ ### Step 1: Audit README.md
17
+ 1. Read `README.md`
18
+ 2. Verify:
19
+ - Python version badge matches `pyproject.toml`
20
+ - Quick start commands work
21
+ - Feature list matches actual packages in `src/mcpkernel/`
22
+ - Architecture diagram is accurate
23
+ - All links are valid
24
+
25
+ ### Step 2: Audit docs/USAGE.md
26
+ 1. Read `docs/USAGE.md`
27
+ 2. Cross-reference with:
28
+ - `src/mcpkernel/config.py` for configuration options
29
+ - `src/mcpkernel/cli.py` for CLI commands
30
+ - `src/mcpkernel/policy/` for policy syntax
31
+ - `policies/` for example policies
32
+ 3. Verify all code examples match current API
33
+
34
+ ### Step 3: Update CHANGELOG.md
35
+ 1. Check git log for unreleased changes:
36
+ ```bash
37
+ git log --oneline --since="last tag"
38
+ ```
39
+ 2. Categorize changes: Added, Changed, Fixed, Security
40
+ 3. Add entries under `[Unreleased]` section
41
+
42
+ ### Step 4: Update CONTRIBUTING.md
43
+ 1. Verify build/test commands are current
44
+ 2. Check that development workflow matches actual practice
45
+
46
+ ### Step 5: Apply Updates
47
+ - Edit files with accurate, verified information
48
+ - Keep style consistent with existing docs
49
+ - Don't add fictional features
50
+
51
+ ## References
52
+ - `README.md` — Project overview
53
+ - `docs/USAGE.md` — Usage guide
54
+ - `CHANGELOG.md` — Version history
55
+ - `CONTRIBUTING.md` — Contributor guide
56
+ - `src/mcpkernel/config.py` — Configuration reference
57
+ - `src/mcpkernel/cli.py` — CLI reference
@@ -0,0 +1,53 @@
1
+ ---
2
+ name: research-and-improve
3
+ description: 'Multi-step workflow to research latest MCP security techniques, async Python patterns, sandboxing approaches, and implement improvements to MCPKernel. Use when upgrading architecture, adding new security features, or optimizing performance based on latest research.'
4
+ ---
5
+
6
+ # Research and Improve Workflow
7
+
8
+ ## When to Use
9
+ - Discovering and implementing latest security techniques
10
+ - Optimizing performance based on current best practices
11
+ - Upgrading protocol support (MCP, A2A)
12
+ - Adding new sandboxing or taint tracking capabilities
13
+
14
+ ## Procedure
15
+
16
+ ### Step 1: Research
17
+ 1. Search for latest MCP protocol specification updates
18
+ 2. Research current security approaches for:
19
+ - Taint analysis and information flow control
20
+ - Container sandboxing advancements
21
+ - eBPF security monitoring
22
+ - Policy engine improvements
23
+ 3. Look for Python async optimization techniques
24
+ 4. Check for new OWASP ASI guidelines
25
+
26
+ ### Step 2: Evaluate Applicability
27
+ 1. Read current MCPKernel implementation in `src/mcpkernel/`
28
+ 2. Compare with researched techniques
29
+ 3. Identify improvements that:
30
+ - Fit MCPKernel's async Python architecture
31
+ - Don't break existing APIs
32
+ - Have measurable impact
33
+
34
+ ### Step 3: Implement
35
+ 1. Create a feature branch: `feature/<improvement-name>`
36
+ 2. Write tests first for the new behavior
37
+ 3. Implement the improvement with minimal changes
38
+ 4. Run full test suite: `python -m pytest tests/ -v --tb=short`
39
+
40
+ ### Step 4: Document
41
+ 1. Update `docs/USAGE.md` if usage changes
42
+ 2. Update `CHANGELOG.md` with the improvement
43
+ 3. Update `README.md` if it's a notable feature
44
+
45
+ ### Step 5: Report
46
+ Return research findings, what was implemented, and validation results.
47
+
48
+ ## References
49
+ - MCPKernel architecture: `src/mcpkernel/`
50
+ - Configuration: `src/mcpkernel/config.py`
51
+ - Proxy layer: `src/mcpkernel/proxy/`
52
+ - Policy engine: `src/mcpkernel/policy/`
53
+ - Taint tracking: `src/mcpkernel/taint/`
@@ -0,0 +1,42 @@
1
+ ---
2
+ name: search-and-fix
3
+ description: 'Multi-step workflow to discover issues in MCPKernel and similar repos, implement fixes, and validate with tests. Use when finding and fixing bugs, addressing security gaps, or implementing improvements discovered from issue analysis.'
4
+ ---
5
+
6
+ # Search and Fix Workflow
7
+
8
+ ## When to Use
9
+ - Finding and fixing bugs from GitHub issues
10
+ - Addressing security vulnerabilities discovered in similar projects
11
+ - Implementing improvements from issue analysis
12
+
13
+ ## Procedure
14
+
15
+ ### Step 1: Discover Issues
16
+ 1. Use web search to find open issues in `piyushptiwari1/mcpkernel`
17
+ 2. Search similar MCP/security projects for resolved issues that may affect MCPKernel
18
+ 3. Analyze the codebase with `search` for patterns matching known bugs
19
+
20
+ ### Step 2: Triage and Plan
21
+ 1. Prioritize findings: Critical > High > Medium > Low
22
+ 2. For each issue, identify the affected files in `src/mcpkernel/`
23
+ 3. Create a brief implementation plan
24
+
25
+ ### Step 3: Implement Fix
26
+ 1. Read the target source files to understand current behavior
27
+ 2. Write a failing test in `tests/` that reproduces the issue
28
+ 3. Implement the minimal fix in `src/mcpkernel/`
29
+ 4. Run: `python -m pytest tests/ -v --tb=short`
30
+
31
+ ### Step 4: Validate
32
+ 1. Ensure all 106+ tests pass (including the new one)
33
+ 2. Run `ruff check src/ tests/` for lint compliance
34
+ 3. Document the change for the changelog
35
+
36
+ ### Step 5: Report
37
+ Return a summary of what was found, fixed, and validated.
38
+
39
+ ## References
40
+ - MCPKernel source: `src/mcpkernel/`
41
+ - Tests: `tests/`
42
+ - Policies: `policies/`
@@ -0,0 +1,64 @@
1
+ ---
2
+ name: test-and-merge
3
+ description: 'Multi-step workflow to run the full MCPKernel test suite, validate code quality, and merge development branch to main when all checks pass. Use when validating changes, preparing for merge, or checking if development is ready for main.'
4
+ ---
5
+
6
+ # Test and Merge Workflow
7
+
8
+ ## When to Use
9
+ - Validating that all tests pass before merging
10
+ - Preparing the development branch for merge to main
11
+ - Running comprehensive quality checks
12
+
13
+ ## Procedure
14
+
15
+ ### Step 1: Verify Branch State
16
+ ```bash
17
+ git branch
18
+ git status
19
+ git log --oneline development..HEAD # or HEAD..development
20
+ ```
21
+
22
+ ### Step 2: Run Full Test Suite
23
+ ```bash
24
+ python -m pytest tests/ -v --tb=short
25
+ ```
26
+ - All 106+ tests must pass
27
+ - Zero failures, zero errors
28
+
29
+ ### Step 3: Run Lint Check
30
+ ```bash
31
+ ruff check src/ tests/
32
+ ```
33
+ - No lint errors allowed
34
+
35
+ ### Step 4: Verify Documentation
36
+ 1. Check `CHANGELOG.md` has entries for recent changes
37
+ 2. Check `README.md` is current
38
+ 3. Check `docs/USAGE.md` matches current APIs
39
+
40
+ ### Step 5: Merge Decision
41
+ If ALL checks pass:
42
+ ```bash
43
+ git checkout main
44
+ git merge --no-ff development -m "chore: merge development to main — all tests passing"
45
+ git checkout development
46
+ ```
47
+
48
+ If ANY check fails:
49
+ - Report failures with details
50
+ - Do NOT merge
51
+ - List what needs to be fixed
52
+
53
+ ### Step 6: Report
54
+ ```
55
+ ## Merge Report
56
+ - Tests: PASS/FAIL (count)
57
+ - Lint: PASS/FAIL
58
+ - Docs: UP TO DATE / NEEDS UPDATE
59
+ - Merge: COMPLETED / BLOCKED (reason)
60
+ ```
61
+
62
+ ## References
63
+ - Test suite: `tests/`
64
+ - CI config: `.github/workflows/ci.yml`