Skip to content

Conversation

@natsirtguy
Copy link
Contributor

Adds a configurable --timeout / -t flag for MCP server initialization timeout.

Default is 30 seconds. Useful when connecting to slow-starting servers.

Changes

  • Added FlagTimeout/FlagTimeoutShort constants and InitTimeout variable in root.go
  • Added timeout flag parsing in utils.go and call.go
  • Used in CreateClientFunc() for initialization timeout
  • Added unit tests

Usage

mcp call --timeout 60 ...  # 60 second timeout
mcp call -t 10 ...         # 10 second timeout

@natsirtguy
Copy link
Contributor Author

Fixed lint issues introduced by this PR (gofmt formatting, empty-block).

Note: The golangci-lint CI check was already failing on main/master before this PR (see run 19383105784). This PR actually reduces the total issue count from 11 to 8 by fixing formatting issues in files I touched.

The remaining 8 issues are pre-existing in the codebase (goconst in web.go, gocritic in new.go, gocyclo in call.go, gofmt in transport_test.go, revive in test_helpers.go).

Adds a configurable timeout for MCP server initialization:
- Default remains 10 seconds (matching current behavior)
- Can be set via --timeout or -t flag
- Includes tests for timeout flag parsing
@natsirtguy
Copy link
Contributor Author

I rebased onto the commit that fixes the pre-existing linting issues, so should be good to go now.

I also changed the default back to 10 seconds to maintain behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant