@@ -134,83 +134,6 @@ func DefaultTransportCreator(conf *config.MCPClientConfig) (MCPClientInterface,
134
134
return nil, errors.New("invalid client type: must have either command or url")
135
135
}
136
136
137
- // AddToMCPServer connects the client to an MCP server
138
- func (c *Client) AddToMCPServer(ctx context.Context, clientInfo mcp.Implementation, mcpServer *server.MCPServer) error {
139
- return c.AddToMCPServerWithTokenCheck(ctx, clientInfo, mcpServer, "", false, nil, "", "", nil)
140
- }
141
-
142
- // AddToMCPServerWithTokenCheck connects the client to an MCP server with optional token checking
143
- func (c *Client) AddToMCPServerWithTokenCheck(
144
- ctx context.Context,
145
- clientInfo mcp.Implementation,
146
- mcpServer *server.MCPServer,
147
- userEmail string,
148
- requiresToken bool,
149
- tokenStore storage.UserTokenStore,
150
- serverName string,
151
- setupBaseURL string,
152
- tokenSetup *config.TokenSetupConfig,
153
- ) error {
154
- return c.AddToMCPServerWithSession(ctx, clientInfo, mcpServer, userEmail, requiresToken, tokenStore, serverName, setupBaseURL, tokenSetup, nil)
155
- }
156
-
157
- // AddToMCPServerWithSession connects the client to an MCP server with optional session-specific tools
158
- func (c *Client) AddToMCPServerWithSession(
159
- ctx context.Context,
160
- clientInfo mcp.Implementation,
161
- mcpServer *server.MCPServer,
162
- userEmail string,
163
- requiresToken bool,
164
- tokenStore storage.UserTokenStore,
165
- serverName string,
166
- setupBaseURL string,
167
- tokenSetup *config.TokenSetupConfig,
168
- session server.ClientSession,
169
- ) error {
170
- if c.needManualStart {
171
- err := c.client.Start(ctx)
172
- if err != nil {
173
- return err
174
- }
175
- }
176
- initRequest := mcp.InitializeRequest{}
177
- initRequest.Params.ProtocolVersion = mcp.LATEST_PROTOCOL_VERSION
178
- initRequest.Params.ClientInfo = clientInfo
179
- initRequest.Params.Capabilities = mcp.ClientCapabilities{
180
- Experimental: make(map[string]interface{}),
181
- Roots: nil,
182
- Sampling: nil,
183
- }
184
- _, err := c.client.Initialize(ctx, initRequest)
185
- if err != nil {
186
- return err
187
- }
188
- internal.Logf("<%s> Successfully initialized MCP client", c.name)
189
-
190
- // Start capability discovery
191
- internal.LogInfoWithFields("client", "Starting MCP capability discovery", map[string]interface{}{
192
- "server": c.name,
193
- })
194
-
195
- err = c.addToolsToServer(ctx, mcpServer, userEmail, requiresToken, tokenStore, serverName, setupBaseURL, tokenSetup, session)
196
- if err != nil {
197
- return err
198
- }
199
- _ = c.addPromptsToServer(ctx, mcpServer)
200
- _ = c.addResourcesToServer(ctx, mcpServer)
201
- _ = c.addResourceTemplatesToServer(ctx, mcpServer)
202
-
203
- internal.LogInfoWithFields("client", "MCP capability discovery completed", map[string]interface{}{
204
- "server": c.name,
205
- "userTokenRequired": requiresToken,
206
- })
207
-
208
- if c.needPing {
209
- go c.startPingTask(ctx)
210
- }
211
- return nil
212
- }
213
-
214
137
// startPingTask runs a goroutine that pings the MCP server every 30 seconds.
215
138
// The goroutine lifecycle is tied to the provided context:
216
139
// - For stdio clients: context is cancelled when the request ends, stopping pings
0 commit comments