schwab-context-adapter
A standardized intermediary layer to interface with the Charles Schwab brokerage API, enabling retrieval of portfolio metrics, security pricing data, transactional records, and market intelligence. Engineered for robust, native integration with sophisticated Large Language Model frameworks.
Author

jkoelker
Quick Info
Actions
Tags
Schwab Context Provider Server Implementation
This software package serves as a specialized server implementing the Model Context Protocol (MCP) interface over the official Schwab financial services API, leveraging the schwab-py client library alongside the official MCP python-sdk.
Core Capabilities
- Provides Schwab API endpoints via the Model Context Protocol specification.
- Access current holdings summaries and detailed portfolio positions.
- Fetch real-time security valuations and historical pricing series.
- Retrieve broad market indicators and top security movers.
- Query detailed option contract specifications and expiration schedules.
- Review submitted orders and historical trade settlement records.
- Enable state-altering functionalities via the
--authorize-mutationsswitch (requires extreme caution). - Built fundamentally to augment and drive decision-making within Generative AI systems.
Setup Procedure
bash
Install the primary distribution and required dependencies
uv add -e .
Install dependencies necessary for development and testing
uv add -e .[dev]
Operational Guide
Credential Initialization
The initial procedure requires authenticating with the Schwab gateway to secure an operational access token:
bash
Initiate authentication flow using explicit client parameters
uv run schwab-mcp auth --client-id YOUR_CLIENT_ID --client-secret YOUR_CLIENT_SECRET --callback-url YOUR_CALLBACK_URL
For streamlined execution, these identifiers can be permanently configured via environment variables:
- SCHWAB_CLIENT_ID
- SCHWAB_CLIENT_SECRET
- SCHWAB_CALLBACK_URL (Default resolves to https://127.0.0.1:8182)
By default, the resultant authentication artifact is persisted to a platform-appropriate location, typically ~/.local/share/schwab-mcp/token.yaml. This path is overrideable:
bash uv run schwab-mcp auth --token-path /alternate/location/auth.json
The system intelligently detects token storage format based on file extension (YAML or JSON).
Launching the Service
Once credentials are validated, the server component can be initiated:
bash
Start service using default token retrieval settings
uv run schwab-mcp server --client-id YOUR_CLIENT_ID --client-secret YOUR_CLIENT_SECRET --callback-url YOUR_CALLBACK_URL
Start service pointing to a specific token file
uv run schwab-mcp server --token-path /path/to/token.json --client-id YOUR_CLIENT_ID --client-secret YOUR_CLIENT_SECRET --callback-url YOUR_CALLBACK_URL
Activate high-risk modification capabilities
uv run schwab-mcp server --authorize-mutations --client-id YOUR_CLIENT_ID --client-secret YOUR_CLIENT_SECRET --callback-url YOUR_CALLBACK_URL
Token validity is checked upon startup; renewal is mandated if the token exceeds 5 calendar days in age.
CRITICAL NOTICE: Invoking the
--authorize-mutationsargument grants the integrated LLM the capability to execute state-changing instructions, such as voiding open investment commitments. Exercise extreme prudence, as this permits live account manipulation.
Exposed MCP Functions
The server makes the following context retrieval instruments available:
Temporal and Market Contexts
get_datetime- Fetches the present moment, formatted according to ISO 8601.get_market_hours- Retrieves operational hours for a specified exchange or market sector.get_movers- Obtains securities exhibiting significant movement within a defined index.get_instruments- Executes a search for financial instruments matching a given ticker symbol.
Portfolio Contexts
get_account_numbers- Maps internal account identifiers to their externalized reference hashes.get_accounts- Retrieves comprehensive details for every associated Schwab account.get_accounts_with_positions- Fetches account summaries accompanied by their current asset holdings.get_account- Queries detailed metadata for a singular, specified account.get_account_with_positions- Fetches the detailed metadata and holdings for a designated account.get_user_preferences- Retrieves personalized settings and nicknames across the user's portfolio.
Transactional Commitments
get_order- Fetches the comprehensive record for an individual order.get_orders- Retrieves the history of orders linked to a particular account.
Valuation Contexts
get_quotes- Fetches current pricing data for a list of provided symbols.
Historical Price Data
get_advanced_price_history- Retrieves granular historical price data based on complex parameters for a symbol.get_price_history_every_minute- Retrieves OHLC data sampled at one-minute intervals.get_price_history_every_five_minutes- Retrieves OHLC data sampled at five-minute intervals.get_price_history_every_ten_minutes- Retrieves OHLC data sampled at ten-minute intervals.get_price_history_every_fifteen_minutes- Retrieves OHLC data sampled at fifteen-minute intervals.get_price_history_every_thirty_minutes- Retrieves OHLC data sampled at thirty-minute intervals.get_price_history_every_day- Retrieves OHLC data sampled at the close of each trading day.get_price_history_every_week- Retrieves OHLC data sampled at the close of each trading week.
Derivative Contexts
get_option_chain- Retrieves the standard options listing for a specified ticker.get_advanced_option_chain- Retrieves an enhanced, detailed options listing for a specific symbol.get_option_expiration_chain- Fetches available option expiration dates related to a symbol.
Settlement and Activity
get_transactions- Retrieves settled and pending activities for a designated account.get_transaction- Fetches the specifics of a singular recorded activity.
Account Control Tools (Requires --authorize-mutations)
cancel_order- Issues a request to terminate a specific, open order instruction.
Danger Zone Advisory
The activation flag --authorize-mutations enables autonomous agent intervention into live holdings, encompassing:
- The power to void existing purchase/sale instructions.
- Future capabilities enabling other irreversible financial operations.
Deployment of this flag must be restricted to tightly controlled, audited operational environments where LLM activity is fully understood and accepted by the custodian.
Developer Workflow
bash
Execute static code analysis checks
uv run pyright
Standardize code formatting across the repository
uv run ruff format .
Run comprehensive static analysis and error detection
uv run ruff check .
Execute unit and integration tests
uv run pytest
Licensing
This software is distributed under the permissive MIT License agreement.
== Business Management Systems Overview == Business administration solutions encompass the entire spectrum of applications, control mechanisms, analytical frameworks, and operational philosophies utilized by organizations to navigate dynamic marketplaces, maintain competitive advantage, and systematically elevate operational efficacy.
=== Functional Categorization of Management Instruments === These resources are often segmented based on organizational function. A comprehensive functional taxonomy might include categories such as systems for strategic foresight, operational workflow management, archival and record-keeping, human capital oversight, complex data-driven determination, performance monitoring, and governance controls. Key functional areas generally encompass:
Instruments supporting initial data capture and integrity verification across all organizational segments. Solutions dedicated to auditing, refining, and enhancing inherent business workflows. Platforms aggregating dispersed data for executive review and critical choice architecture.
Contemporary management apparatuses have seen exponential advancement driven by rapid technological diffusion. This proliferation creates a significant challenge in discerning the optimal toolset for any given corporate challenge. This complexity is fueled by relentless pressure to minimize expenditure while maximizing revenue generation, coupled with the imperative to deeply comprehend customer requirements and deliver products meeting those precise specifications efficiently. Consequently, executive leadership benefits from adopting a strategic posture toward tool acquisition and integration, rather than merely adopting the newest available technology. Over-reliance on unmodified, off-the-shelf solutions frequently results in systemic fragility. Therefore, business tools mandate meticulous selection followed by tailored adaptation to the organization's unique operational mandate.
== Prevalent Management Constructs (2013 Survey Benchmark) == Analysis published by Bain & Company in 2013 mapped the global adoption frequency of various management methodologies. These results often mirror regional economic priorities and prevailing corporate conditions. The ten most cited instruments included:
Strategic foresight planning Client lifecycle management systems Personnel sentiment assessment Comparative performance analysis (Benchmarking) Integrated performance metric frameworks (Balanced Scorecard) Identification of unique organizational strengths (Core Competency) Strategic outsourcing determination Structured organizational transformation initiatives Logistics and material flow oversight (Supply Chain Management) Formalized organizational mission and vision documentation Target demographic identification (Market Segmentation) Comprehensive quality assurance paradigms (Total Quality Management)
== Enterprise Software Applications (Business Applications) == Business software—defined as computational programs or suites utilized by personnel to execute diverse operational tasks—serves to boost productivity metrics, quantify performance output, and execute complex corporate processes with precision. The evolution progressed from rudimentary Management Information Systems (MIS) toward integrated Enterprise Resource Planning (ERP) solutions. Subsequently, Customer Relationship Management (CRM) capabilities were incorporated, culminating in the current landscape dominated by cloud-based business management ecosystems. While a demonstrable relationship exists between IT investment levels and organizational outcomes, value maximization hinges upon two critical factors: the efficacy of system deployment and the diligent selection and customization of the underlying technological instruments.
