
kFinance
MCPOfficial kFinance library and MCP server from Kensho (S&P Global): lets AI query S&P Capital IQ financials, prices and market caps, consensus estimates, M&A and funding, earnings call transcripts and more. Needs an S&P LLM-ready API subscription or trial; verify outputs.
kFinance
The kFinance Python library provides a simple interface for the LLM-ready API, streamlining API requests and response handling. It can be used on its own, with LLMs, or integrated into applications.
For a complete overview of the functions, usage, and features of the kFinance Python library, please refer to documentation here.
Any questions or suggestions can be sent to the kFinance Maintainers.
Setup
You can install kFinance on PyPI via
pip install kensho-kfinance
Getting started
To receive access, please email S&P Global Market Intelligence for information on free trials and pricing.
Once access is obtained, get started using the Authentication Guide and Usage Guide.
To get started, we provide some notebooks:
- The LLM-ready API Basic Usage notebook demonstrates how fetch data with the kFinance client.
- The tool_calling notebooks show how the kFinance library can be used for tool calling. We provide notebooks for OpenAI (GPT), Anthropic (Claude), and Google (Gemini). Each of these integrations comes in a langchain version, which uses langchain as a wrapper to simplify the integration, and as a lower level non-langchain version.
We also provide an interactive notebook that demonstrates some usage examples.
MCP (Model Context Protocol)
To run the kFinance MCP server use:
python -m kfinance.mcp
This function initializes and starts an MCP server that exposes the kFinance tools. The server supports multiple authentication methods and transport protocols to accommodate different deployment scenarios.
The server's full signature is as follows:
kfinance.mcp [--stdio|-s|--sse|--streamable-http] --refresh-token <refresh-token> --client-id <client-id> --private-key <private-key> --kid <kid> --api-host <api-host>
Authentication Methods (in order of precedence):
- Refresh Token: Uses an existing refresh token for authentication. The
--refresh-token <refresh-token>argument must be provided. - Key Pair: Uses client ID and private key for authentication. Both the
--client-id <client-id>and--private-key <private-key>arguments must be provided. Add--kid <kid>when more than one public key is registered, since Okta rejects an assertion without a key ID in that case. - Browser: Falls back to browser-based authentication flow. This occurs if no auth arguments are provided.
Transport Layers:
--stdio/-s: Standard input/output transport (use with MCP Inspector)--sse: Server-Sent Events transport (default)--streamable-http: HTTP transport
API Host:
--api-host <api-host>: The kFinance API host to fetch data from. Defaults to production (https://kfinance.kensho.com). Useful for pointing the server at a local or pre-production backend.- Refresh tokens are redeemed against
--api-host, so a token issued by one host will not authenticate against another. Key-pair authentication goes to Okta instead, and so works against any host.
Examples:
# Using stdio with MCP Inspector
npx @modelcontextprotocol/inspector python -m kfinance.mcp --stdio --refresh-token <token>
# Using SSE (default)
python -m kfinance.mcp --refresh-token <token>
# Using streamable-http
python -m kfinance.mcp --streamable-http --refresh-token <token>
# Against a locally running backend
python -m kfinance.mcp --stdio --api-host http://localhost:8000 --refresh-token <token>
MCP Proxy
The kFinance MCP proxy is a skeleton server that forwards requests to a remote kfinance MCP backend, injecting authentication tokens into every outgoing request. It is intended as a starting point for building a full production MCP proxy service.
# Using a refresh token (for experimentation)
AUTH_REFRESH_TOKEN=<token> python -m kfinance.proxy_mcp
# Using a key pair (for production)
AUTH_CLIENT_ID=<client-id> AUTH_PRIVATE_KEY=<private-key> python -m kfinance.proxy_mcp
# Add AUTH_KID when more than one public key is registered
AUTH_CLIENT_ID=<client-id> AUTH_PRIVATE_KEY=<private-key> AUTH_KID=<kid> python -m kfinance.proxy_mcp
The server starts on http://127.0.0.1:8000/mcp by default. Use --host and --port to configure binding.
For full documentation including configuration options, authentication methods, and production considerations, see kfinance/integrations/proxy_mcp/README.md.
Development
Working with Local Package Version
If you need to develop using a local version of the kFinance package in another project that uses poetry for package and dependency management, follow these steps:
-
In your dependent project's
pyproject.toml, replace the kFinance package version specification:# Replace this: # kensho-kfinance = "~2.0.1" # With this: kensho-kfinance = { path = "/absolute/path/to/kfinance", develop = true }The
develop = trueflag ensures that the package always matches your local version without requiring reinstallation after changes. -
Update your project's dependencies:
poetry update # Update poetry.lock with new changes poetry install # Install dependencies with updated configurationIf you encounter the error "your pyproject.toml file has significantly changed", run:
poetry lock # Sync the changes to poetry.lock
Versioning
The kFinance uses semantic versioning (major, minor, patch). To bump the version, add a new entry in CHANGELOG.md. This will generate a new version of the library as part of the release process.
License
Licensed under the Apache 2.0 License. Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2025-present Kensho Technologies, LLC. The present date is determined by the timestamp of the most recent commit in the repository.
관련 리소스

S&P Global Plugin
PluginPartner plugin from Kensho, part of S&P Global: uses Capital IQ data to produce one- to two-page company tearsheets as Word docs, earnings previews, and M&A deal summaries by sector or company. Needs a Capital IQ Pro or S&P LLM-ready API subscription; needs expert review.
anthropics/financial-services40.1k
Finance Toolkit MCP
MCPFrom the FinanceToolkit author: computes ratios, valuation, risk and macro indicators with 500+ transparent formulas, for company comparisons and first-pass due diligence. Hosted, no install; enter a Financial Modeling Prep key on first connect (free tier: US stocks, 5 years). Verify results.
JerBouma/FinanceToolkit5.4k
Financial Modeling Prep MCP Server
MCPGives agents 250+ Financial Modeling Prep endpoints: financials, valuation and technical indicators, insider and congressional trades, SEC filings and earnings calendars. Needs an FMP API key (free tier); connect to the author's hosted URL or run locally on Node.js 25.3+. Results need expert review.
imbenrabi/Financial-Modeling-Prep-MCP-Server150
Octagon MCP Server
MCPOctagon AI's official research MCP: ask in plain language about SEC filings, earnings calls, financial metrics, stock and crypto prices and news; also prediction-market reports and a deep research agent. Needs a free API key and Node.js. Not investment advice; verify findings.
OctagonAI/octagon-mcp-server147
OpenBB Platform CLI
CLICommand-line edition of the open-source OpenBB investment research platform: query stock prices, financial statements, macroeconomic and other financial data from the terminal, and automate data pulls with Routine scripts. Officially maintained; some sources need API keys.
OpenBB-finance/OpenBB74.3k
LSEG Financial Analytics
PluginPartner plugin from the London Stock Exchange Group: with LSEG data connected, 8 commands cover bond relative value, swap curves, FX carry, option volatility, fixed income portfolios, Treasury futures basis and macro rates analysis. Needs an LSEG account and data entitlements.
anthropics/financial-services40.1k