Cover image
Try Now
2025-04-13

SEC EDGAR的模型上下文协议(MCP)服务器

3 years

Works with Finder

1

Github Watches

2

Github Forks

6

Github Stars

SEC EDGAR MCP

License: MIT Python: 3.9+ Platform: Windows | Mac | Linux Build Status PyPI

Disclaimer 🚨

EDGAR® and SEC® are trademarks of the U.S. Securities and Exchange Commission. This open-source project is not affiliated with or approved by the U.S. Securities and Exchange Commission.

Introduction 📣

SEC EDGAR MCP is an open-source MCP server that connects AI models to the rich dataset of SEC EDGAR filings. EDGAR (Electronic Data Gathering, Analysis, and Retrieval) is the U.S. SEC's primary system for companies to submit official filings. It contains millions of filings and "increases the efficiency, transparency, and fairness of the securities markets" by providing free public access to corporate financial information. This project makes that trove of public company data accessible to AI assistants (LLMs) for financial research, investment insights, and corporate transparency use cases.

Using the Model Context Protocol (MCP) – an open standard that "enables seamless integration between LLM applications and external data sources and tools" – the SEC EDGAR MCP server exposes a set of tools backed by the official SEC EDGAR REST API. Under the hood, it leverages the Python secedgar SDK (an unofficial wrapper for SEC's API) to fetch data like company filings and financial facts. This means an AI agent can ask questions like "What's the latest 10-K filing for Apple?" or "Show me Tesla's total revenue in 2021" and the MCP server will retrieve the answer directly from EDGAR's official data.

Usage 🚀

Once the SEC EDGAR MCP server is running, you can connect to it with any MCP-compatible client (such as an AI assistant or the MCP CLI tool). The client will discover the available EDGAR tools and can invoke them to get real-time data from SEC filings. For example, an AI assistant could use this server to fetch a company's recent filings or query specific financial metrics without manual web searching.

Demo: Here's a demonstration of an AI assistant using SEC EDGAR MCP to retrieve Apple's latest filings and financial facts (click to view the video):

In the demo above, the assistant calls the get_submissions tool with Apple's CIK and then uses get_company_concepts to fetch a specific financial concept, showcasing how EDGAR data is retrieved and presented in real-time. 📊

Installation 🛠

Follow these steps to set up and run the SEC EDGAR MCP server:

  1. Clone the repository:
git clone https://github.com/yourusername/sec-edgar-mcp.git
cd sec-edgar-mcp
  1. Install dependencies: Ensure you have Python 3.9+ installed. Install the required packages, including the MCP framework and secedgar SDK:
pip install mcp secedgar
  1. Configure SEC EDGAR API access: The SEC API requires a User-Agent string for all requests. Create a .env file in the project directory and add your user agent info:
SEC_API_USER_AGENT="Your Name (your.email@domain.com)"
PYTHONPATH=/path/to/your/local/cloned/repo/sec-edgar-mcp

This identifies your application to the SEC (replace with your details). The server will load this from the environment to authenticate to EDGAR.

  1. Start the MCP server: Launch the server to begin listening for MCP clients. For example:
mcp install sec_edgar_mcp/server.py --env-file .env --name "SEC EDGAR MCP Server" --with secedgar

Once running, the server will register its tools (see below) and await client connections. You should see logs indicating it's ready. 🎉

Now the server is up and running, ready to serve EDGAR data to any MCP client! You can use the MCP CLI or an AI platform (e.g. Claude Desktop) to connect to localhost (or the appropriate transport) and start issuing tool calls.

Tools 🔧

SEC EDGAR MCP exposes several tools (functions) from the SEC EDGAR API. These tools allow retrieval of different types of data:

  • Company Submissions – recent filings and metadata for a company (by CIK).
  • Company Concept – detailed data for a specific financial concept (XBRL tag) for a company.
  • Company Facts – all available financial facts for a company.
  • XBRL Frames – aggregated data for a financial concept across companies or time frames.

Each tool is defined with a name, description, and input parameters. AI assistants can invoke them via MCP's JSON-RPC interface. Below is a list of the tools with details and examples of how to call them (click to expand):

📁 get_submissions – Fetch a company's submissions (filings history)

Description: Returns the submission history for a given company, identified by its CIK. The response includes company info (name, ticker, etc.) and recent filings (forms, dates, report period, etc.). This is useful for getting a list of the latest filings (10-K, 10-Q, 8-K, etc.) a company has made.

Example call (MCP JSON-RPC):

{
  "jsonrpc": "2.0",
  "id": 42,
  "method": "tools/call",
  "params": {
    "name": "get_submissions",
    "arguments": { "cik": "0000320193" }
  }
}

Example response (truncated):

{
  "cik": "0000320193",
  "name": "Apple Inc.",
  "tickers": ["AAPL"],
  "exchanges": ["Nasdaq"],
  "filings": {
    "recent": {
      "form": ["10-K", "10-Q", ...],
      "filingDate": ["2023-10-26", "2023-07-27", ...],
      "reportDate": ["2023-09-30", "2023-06-30", ...],
      "primaryDocument": ["aapl-2023-10k.htm", "aapl-2023-q3.htm", ...],
      ... 
    }
  }
}

In this example, calling get_submissions for Apple (CIK 0000320193) returned a JSON with Apple's basic info and a list of its most recent 10-K and 10-Q filings (with their dates and document names, etc.).

💡 get_company_concepts – Get a specific reported concept for a company

Description: Fetches all reported values for a single financial concept (XBRL tag) for a given company. You must specify the company's CIK, the accounting taxonomy (e.g. us-gaap for U.S. GAAP financials), and the specific tag (concept name, e.g. AccountsPayableCurrent). The response includes metadata about that concept and a time-series of reported values (by year/quarter).

Example call (MCP JSON-RPC):

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "get_company_concepts",
    "arguments": { 
      "cik": "0000320193",
      "taxonomy": "us-gaap",
      "tag": "AccountsPayableCurrent"
    }
  }
}

Example response (truncated):

{
  "cik": 320193,
  "taxonomy": "us-gaap",
  "tag": "AccountsPayableCurrent",
  "label": "Accounts Payable, Current",
  "description": "The carrying value of accounts payable as of the balance sheet date.",
  "entityName": "Apple Inc.",
  "units": {
    "USD": [
      { "end": "2022-09-24", "val": 64220000000, ... },
      { "end": "2021-09-25", "val": 54763000000, ... },
      ...
    ]
  }
}

The above shows Apple's "Accounts Payable, Current" (us-gaap taxonomy) values in USD for recent year-end dates. Each entry under units -> USD includes the period end date and the value reported. This tool lets an AI retrieve specific line-items from a company's financial statements as reported in their filings.

🗃️ get_company_facts – Retrieve all facts for a company (full XBRL fact set)

Description: Returns all available XBRL facts for a given company (by CIK). This is a comprehensive dataset of that company's financial facts, including multiple taxonomies (e.g. general company info in dei, financial statements in us-gaap, etc.). The response is a nested JSON grouping facts by taxonomy and then by individual tags, with arrays of values.

Example call (MCP JSON-RPC):

{
  "jsonrpc": "2.0",
  "id": 2,
  "method": "tools/call",
  "params": {
    "name": "get_company_facts",
    "arguments": { "cik": "0000320193" }
  }
}

Example response (truncated):

{
  "cik": 320193,
  "entityName": "Apple Inc.",
  "facts": {
    "dei": {
      "EntityCommonStockSharesOutstanding": {
        "label": "Entity Common Stock, Shares Outstanding",
        "units": { "shares": [ ... ] }
      },
      "EntityPublicFloat": {
        "label": "Entity Public Float",
        "units": { "USD": [ ... ] }
      },
      ...
    },
    "us-gaap": {
      "AccountsPayableCurrent": {
        "label": "Accounts Payable, Current",
        "units": { "USD": [ { "end": "2022-09-24", "val": 64220000000 }, ... ] }
      },
      "AccountsReceivableNet": {
        "label": "Accounts Receivable, Net",
        "units": { "USD": [ ... ] }
      },
      ...
    }
  }
}

This truncated example shows the structure of get_company_facts output for Apple. It includes dei facts (like shares outstanding) and us-gaap financial facts (like Accounts Payable, Accounts Receivable, etc.), each with their values. An AI could use this to pull a range of data points from a company's filings in one call (though often it's more data than needed, so targeting a specific concept with get_company_concepts is preferable for focused questions).

🌐 get_xbrl_frames – Query XBRL "frames" (data across entities or time)

Description: Retrieves data for a given financial concept across all companies or a set time frame. In EDGAR's API, a "frame" is essentially an aggregation for a specific tag, unit, and period (for example, all companies' values for Revenue in Q1 2023). You need to specify the taxonomy, tag, unit (e.g. USD), year, and period (annual or quarter). This tool returns a list of data points from all entities that reported that concept in that period.

Example call (MCP JSON-RPC):

{
  "jsonrpc": "2.0",
  "id": 3,
  "method": "tools/call",
  "params": {
    "name": "get_xbrl_frames",
    "arguments": { 
      "taxonomy": "us-gaap",
      "tag": "AccountsPayableCurrent",
      "unit": "USD",
      "year": 2019,
      "quarter": 1
    }
  }
}

Example response (truncated):

{
  "taxonomy": "us-gaap",
  "tag": "AccountsPayableCurrent",
  "uom": "USD",
  "ccp": "CY2019Q1I",  <!-- Calendar Year 2019, Q1, Instantaneous -->
  "data": [
    {
      "cik": 1555538,
      "entityName": "SUNCOKE ENERGY PARTNERS, L.P.",
      "end": "2019-03-31",
      "val": 78300000
    },
    {
      "cik": 11199,
      "entityName": "BEMIS CO INC",
      "end": "2019-03-31",
      "val": 465700000
    },
    ... (thousands more data points) ...
  ]
}

This example asks for the value of "Accounts Payable, Current" (in USD) for Q1 2019. The result includes an array of all companies that reported that metric at the end of Q1 2019, each with their CIK, name, and value. There were many companies (in this case, the frame returned 3388 data points). This is useful for broad analyses (e.g., finding industry totals or comparing peers), though an LLM would typically filter or request a specific company's data instead of retrieving thousands of entries at once.

Note: The JSON structures above are directly returned from the SEC EDGAR API via the secedgar SDK. The MCP server does not alter the data, so you get the same fields as the official API. All tools require a valid CIK (Central Index Key) for company-specific queries – you can use the SEC's CIK lookup tool if you only know a ticker or name.

Architecture 🏗️

The SEC EDGAR MCP server acts as a middleman between an AI (MCP client) and the SEC's EDGAR backend:

  • 🔸 MCP Client: Could be an AI assistant (like Claude or GPT-4 with an MCP plugin) or any app that speaks the MCP protocol. The client sends JSON-RPC requests to invoke tools (e.g. get_submissions) and receives JSON results.

  • 🔸 MCP Server (SEC EDGAR MCP): This server (the project you are reading about) defines the EDGAR tools and handles incoming tool requests. When a request comes in, the server uses the secedgar Python SDK to call the SEC EDGAR REST API and then returns the response back over MCP.

  • 🔸 SEC EDGAR REST API: The official SEC endpoint (data.sec.gov) that provides EDGAR data in JSON format. The secedgar library communicates with this REST API, abiding by its usage policies (including rate limits and user agent identification).

How it works: The MCP client first queries the server's tool list (discovering functions like get_submissions, etc.). The AI can then decide to call a tool by name with appropriate parameters. The server receives the tools/call request, executes the corresponding EDGAR API call via secedgar, and returns the data. This response is sent back to the AI client in a structured JSON format that the AI can read and incorporate into its answer or reasoning.

In essence, SEC EDGAR MCP bridges the gap between natural language questions and the raw SEC filings data. By adhering to MCP, it standardizes the way AI models can fetch real-world financial data, using officially sourced information for accurate and up-to-date answers.

References 📚

License ⚖️

This project is licensed under the MIT License. You are free to use, modify, and distribute it. See the LICENSE file for details.


© 2025 Stefano Amorelli – Released under the MIT license. Enjoy! 🎉

相关推荐

  • Joshua Armstrong
  • Confidential guide on numerology and astrology, based of GG33 Public information

  • https://suefel.com
  • Latest advice and best practices for custom GPT development.

  • Alexandru Strujac
  • Efficient thumbnail creator for YouTube videos

  • Emmet Halm
  • Converts Figma frames into front-end code for various mobile frameworks.

  • Elijah Ng Shi Yi
  • Advanced software engineer GPT that excels through nailing the basics.

  • lumpenspace
  • Take an adjectivised noun, and create images making it progressively more adjective!

  • J. DE HARO OLLE
  • Especialista en juegos de palabras en varios idiomas.

  • albert tan
  • Japanese education, creating tailored learning experiences.

  • https://maiplestudio.com
  • Find Exhibitors, Speakers and more

  • Carlos Ferrin
  • Encuentra películas y series en plataformas de streaming.

  • Yusuf Emre Yeşilyurt
  • I find academic articles and books for research and literature reviews.

  • https://zenepic.net
  • Embark on a thrilling diplomatic quest across a galaxy on the brink of war. Navigate complex politics and alien cultures to forge peace and avert catastrophe in this immersive interstellar adventure.

  • apappascs
  • 发现市场上最全面,最新的MCP服务器集合。该存储库充当集中式枢纽,提供了广泛的开源和专有MCP服务器目录,并提供功能,文档链接和贡献者。

  • ShrimpingIt
  • MCP系列GPIO Expander的基于Micropython I2C的操作,源自ADAFRUIT_MCP230XX

  • jae-jae
  • MCP服务器使用剧作《无头浏览器》获取网页内容。

  • HiveNexus
  • 一个适用于中小型团队的AI聊天机器人,支持DeepSeek,Open AI,Claude和Gemini等车型。 专为中小团队设计的ai聊天应用,支持deepSeek,打开ai,claude,双子座等模型。

  • ravitemer
  • 一个功能强大的Neovim插件,用于管理MCP(模型上下文协议)服务器

  • patruff
  • Ollama和MCP服务器之间的桥梁,使本地LLMS可以使用模型上下文协议工具

  • pontusab
  • 光标与风浪冲浪社区,查找规则和MCP

  • JackKuo666
  • 🔍使AI助手可以通过简单的MCP接口搜索和访问PYPI软件包信息。

  • av
  • 毫不费力地使用一个命令运行LLM后端,API,前端和服务。

    Reviews

    4 (1)
    Avatar
    user_mJ9X6JOw
    2025-04-16

    As a dedicated user of sec-edgar-mcp, I highly recommend this tool for anyone interested in SEC filings analysis. Stefanoamorelli has done a remarkable job in creating a user-friendly and efficient application that simplifies the process of accessing and managing EDGAR data. The GitHub repository is well-documented, and the functionality is spot-on, making it an invaluable resource for investors and researchers alike.