mcp_data

package
v0.8.11 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2026 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CacheEntry

type CacheEntry struct {
	ViewName  string          `json:"view_name"`
	Dataset   string          `json:"dataset"`
	Schema    string          `json:"schema"`
	Files     []CacheFileInfo `json:"files"`
	TotalSize int64           `json:"total_size_bytes"`
}

CacheEntry describes a cached dataset/schema in the cache directory.

type CacheFileInfo

type CacheFileInfo struct {
	Filename    string   `json:"filename"`
	Symbols     []string `json:"symbols,omitempty"`
	StypeIn     string   `json:"stype_in,omitempty"`
	StypeOut    string   `json:"stype_out,omitempty"`
	Start       string   `json:"start,omitempty"`
	End         string   `json:"end,omitempty"`
	FetchedAt   string   `json:"fetched_at,omitempty"`
	RecordCount int64    `json:"record_count,omitempty"`
	Cost        float64  `json:"cost,omitempty"`
	SizeBytes   int64    `json:"size_bytes"`
}

CacheFileInfo describes a single cached parquet file and its manifest metadata.

type CacheManifest

type CacheManifest struct {
	Symbols     []string `json:"symbols"`
	StypeIn     string   `json:"stype_in"`
	StypeOut    string   `json:"stype_out"`
	Start       string   `json:"start"`
	End         string   `json:"end"`
	FetchedAt   string   `json:"fetched_at"`
	RecordCount int64    `json:"record_count"`
	Cost        float64  `json:"cost"`
}

CacheManifest is the sidecar JSON manifest written alongside each cached parquet file.

type Server

type Server struct {
	*mcp_meta.Server
	// contains filtered or unexported fields
}

Server holds state for MCP data tool handlers. It embeds *mcp_meta.Server for access to MaxCost and Logger.

func NewServer

func NewServer(config ServerConfig, logger *slog.Logger) *Server

NewServer creates a new Server with the given API key, and logger.

func (*Server) Close

func (s *Server) Close() error

Close closes the DuckDB connection.

func (*Server) GetCacheDB

func (s *Server) GetCacheDB() string

func (*Server) GetCacheDir

func (s *Server) GetCacheDir() string

func (*Server) GetMaxCost

func (s *Server) GetMaxCost() float64

func (*Server) InitCache

func (s *Server) InitCache() error

InitCache opens an in-memory DuckDB database and creates views for any existing cached parquet files.

func (*Server) RegisterDataTools

func (s *Server) RegisterDataTools(mcpServer *mcp_server.MCPServer)

RegisterDataTools registers data-specific MCP tools (fetch_range + cache tools). When ReadOnly is true, fetch_range is not registered, preventing any billing.

type ServerConfig

type ServerConfig struct {
	ApiKey   string  // Databento API key
	MaxCost  float64 // Max cost for a query
	CacheDir string  // Directory for cached data files
	CacheDB  string  // Path to DuckDB database file (reserved for future use)
	ReadOnly bool    // When true, fetch_range is disabled (no billing possible)
}

Jump to

Keyboard shortcuts

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