Skip to main content

Stock research MCP server

examples/go-stock-research-mcp is a paid MCP server with six research tools. It is a port of the Python stock research example: same tools, same recorded market data, same environment, so you can compare the two servers call for call. It is educational market research, not financial advice. It shows:
  • NewMCPServer with customer sign-in through SolvaPay over OAuth.
  • Six tools registered with RegisterPayable. Each call is checked against the customer’s plan, and billed as one unit when it succeeds.
  • SolvaPay’s account and activate_plan tools, the checkout widget and its prompts, added by NewMCPServer.
  • Tests that run the tools against a fake SolvaPay API and recorded data, with no keys or network.

Run it

Prerequisites

  • Go 1.26 or later
  • A sandbox secret key and a product with an active plan. See Installation.
  • ngrok or another tunnel
1

Configure

From examples/go-stock-research-mcp, copy the template and fill it in:
.env
MARKET_DATA=fixtures serves the recorded market data instead of calling the live APIs.
2

Start a tunnel

Put the tunnel’s URL in PUBLIC_BASE_URL. It must be the URL clients use, because it is the OAuth issuer they see. See Set PublicBaseURL.
3

Start the server

The MCP endpoint is http://localhost:3031/mcp.
4

Connect a client

Add https://<your-tunnel>.ngrok.app/mcp to an MCP client as a remote server. The client opens SolvaPay’s sign-in, then can call the tools.
Run the tests with go test ./....

Use a published version of the SDK

The example’s go.mod replaces the SDK with the repository’s own go/ module, so it always builds against the code next to it:
go.mod
To build it against a published release instead, for example after copying the example out of the repository, drop the replace and the placeholder v0.0.0 requirement, then get a version:
Drop the requirement too: v0.0.0 was never published, so go get fails while go.mod still names it.

More examples