braid-mcp 0.1.0__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.
braid_mcp/__init__.py ADDED
@@ -0,0 +1,182 @@
1
+ """braid-mcp:MCP 客户端。
2
+
3
+ 本包只依赖 ``braid-ai``(内容块类型与取消令牌),不依赖 ``braid-agent`` 与
4
+ ``braid-coding-agent``——MCP 工具接入 Agent 循环的适配层属于使用方。
5
+ """
6
+
7
+ from __future__ import annotations
8
+
9
+ from braid_mcp.client import (
10
+ DEFAULT_REQUEST_TIMEOUT_MS,
11
+ McpClient,
12
+ McpClientOptions,
13
+ McpRequestOptions,
14
+ RequestContext,
15
+ )
16
+ from braid_mcp.content import LlmContent, block_to_llm_content, to_llm_content
17
+ from braid_mcp.oauth import (
18
+ AuthorizationDiscovery,
19
+ AuthorizationServerMetadata,
20
+ ClientRegistration,
21
+ OAuthError,
22
+ OAuthTokenProvider,
23
+ ResourceMetadata,
24
+ StoredAuthorization,
25
+ TokenSet,
26
+ TokenStore,
27
+ build_authorization_url,
28
+ create_pkce_pair,
29
+ discover,
30
+ exchange_authorization_code,
31
+ refresh_access_token,
32
+ register_client,
33
+ token_store,
34
+ well_known_url,
35
+ )
36
+ from braid_mcp.protocol import (
37
+ JSON_RPC_ERROR_CODES,
38
+ JsonRpcErrorObject,
39
+ JsonRpcId,
40
+ JsonRpcMessage,
41
+ JsonRpcNotification,
42
+ JsonRpcRequest,
43
+ JsonRpcResponse,
44
+ McpAbortError,
45
+ McpConnectionClosedError,
46
+ McpError,
47
+ McpTimeoutError,
48
+ message_to_wire,
49
+ parse_json_rpc_message,
50
+ )
51
+ from braid_mcp.transports.base import (
52
+ DEFAULT_MAX_MESSAGE_BYTES,
53
+ McpTransport,
54
+ ProtocolVersionAware,
55
+ SendOptions,
56
+ TransportEvents,
57
+ )
58
+ from braid_mcp.transports.http import (
59
+ DEFAULT_HTTP_TIMEOUT_MS,
60
+ HttpAuth,
61
+ McpAuthRequiredError,
62
+ McpSessionExpiredError,
63
+ McpTransportError,
64
+ StreamableHttpTransport,
65
+ StreamableHttpTransportOptions,
66
+ )
67
+ from braid_mcp.transports.sse import SseTransport, SseTransportOptions
68
+ from braid_mcp.transports.stdio import StdioTransport, StdioTransportOptions
69
+ from braid_mcp.transports.websocket import WebSocketTransport, WebSocketTransportOptions
70
+ from braid_mcp.types import (
71
+ LATEST_PROTOCOL_VERSION,
72
+ SUPPORTED_PROTOCOL_VERSIONS,
73
+ AudioBlock,
74
+ BlobResourceContents,
75
+ CallToolResult,
76
+ ClientCapabilities,
77
+ ContentBlock,
78
+ EmbeddedResourceBlock,
79
+ GetPromptResult,
80
+ ImageBlock,
81
+ Implementation,
82
+ InitializeResult,
83
+ McpPrompt,
84
+ McpPromptArgument,
85
+ McpResource,
86
+ McpResourceTemplate,
87
+ McpTool,
88
+ PromptMessage,
89
+ ReadResourceResult,
90
+ ResourceLinkBlock,
91
+ Root,
92
+ ServerCapabilities,
93
+ TextBlock,
94
+ TextResourceContents,
95
+ ToolAnnotations,
96
+ )
97
+
98
+ __version__ = "0.1.0"
99
+
100
+ __all__ = [
101
+ "DEFAULT_HTTP_TIMEOUT_MS",
102
+ "DEFAULT_MAX_MESSAGE_BYTES",
103
+ "DEFAULT_REQUEST_TIMEOUT_MS",
104
+ "JSON_RPC_ERROR_CODES",
105
+ "LATEST_PROTOCOL_VERSION",
106
+ "SUPPORTED_PROTOCOL_VERSIONS",
107
+ "AudioBlock",
108
+ "AuthorizationDiscovery",
109
+ "AuthorizationServerMetadata",
110
+ "BlobResourceContents",
111
+ "CallToolResult",
112
+ "ClientCapabilities",
113
+ "ClientRegistration",
114
+ "ContentBlock",
115
+ "EmbeddedResourceBlock",
116
+ "GetPromptResult",
117
+ "HttpAuth",
118
+ "ImageBlock",
119
+ "Implementation",
120
+ "InitializeResult",
121
+ "JsonRpcErrorObject",
122
+ "JsonRpcId",
123
+ "JsonRpcMessage",
124
+ "JsonRpcNotification",
125
+ "JsonRpcRequest",
126
+ "JsonRpcResponse",
127
+ "LlmContent",
128
+ "McpAbortError",
129
+ "McpAuthRequiredError",
130
+ "McpClient",
131
+ "McpClientOptions",
132
+ "McpConnectionClosedError",
133
+ "McpError",
134
+ "McpPrompt",
135
+ "McpPromptArgument",
136
+ "McpRequestOptions",
137
+ "McpResource",
138
+ "McpResourceTemplate",
139
+ "McpSessionExpiredError",
140
+ "McpTimeoutError",
141
+ "McpTool",
142
+ "McpTransport",
143
+ "McpTransportError",
144
+ "OAuthError",
145
+ "OAuthTokenProvider",
146
+ "PromptMessage",
147
+ "ProtocolVersionAware",
148
+ "ReadResourceResult",
149
+ "RequestContext",
150
+ "ResourceLinkBlock",
151
+ "ResourceMetadata",
152
+ "Root",
153
+ "SendOptions",
154
+ "ServerCapabilities",
155
+ "SseTransport",
156
+ "SseTransportOptions",
157
+ "StdioTransport",
158
+ "StdioTransportOptions",
159
+ "StoredAuthorization",
160
+ "StreamableHttpTransport",
161
+ "StreamableHttpTransportOptions",
162
+ "TextBlock",
163
+ "TextResourceContents",
164
+ "TokenSet",
165
+ "TokenStore",
166
+ "ToolAnnotations",
167
+ "TransportEvents",
168
+ "WebSocketTransport",
169
+ "WebSocketTransportOptions",
170
+ "block_to_llm_content",
171
+ "build_authorization_url",
172
+ "create_pkce_pair",
173
+ "discover",
174
+ "exchange_authorization_code",
175
+ "message_to_wire",
176
+ "parse_json_rpc_message",
177
+ "refresh_access_token",
178
+ "register_client",
179
+ "to_llm_content",
180
+ "token_store",
181
+ "well_known_url",
182
+ ]