Documentation
¶
Overview ¶
Package mcpserver contains the BuildPulse MCP server implementation shared by the stdio (cmd/mcp) and remote / Streamable HTTP (cmd/mcp-remote) transports.
The transports differ in how they're wired up — stdio reads BUILDPULSE_TOKEN from the process env at startup, the remote server extracts a per-session token from the inbound HTTP Authorization header — but the tool, prompt, and resource surface is identical. Keeping the surface in one place is what makes it possible for the stdio binary and the hosted server to evolve together without drifting.
Index ¶
Constants ¶
const (
// DefaultPlatformURL is the production base URL.
DefaultPlatformURL = "https://platform.buildpulse.io"
)
Variables ¶
var ServerImplementation = &mcp.Implementation{ Name: "buildpulse", Title: "BuildPulse", Version: Version, }
ServerImplementation is the MCP `Implementation` block advertised to clients on initialize. Same metadata regardless of transport so the stdio binary and the hosted server feel like one product to the model.
var Version = "0.0.0-dev"
Version is the MCP server's semver. It is overridden at build time by the release workflow via `-ldflags "-X .../mcpserver.Version=..."` — note it MUST be a `var`, not a `const`, for the linker to overwrite. Defaults to "0.0.0-dev" for local `go run`.
Functions ¶
func CoverageColor ¶
CoverageColor mirrors badges.go coverage thresholds.
func FlakinessColor ¶
FlakinessColor maps a flakiness percentage to a human-readable color label, matching the badge color thresholds in internal/handler/badges.go.
func New ¶
New constructs a fully-registered MCP server bound to the supplied platform API client. Used by both cmd/mcp (stdio) and cmd/mcp-remote (Streamable HTTP).
Adding a new tool, prompt, or resource means editing one of the register* functions here — both transports pick it up for free.
The instructions and tool descriptions state what BuildPulse does and never compare it with other products ("faster", "cheaper", "2x", "half the cost"). The claim was also tried on its own, as "twice as fast at half the cost" with no provider named (#83); the scan flagged that too, so it stays out. Plugin directories scan this text and reject comparative or preferential claims; OpenAI's did, first on the "2x faster at half the cost" sentence and then on get_runner_usage describing its GitHub list-price fields. The comparison fields still come back in the tool response as numbers; the descriptions here just do not make the comparison themselves.
func PercentFromBadgeSVG ¶
func ValidateHostedPlatformURL ¶
ValidateHostedPlatformURL is the mcp-remote startup gate: outbound calls may only target the production or development Platform API.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a thin HTTP client over the BuildPulse Platform API, scoped to a single API token. Safe for concurrent use.
func NewClient ¶
NewClient builds a Client.
`baseURL` may be empty, in which case DefaultPlatformURL is used. Any trailing slash on baseURL is trimmed.
func (*Client) Get ¶
Get performs an authenticated GET against the platform API. The path must start with "/api". Returns the body bytes and Content-Type.
func (*Client) WebURL ¶
WebURL returns a best-effort link into the BuildPulse web UI for a given path. It derives the web host from the platform API host by dropping the leading "platform." label, so it tracks whatever PLATFORM_API_URL points at:
https://platform.buildpulse.io -> https://buildpulse.io https://platform.dev.buildpulse.io -> https://dev.buildpulse.io
Previously this mapped platform.* -> app.*, but app.buildpulse.io is the legacy Rails app being retired — it never served these new-app routes (/repos/<uuid>, /flaky-tests, ...). The new web app is served at the apex (prod) / dev host, which is also the app2.* deprecation target. Used by tool outputs to give the model a deep-link to send back to the user.
type PlanLimitError ¶
type PlanLimitError struct {
// Message is the human-readable explanation supplied by platform-api.
Message string
// UpgradeURL is a deep link to upgrade the plan, supplied by platform-api.
UpgradeURL string
}
PlanLimitError is returned by the client when a data-read endpoint responds with HTTP 402 and the documented plan_limit_exceeded body. It signals that the caller's BuildPulse organization is over its enforced monthly test-result limit, so platform-api is restricting READ access to data. Ingestion is never affected — every test result is still recorded.
MCP does NOT compute entitlement itself: the decision to enforce is made entirely upstream in platform-api. This error is purely a typed carrier for the 402 so that tool handlers can translate it into a friendly, non-error tool result (see overageAware in tools.go) instead of leaking a raw HTTP 402 or a stack trace to the model.
func (*PlanLimitError) Error ¶
func (e *PlanLimitError) Error() string
type PlanRequiredError ¶
PlanRequiredError carries platform-api's 403 plan_required body: the token works, the organization's plan does not include the API. Tool handlers turn it into a friendly result (overageAware) that says what unlocks access.
func (*PlanRequiredError) Error ¶
func (e *PlanRequiredError) Error() string