这是indexloc提供的服务,不要输入任何密码
Skip to content

### Pre-submission Checklist #450

@raki8963

Description

@raki8963

Pre-submission Checklist

  • I have checked that this question would not be more appropriate as an issue in a specific repository
  • I have searched existing discussions and documentation for answers

Question Category

  • Protocol Specification
  • SDK Usage
  • Server Implementation
  • General Implementation
  • Documentation
  • Other

Your Question

Hi, just dipping my toes into this and have a couple of initial questions.

I'm trying to build a standalone MCP client (no Spring boot support). Here's my code so far:

		HttpClientSseClientTransport transport = HttpClientSseClientTransport.builder(mcpFileLocation.getURI()).build();
		McpSyncClient client = McpClient.sync(transport)
			.requestTimeout(Duration.ofSeconds(30))
			.capabilities(ClientCapabilities.builder()
					.roots(true)
					.sampling()
					.build())
			.build();
		try {
			client.initialize();
			ListToolsResult tools = client.listTools();
			ListPromptsResult prompts = client.listPrompts();
			ListResourcesResult resources = client.listResources();
		} catch (McpError e) {
			SwingUtils.showError("Unable to contact server", e, this);
                        // this seems to get thrown if the URL is valid but times out,
                        // other errors seem to get swallowed in a separate thread.
		}

It seems that most low-level exceptions get logged and swallowed in separate threads, so what's the best way to catch them and feed them back to the UI?

Many thanks in advance!

Originally posted by @msepryor in #331

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions