pwndoc-mcp-server 1.0.8__py3-none-any.whl

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,87 @@
1
+ """
2
+ PwnDoc MCP Server
3
+
4
+ Model Context Protocol server for PwnDoc penetration testing documentation.
5
+ """
6
+
7
+ # CRITICAL: Suppress ALL output to stdout during module initialization
8
+ # MCP protocol requires stdout to ONLY contain JSON-RPC messages
9
+ import logging
10
+ import os
11
+ import sys
12
+ import warnings
13
+
14
+ # Suppress ALL warnings that could leak to stdout
15
+ warnings.filterwarnings("ignore")
16
+
17
+ # Configure logging to stderr BEFORE anything else
18
+ logging.basicConfig(
19
+ level=logging.CRITICAL, # Only CRITICAL and above (basically nothing)
20
+ format="%(asctime)s - %(name)s - %(levelname)s - %(message)s",
21
+ stream=sys.stderr,
22
+ force=True,
23
+ )
24
+
25
+ # Temporarily redirect stdout to /dev/null during imports
26
+ _original_stdout = sys.stdout
27
+ _devnull = open(os.devnull, "w")
28
+ sys.stdout = _devnull
29
+
30
+ try:
31
+ from pwndoc_mcp_server.version import get_version
32
+
33
+ __version__ = get_version()
34
+ __author__ = "Walid Faour"
35
+
36
+ # Export main classes and functions
37
+ from pwndoc_mcp_server.client import (
38
+ AuthenticationError,
39
+ NotFoundError,
40
+ PwnDocClient,
41
+ PwnDocError,
42
+ RateLimitError,
43
+ )
44
+ from pwndoc_mcp_server.config import (
45
+ Config,
46
+ get_config_path,
47
+ init_config_interactive,
48
+ load_config,
49
+ save_config,
50
+ )
51
+ from pwndoc_mcp_server.logging_config import LogLevel, get_logger, setup_logging
52
+ from pwndoc_mcp_server.server import (
53
+ TOOL_DEFINITIONS,
54
+ PwnDocMCPServer,
55
+ create_server,
56
+ get_tool_definitions,
57
+ )
58
+ finally:
59
+ # ALWAYS restore stdout
60
+ sys.stdout = _original_stdout
61
+ _devnull.close()
62
+
63
+ __all__ = [
64
+ # Version
65
+ "__version__",
66
+ # Config
67
+ "Config",
68
+ "get_config_path",
69
+ "init_config_interactive",
70
+ "load_config",
71
+ "save_config",
72
+ # Client
73
+ "PwnDocClient",
74
+ "PwnDocError",
75
+ "AuthenticationError",
76
+ "RateLimitError",
77
+ "NotFoundError",
78
+ # Server
79
+ "PwnDocMCPServer",
80
+ "TOOL_DEFINITIONS",
81
+ "get_tool_definitions",
82
+ "create_server",
83
+ # Logging
84
+ "LogLevel",
85
+ "setup_logging",
86
+ "get_logger",
87
+ ]