XBRL-US MCP Server

XBRL-US MCP Server

Provides secure access to XBRL-US financial data with session-based authentication, enabling users to search for companies by fiscal year and retrieve their financial facts from SEC filings.

Category
Visit Server

README

XBRL-US MCP Server

smithery badge

A Model Context Protocol (MCP) server that provides secure access to XBRL-US financial data with session-based authentication and state persistence.

Features

  • Session-Based Authentication: Efficient session management with automatic token reuse
  • State Persistence: XBRL instances persist across multiple tool calls within the same session
  • Company Search: Search for companies by fiscal year and retrieve financial facts
  • Secure Credentials: SHA256-hashed credential validation and secure storage

Tools Available

Search Companies

Search for companies by fiscal year and retrieve financial facts.

  • Parameters:
    • year (integer): Fiscal year to search for
    • limit (optional, default: 10): Maximum number of results to return
  • Returns: List of financial facts for companies in the specified year

Authentication

This server requires XBRL-US API credentials provided via URL parameters:

  • Username: Your XBRL-US account username
  • Password: Your XBRL-US account password
  • Client ID: Your XBRL-US API client ID
  • Client Secret: Your XBRL-US API client secret

Configuration Format

Credentials are passed as a base64-encoded JSON object in the config URL parameter:

# Example configuration object (before base64 encoding):
{
  "username": "your-xbrl-username",
  "password": "your-xbrl-password",
  "client_id": "your-client-id",
  "client_secret": "your-client-secret"
}

Installation & Setup

Prerequisites

  • Python 3.13+
  • XBRL-US API account and credentials
  • uv (for dependency management)

Local Development

  1. Clone the repository:
git clone <repository-url>
cd xbrl-us-mcp
  1. Install dependencies:
uv sync
  1. Run the server:
uv run playground

The server will start on port 8081 by default and open smithery.ai playground

Usage Example

Search for Companies in 2023

Tool: search_companies
Parameters: {"year": 2023, "limit": 10}

This will return financial facts for companies with data available for fiscal year 2023.

Architecture

Session Management

The server implements sophisticated session management:

  • FastMCP Session IDs: Uses FastMCP's built-in session identification
  • Session-Scoped Storage: XBRL instances persist across requests within the same session
  • Automatic Token Reuse: Reuses valid XBRL authentication tokens to improve performance
  • Credential Validation: SHA256 hashing ensures secure credential comparison
  • Token Expiration: Automatically handles expired tokens and re-authenticates when needed

Project Structure

xbrl-us-mcp/
├── src/
│   ├── index.py              # Main FastMCP server
│   └── funcs/
│       ├── __init__.py
│       └── middleware.py     # Session authentication middleware
├── smithery.yaml             # Deployment configuration
├── pyproject.toml           # Python dependencies
└── README.md               # This file

Session Persistence Benefits

  • Performance: Eliminates redundant authentication calls
  • Efficiency: Reuses XBRL instances across multiple tool calls
  • Reliability: Handles token expiration gracefully
  • Security: Secure credential hashing and validation

Expected Behavior

First Request in Session:

New XBRL instance created for session abc123...: token...

Subsequent Requests in Same Session:

Reusing valid XBRL session for abc123...
Reusing XBRL instance: token...

Error Handling

The server provides detailed error messages for:

  • Missing or invalid credentials
  • Authentication failures
  • Token expiration
  • Network connectivity issues
  • Invalid search parameters

Security Features

  • Credential Hashing: SHA256 hashing of credentials for secure comparison
  • Session Isolation: Each session maintains independent authentication state
  • Token Validation: Automatic validation of XBRL token expiration
  • Secure Storage: Credentials are never stored in plain text

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Submit a pull request

License

This project is licensed under the MIT License.

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
E2B

E2B

Using MCP to run code via e2b.

Official
Featured