Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
*setools-4.7.1 (28 Jul 2026)

* Add initial prompts to MCP server.
* Add file_contexts querying class.
* Change MCP server to use standalone FastMCP package. The FastMCP server in
the mcp package is a legacy version. FastMCP depends on the mcp pacage, so
this change is not expected to be problematic for users or distros.

*setools-4.7.0 (23 Jun 2026)

* Add MCP server to provide LLMs the ability to analyze policy.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ To run SETools graphical tools, the following packages are also required:

To run SETools AI tools, the following packages are also required:

* mcp
* FastMCP 2.0+

To build SETools, the following development packages are required, in
addition to the development packages from the above list:
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "setools"
version = "4.7.0"
version = "4.7.1"
description="SELinux policy analysis tools."
authors = [{name = "Chris PeBenito", email="pebenito@ieee.org"}]
license = "LGPL-2.1-only AND GPL-2.0-only"
Expand Down Expand Up @@ -45,7 +45,7 @@ dependencies = []
optional-dependencies.analysis = ["networkx>=2.6",
"pygraphviz"]
optional-dependencies.gui = ["PyQt6"]
optional-dependencies.mcp = ["mcp>=1.0"]
optional-dependencies.mcp = ["fastmcp>=2.0"]
optional-dependencies.test = ["tox"]

[tool.setuptools]
Expand Down
8 changes: 4 additions & 4 deletions setools-mcp
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ import warnings
parser = argparse.ArgumentParser(
description="SETools MCP server — exposes setools policy analysis as MCP tools.")
parser.add_argument("--policy", metavar="PATH", help="Default SELinux policy file to analyze.")
parser.add_argument("--transport", choices=["stdio", "sse"], default="stdio",
help="MCP transport to use (default: stdio).")
parser.add_argument("--transport", choices=["stdio", "http"], default="stdio",
help="MCP transport to use (stdio, http, default: stdio).")
parser.add_argument("--host", default="127.0.0.1",
help="Bind host for SSE transport (default: 127.0.0.1).")
help="Bind host for HTTP transport (default: 127.0.0.1).")
parser.add_argument("--port", type=int, default=8000,
help="Bind port for SSE transport (default: 8000).")
help="Bind port for HTTP transport (default: 8000).")
parser.add_argument("-v", "--verbose", action="store_true",
help="Print extra informational messages")
parser.add_argument("--debug", action="store_true", dest="debug", help="Enable debugging.")
Expand Down
5 changes: 3 additions & 2 deletions setools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@

# Python classes for policy representation
from .policyrep import SELinuxPolicy, BoundsRuletype, ConstraintRuletype, DefaultRuletype, \
DefaultRangeValue, DefaultValue, FSUseRuletype, HandleUnknown, IbpkeyconRange, MLSRuletype, \
NodeconIPVersion, PolicyTarget, PortconProtocol, RBACRuletype, TERuletype
DefaultRangeValue, DefaultValue, FileContexts, FileContextsFiletype, FSUseRuletype, \
HandleUnknown, IbpkeyconRange, MLSRuletype, NodeconIPVersion, PolicyTarget, PortconProtocol, \
RBACRuletype, TERuletype

# Policy representation classes for type checking purposes. Few can be instantiated
# outside of this library.
Expand Down
12 changes: 12 additions & 0 deletions setools/exception.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,12 @@ class InvalidDefaultRange(InvalidSymbol):
#
# Other exceptions
#
class InvalidContext(ValueError, PolicyrepException):

"""Exception for invalid contexts."""
pass


class NoCommon(AttributeError, PolicyrepException):

"""
Expand All @@ -281,6 +287,12 @@ class NoDefaults(InvalidSymbol):
pass


class NoFileContextsMatch(ValueError):

"""Exception when a path does not match any file context entries."""
pass


class RuleNotConditional(AttributeError, PolicyrepException):

"""
Expand Down
Loading