-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathproxy.py
More file actions
executable file
·111 lines (106 loc) · 3.03 KB
/
Copy pathproxy.py
File metadata and controls
executable file
·111 lines (106 loc) · 3.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#!/usr/bin/env python3
"""MCPTap — transparent LLM proxy for the OpenAI Responses API.
This is the entry-point script; all logic lives in the ``mcptap`` package.
to see logs:
journalctl --user -u mcptap.service -f
for DEBUG level:
journalctl --user -u mcptap.service -p debug -f
"""
from mcptap.app import build_app, health, main, proxy
from mcptap.file_block import blocklist_file_path, clear_blocklist, write_blocklist
from mcptap.log_api import handle_log_detail, handle_logs_list, serve_logs_page
from mcptap.log_store import TIME_RANGE_MAP, TIME_RANGES, LogStore, record_from_response
from mcptap.mcp_intercept import (
InterceptedTool,
MCPInterceptor,
load_intercept_config,
serialize_mcp_result,
)
from mcptap.responses import (
apply_tool_call_updates,
build_hook_error_response,
build_sse_from_response,
build_synthetic_get_goal_response,
build_synthetic_tool_response,
extract_client_tool_calls,
extract_get_goal_result,
extract_intercepted_calls,
extract_usage_details,
extract_usage_total_tokens,
has_client_tool_calls,
has_intercepted_calls,
iter_function_calls,
re_serialize_response,
response_json_from_sse,
strip_synthetic_get_goal,
)
from mcptap.session import SessionTracker, uuid_v7_timestamp
from mcptap.settings import (
COMMUNICATION_LOGGER,
DEBUG_PAYLOAD_KEYS,
HOP_BY_HOP_HEADERS,
LOGGER,
PROVIDER_OPENROUTER,
PROVIDER_REQUESTY,
SENSITIVE_HEADER_NAMES,
SYNTHETIC_GET_GOAL_CALL_ID,
SYNTHETIC_GET_GOAL_TOOL_NAME,
settings,
)
from mcptap.tool_hook import PendingState, ToolHookGateway
from mcptap.upstream import forward_rewritten, passthrough, post_upstream_buffered
__all__ = [
"InterceptedTool",
"MCPInterceptor",
"PendingState",
"SessionTracker",
"ToolHookGateway",
"build_app",
"health",
"main",
"proxy",
"settings",
"LOGGER",
"COMMUNICATION_LOGGER",
"PROVIDER_OPENROUTER",
"PROVIDER_REQUESTY",
"SYNTHETIC_GET_GOAL_CALL_ID",
"SYNTHETIC_GET_GOAL_TOOL_NAME",
"HOP_BY_HOP_HEADERS",
"SENSITIVE_HEADER_NAMES",
"DEBUG_PAYLOAD_KEYS",
"blocklist_file_path",
"clear_blocklist",
"write_blocklist",
"load_intercept_config",
"serialize_mcp_result",
"apply_tool_call_updates",
"build_hook_error_response",
"build_sse_from_response",
"build_synthetic_get_goal_response",
"build_synthetic_tool_response",
"extract_client_tool_calls",
"extract_get_goal_result",
"extract_intercepted_calls",
"extract_usage_total_tokens",
"has_client_tool_calls",
"has_intercepted_calls",
"iter_function_calls",
"re_serialize_response",
"response_json_from_sse",
"strip_synthetic_get_goal",
"uuid_v7_timestamp",
"forward_rewritten",
"passthrough",
"post_upstream_buffered",
"LogStore",
"TIME_RANGE_MAP",
"TIME_RANGES",
"record_from_response",
"extract_usage_details",
"handle_log_detail",
"handle_logs_list",
"serve_logs_page",
]
if __name__ == "__main__":
main()