mcp

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: May 1, 2026 License: MIT Imports: 15 Imported by: 0

README

MCP Adapter Boundary

internal/mcp implements the read-only MCP request handling over SQLite. Stdio is the default transport; HTTP mode is a minimal private-pilot transport wrapper around the same request handler.

Rules:

  • read from the SQLite store surfaces; do not call Gong directly
  • keep tools read-only
  • require --db at the cmd/gongmcp boundary
  • support MCP tool presets and allowlisting through gongmcp --tool-preset, GONGMCP_TOOL_PRESET, --tool-allowlist, or GONGMCP_TOOL_ALLOWLIST; when unset, stdio serves the full read-only catalog
  • require an explicit preset or allowlist for all HTTP deployments
  • support private AI governance suppression through --ai-governance-config or GONGMCP_AI_GOVERNANCE_CONFIG; do not expose configured restricted names in MCP output, do not expose filtered-match counts, and require an explicit governance-compatible tool preset or allowlist
  • keep browser/session auth separate from agent-client auth
  • do not expose raw Gong API passthrough, arbitrary SQL, profile import, raw cached call JSON, or full transcript dumps
  • return transcript snippets only, not full transcript bodies
  • use search_transcripts_by_call_facts for scoped transcript evidence by date, lifecycle, scope, system, or direction; it may return bounded neighboring-segment excerpts, but must not return call IDs, titles, speaker IDs, or full transcript text
  • use search_transcript_quotes_with_attribution when business users need bounded quote evidence with available Account/Opportunity attribution; call IDs, call titles, Account names/websites, and Opportunity names/close dates/probabilities require explicit opt-in flags, and person/contact titles must be reported as unavailable when not present in the cache
  • redact call IDs and speaker IDs from transcript segment search by default; exact identifiers require explicit opt-in flags
  • keep profile-aware tools tied to imported SQLite profile state
  • return lifecycle source and profile provenance when profile-aware behavior is used
  • keep unmapped CRM field output redacted by default
  • treat search_crm_field_values as an explicit, bounded value lookup exception; call IDs are redacted unless include_call_ids=true, object IDs and names are always redacted, and value snippets plus call titles require include_value_snippets=true
  • serve profile-aware fact/lifecycle queries from the SQLite profile cache keyed by active profile and canonical hash; writable CLI commands warm it, and read-only MCP reports stale cache state instead of writing
  • keep summarize_call_facts on safe business grouping dimensions; directed CRM value lookup belongs in search_crm_field_values

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Request

type Request struct {
	JSONRPC string          `json:"jsonrpc"`
	ID      any             `json:"id"`
	Method  string          `json:"method"`
	Params  json.RawMessage `json:"params,omitempty"`
}

type Server

type Server struct {
	// contains filtered or unexported fields
}

func NewServer

func NewServer(store Store, name, version string) *Server

func NewServerWithOptions

func NewServerWithOptions(store Store, name, version string, opts ...ServerOption) *Server

func (*Server) Handle

func (s *Server) Handle(ctx context.Context, req Request) *response

func (*Server) Serve

func (s *Server) Serve(ctx context.Context, r io.Reader, w io.Writer) error

func (*Server) ServeHTTP added in v0.3.0

func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

type ServerOption

type ServerOption func(*Server)

func WithGovernanceCheck added in v0.3.0

func WithGovernanceCheck(check func(context.Context) error) ServerOption

func WithSuppressedCallIDs added in v0.3.0

func WithSuppressedCallIDs(callIDs []string) ServerOption

func WithToolAllowlist

func WithToolAllowlist(names []string) ServerOption

type Store

type Store interface {
	SyncStatusSummary(ctx context.Context) (*sqlite.SyncStatusSummary, error)
	SearchCallsRaw(ctx context.Context, params sqlite.CallSearchParams) ([]json.RawMessage, error)
	GetCallDetail(ctx context.Context, callID string) (*sqlite.CallDetail, error)
	ListCRMObjectTypes(ctx context.Context) ([]sqlite.CRMObjectTypeSummary, error)
	ListCRMFields(ctx context.Context, objectType string, limit int) ([]sqlite.CRMFieldSummary, error)
	SearchCRMFieldValues(ctx context.Context, params sqlite.CRMFieldValueSearchParams) ([]sqlite.CRMFieldValueMatch, error)
	ListCRMIntegrations(ctx context.Context) ([]sqlite.CRMIntegrationRecord, error)
	ListCRMSchemaObjects(ctx context.Context, integrationID string) ([]sqlite.CRMSchemaObjectRecord, error)
	ListCRMSchemaFields(ctx context.Context, params sqlite.CRMSchemaFieldListParams) ([]sqlite.CRMSchemaFieldRecord, error)
	ListGongSettings(ctx context.Context, params sqlite.GongSettingListParams) ([]sqlite.GongSettingRecord, error)
	ListScorecards(ctx context.Context, params sqlite.ScorecardListParams) ([]sqlite.ScorecardSummary, error)
	GetScorecardDetail(ctx context.Context, scorecardID string) (*sqlite.ScorecardDetail, error)
	ActiveBusinessProfile(ctx context.Context) (*sqlite.BusinessProfile, error)
	ListBusinessConcepts(ctx context.Context) ([]sqlite.BusinessConcept, error)
	ListUnmappedCRMFields(ctx context.Context, params sqlite.UnmappedCRMFieldParams) ([]sqlite.UnmappedCRMField, error)
	AnalyzeLateStageSignals(ctx context.Context, params sqlite.LateStageSignalParams) (*sqlite.LateStageSignalsReport, error)
	ListOpportunitiesMissingTranscripts(ctx context.Context, params sqlite.OpportunityMissingTranscriptParams) ([]sqlite.OpportunityMissingTranscriptSummary, error)
	SearchTranscriptSegmentsByCRMContext(ctx context.Context, params sqlite.TranscriptCRMSearchParams) ([]sqlite.TranscriptCRMSearchResult, error)
	SummarizeOpportunityCalls(ctx context.Context, params sqlite.OpportunityCallSummaryParams) ([]sqlite.OpportunityCallSummary, error)
	CRMFieldPopulationMatrix(ctx context.Context, params sqlite.CRMFieldPopulationMatrixParams) (*sqlite.CRMFieldPopulationMatrix, error)
	ListLifecycleBucketDefinitions(ctx context.Context) ([]sqlite.LifecycleBucketDefinition, error)
	ListLifecycleBucketDefinitionsWithSource(ctx context.Context, requested string) ([]sqlite.LifecycleBucketDefinition, *sqlite.ProfileQueryInfo, error)
	SummarizeCallsByLifecycle(ctx context.Context, params sqlite.LifecycleSummaryParams) ([]sqlite.LifecycleBucketSummary, error)
	SummarizeCallsByLifecycleWithSource(ctx context.Context, params sqlite.LifecycleSummaryParams) ([]sqlite.LifecycleBucketSummary, *sqlite.ProfileQueryInfo, error)
	SearchCallsByLifecycle(ctx context.Context, params sqlite.LifecycleCallSearchParams) ([]sqlite.LifecycleCallSearchResult, error)
	SearchCallsByLifecycleWithSource(ctx context.Context, params sqlite.LifecycleCallSearchParams) ([]sqlite.LifecycleCallSearchResult, *sqlite.ProfileQueryInfo, error)
	PrioritizeTranscriptsByLifecycle(ctx context.Context, params sqlite.LifecycleTranscriptPriorityParams) ([]sqlite.LifecycleTranscriptPriority, error)
	PrioritizeTranscriptsByLifecycleWithSource(ctx context.Context, params sqlite.LifecycleTranscriptPriorityParams) ([]sqlite.LifecycleTranscriptPriority, *sqlite.ProfileQueryInfo, error)
	CompareLifecycleCRMFields(ctx context.Context, params sqlite.LifecycleCRMFieldComparisonParams) (*sqlite.LifecycleCRMFieldComparison, error)
	SummarizeCallFacts(ctx context.Context, params sqlite.CallFactsSummaryParams) ([]sqlite.CallFactsSummaryRow, error)
	SummarizeCallFactsWithSource(ctx context.Context, params sqlite.CallFactsSummaryParams) ([]sqlite.CallFactsSummaryRow, *sqlite.ProfileQueryInfo, error)
	CallFactsCoverage(ctx context.Context) (*sqlite.CallFactsCoverage, error)
	SearchTranscriptSegments(ctx context.Context, query string, limit int) ([]sqlite.TranscriptSearchResult, error)
	SearchTranscriptSegmentsByCallFacts(ctx context.Context, params sqlite.TranscriptCallFactsSearchParams) ([]sqlite.TranscriptCallFactsSearchResult, error)
	SearchTranscriptQuotesWithAttribution(ctx context.Context, params sqlite.TranscriptAttributionSearchParams) ([]sqlite.TranscriptAttributionSearchResult, error)
	FindCallsMissingTranscripts(ctx context.Context, limit int) ([]sqlite.MissingTranscriptCall, error)
}

type ToolInfo

type ToolInfo struct {
	Name        string         `json:"name"`
	Description string         `json:"description"`
	InputSchema map[string]any `json:"input_schema"`
}

func FindTool

func FindTool(name string) (ToolInfo, bool)

func ToolCatalog

func ToolCatalog() []ToolInfo

Jump to

Keyboard shortcuts

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