Skip to main content
Glama
Cybersyn Financial MCP Server

Cybersyn Financial MCP Server

by nilabja9

Cybersyn Financial MCP Server

A Model Context Protocol (MCP) server for financial data analysis using the Cybersyn Public Data Free dataset stored in DuckDB. This server enables Claude Desktop to query SEC filings, stock prices, company data, and economic indicators.

Features

  • SEC Analysis: Query financial metrics, filings, institutional holdings, and insider trading

  • Stock Data: Historical OHLCV prices and security identifiers

  • Company Research: Search companies, explore corporate structures, access earnings transcripts

  • Economic Data: Federal Reserve data, Treasury yields, inflation metrics, and economic indicators

  • Safety: Read-only database access with query validation

Related MCP server: Universal DB MCP

Prerequisites

  • Python 3.10+

  • uv (recommended) or pip

  • Cybersyn Public Data Free DuckDB database file

Installation

1. Clone the repository

git clone https://github.com/yourusername/cybersyn-financial-mcp.git
cd cybersyn-financial-mcp

2. Install dependencies

Using uv (recommended):

uv sync

Or using pip:

pip install -e .

3. Set up the database

Download the Cybersyn Public Data Free dataset and note the path to your public_data_free.duckdb file.

4. Configure environment

cp .env.example .env
# Edit .env and set DUCKDB_PATH to your database location

Claude Desktop Configuration

Add this to your claude_desktop_config.json:

{
  "mcpServers": {
    "cybersyn-financial": {
      "command": "uv",
      "args": [
        "--directory",
        "/path/to/cybersyn-financial-mcp",
        "run",
        "cybersyn-mcp"
      ],
      "env": {
        "DUCKDB_PATH": "/path/to/public_data_free.duckdb"
      }
    }
  }
}

Replace /path/to/cybersyn-financial-mcp with the actual path to this repository and /path/to/public_data_free.duckdb with your database path.

Available Tools

Metadata Tools

Tool

Description

list_tables

List available tables in the database

describe_table

Get schema information for a table

run_custom_query

Execute safe read-only SQL queries

Company Research Tools

Tool

Description

search_companies

Search by name, ticker, or CIK

get_company_details

Get comprehensive company info

get_company_relationships

Parent/subsidiary relationships

get_earnings_transcripts

Earnings call transcript data

SEC Analysis Tools

Tool

Description

get_sec_metrics

Financial metrics (Revenue, Assets, etc.)

get_sec_filings

SEC filing index (10-K, 10-Q, 8-K)

get_institutional_holdings

13F institutional holdings

get_insider_trading

Form 4 insider transactions

Stock Data Tools

Tool

Description

get_stock_prices

Historical OHLCV price data

get_stock_info

Security master data & identifiers

Economic Data Tools

Tool

Description

get_federal_reserve_data

Fed economic data

get_treasury_rates

Treasury yield data

get_inflation_data

CPI/PPI data from BLS

get_economic_indicators

GDP, unemployment, etc.

Sample Prompts

The server includes 15 sample prompts for common financial analysis tasks:

SEC Analysis

  • "Analyze Apple's financial performance for the last 4 quarters"

  • "Find recent 10-K filings for Microsoft, Google, and Amazon"

  • "Which institutions have the largest holdings in Tesla?"

  • "Show insider trading activity for NVIDIA in the past 6 months"

Stock Analysis

  • "Get daily closing prices for Amazon for the past year"

  • "Compare stock performance of Apple, Microsoft, and Google"

  • "List common stocks traded on NASDAQ"

Company Research

  • "Find semiconductor companies by name"

  • "Show the corporate structure of Alphabet Inc."

  • "Get the latest earnings transcript for Microsoft"

Economic Data

  • "Get Federal Reserve data on consumer credit"

  • "Query 10-year and 2-year Treasury yields"

  • "Show CPI inflation data for the past 3 years"

  • "Query unemployment rate trends"

Cross-Domain

  • "Comprehensive analysis of JPMorgan Chase: financials, stock, insider activity"

Usage Examples

Query SEC Metrics

Ask Claude: "What was Apple's revenue for the last 4 quarters?"

Claude will use get_sec_metrics with:

{
  "ticker": "AAPL",
  "metric_names": ["Revenues"],
  "limit": 16
}

Search Companies

Ask Claude: "Find companies in the semiconductor industry"

Claude will use search_companies with:

{
  "query": "semiconductor",
  "search_type": "name"
}

Get Stock Prices

Ask Claude: "Show me Tesla's stock price for the past month"

Claude will use get_stock_prices with:

{
  "ticker": "TSLA",
  "start_date": "2024-12-01",
  "end_date": "2024-12-31"
}

Custom SQL Query

Ask Claude: "Run a custom query to count companies by SIC code"

Claude will use run_custom_query with:

{
  "query": "SELECT sic_code, sic_code_description, COUNT(*) as count FROM SEC_CIK_INDEX GROUP BY sic_code, sic_code_description ORDER BY count DESC LIMIT 20"
}

Safety Features

  • Read-only mode: Database opened with read_only=True

  • Query validation: Blocks DROP, DELETE, INSERT, UPDATE, ALTER, CREATE

  • Row limits: Maximum 10,000 rows per query

  • Parameter sanitization: All user inputs are validated

Testing

Run the test script

export DUCKDB_PATH=/path/to/public_data_free.duckdb
python scripts/test_server.py

Run pytest tests

uv run pytest tests/ -v

Project Structure

cybersyn-financial-mcp/
├── pyproject.toml                 # Project config & dependencies
├── README.md                      # This file
├── LICENSE                        # MIT License
├── .env.example                   # Example env config
├── src/
│   └── cybersyn_mcp/
│       ├── __init__.py
│       ├── server.py              # Main MCP server
│       ├── database.py            # DuckDB connection management
│       ├── tools/
│       │   ├── __init__.py
│       │   ├── sec_tools.py       # SEC filings & metrics
│       │   ├── stock_tools.py     # Stock prices
│       │   ├── company_tools.py   # Company research
│       │   ├── economic_tools.py  # Economic indicators
│       │   └── metadata_tools.py  # Schema/custom queries
│       ├── resources/
│       │   └── schemas.py         # Table schema resources
│       └── prompts/
│           └── financial_prompts.py
├── tests/
│   ├── conftest.py
│   ├── test_database.py
│   ├── test_sec_tools.py
│   ├── test_stock_tools.py
│   ├── test_company_tools.py
│   └── test_economic_tools.py
└── scripts/
    └── test_server.py             # Manual testing

Key Tables

SEC Data

  • SEC_METRICS_TIMESERIES - Financial metrics from filings

  • SEC_CORPORATE_REPORT_INDEX - Filing index

  • SEC_13F_INDEX - 13F institutional holdings

  • SEC_INSIDER_TRADING_SECURITIES_INDEX - Insider trading

Stock Data

  • STOCK_PRICE_TIMESERIES - Historical prices

  • OPENFIGI_SECURITY_INDEX - Security identifiers

Company Data

  • SEC_CIK_INDEX - CIK lookup with SIC codes

  • COMPANY_RELATIONSHIPS - Corporate structure

  • COMPANY_EVENT_TRANSCRIPT_ATTRIBUTES - Earnings transcripts

Economic Data

  • FEDERAL_RESERVE_TIMESERIES - Fed data

  • US_TREASURY_TIMESERIES - Treasury rates

  • BUREAU_OF_LABOR_STATISTICS_PRICE_TIMESERIES - CPI/PPI

  • FINANCIAL_ECONOMIC_INDICATORS_TIMESERIES - GDP, unemployment

License

MIT License - see LICENSE file for details.

Acknowledgments

  • Cybersyn for the Public Data Free dataset

  • Anthropic for the MCP protocol and Claude

  • DuckDB for the excellent embedded database

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      D
      maintenance
      Provides Claude Desktop with secure access to multiple database connections, allowing users to query MySQL, PostgreSQL, SQLite, and SQL Server databases directly through natural language.
      -
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables Claude Desktop to interact with MySQL, PostgreSQL, and Redis databases using natural language for data querying and schema analysis. It provides a secure interface with a default read-only mode to prevent unauthorized database modifications.
      259 npm
      945
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables natural language interaction with local SQLite databases through Claude Desktop, translating plain English queries into SQL for data analysis and exploration.
      3
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables executing SQL queries on DuckDB databases locally or on MotherDuck cloud, with support for multiple databases, read-only mode, and Claude Desktop integration.
      MIT