mcpserver

package
v0.0.0-...-014aa27 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 22, 2026 License: MIT Imports: 18 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

View Source
const (
	// DefaultPlatformURL is the production base URL.
	DefaultPlatformURL = "https://platform.buildpulse.io"
)

Variables

View Source
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.

View Source
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

func CoverageColor(pct float64) string

CoverageColor mirrors badges.go coverage thresholds.

func FlakinessColor

func FlakinessColor(pct float64) string

FlakinessColor maps a flakiness percentage to a human-readable color label, matching the badge color thresholds in internal/handler/badges.go.

func New

func New(client *Client) *mcp.Server

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 PercentFromBadgeSVG(svg []byte) float64

func ValidateHostedPlatformURL

func ValidateHostedPlatformURL(raw string) error

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

func NewClient(baseURL, token string) *Client

NewClient builds a Client.

`baseURL` may be empty, in which case DefaultPlatformURL is used. Any trailing slash on baseURL is trimmed.

func (*Client) BaseURL

func (c *Client) BaseURL() string

BaseURL returns the configured platform API base URL.

func (*Client) Get

func (c *Client) Get(ctx context.Context, path string, params url.Values) ([]byte, string, error)

Get performs an authenticated GET against the platform API. The path must start with "/api". Returns the body bytes and Content-Type.

func (*Client) GetJSON

func (c *Client) GetJSON(ctx context.Context, path string, params url.Values, out any) error

GetJSON performs Get and unmarshals into `out`.

func (*Client) WebURL

func (c *Client) WebURL(path string) string

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

type PlanRequiredError struct {
	Message    string
	UpgradeURL string
}

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL