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.
README
XBRL-US MCP Server
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 forlimit(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
- Clone the repository:
git clone <repository-url>
cd xbrl-us-mcp
- Install dependencies:
uv sync
- 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
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
License
This project is licensed under the MIT License.
Recommended Servers
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.
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.
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.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
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.
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.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.
Neon Database
MCP server for interacting with Neon Management API and databases
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.
E2B
Using MCP to run code via e2b.