Corporate credit data for AI agents. Equity data is everywhere. Credit data isn't. There's no "Yahoo Finance for bonds." Corporate debt structures, guarantor chains, and covenant details are buried in SEC filings—scattered across 10-Ks, 8-Ks, credit agreements, and indentures. An AI agent trying to answer "which telecom companies have leverage above 5x?" would need to read dozens of filings, extra
Add this skill
npx mdskills install debtstack-ai/debtstack-pythonComprehensive SDK with LangChain and MCP integrations for corporate credit data analysis
1# DebtStack.ai Python SDK23**Corporate credit data for AI agents.**45[](https://pypi.org/project/debtstack-ai/)6[](LICENSE)7<a href="https://glama.ai/mcp/servers/@debtstack-ai/debtstack-python">8 <img width="380" height="200" src="https://glama.ai/mcp/servers/@debtstack-ai/debtstack-python/badge" />9</a>1011## Why DebtStack?1213Equity data is everywhere. Credit data isn't.1415There's no "Yahoo Finance for bonds." Corporate debt structures, guarantor chains, and covenant details are buried in SEC filings—scattered across 10-Ks, 8-Ks, credit agreements, and indentures. An AI agent trying to answer "which telecom companies have leverage above 5x?" would need to read dozens of filings, extract the right numbers, and compute ratios manually.1617**DebtStack fixes this.** We extract, normalize, and serve corporate credit data through an API built for AI agents.1819### Three Things You Can't Do Elsewhere2021**1. Cross-Company Credit Queries**22```python23# Find distressed telecom companies24GET /v1/companies?sector=Telecommunications&min_leverage=5&sort=-net_leverage_ratio25```26Screen ~300 companies by leverage, coverage ratios, or maturity risk in one call. No filing-by-filing analysis.2728**2. Pre-Built Entity Relationships**29```python30# Who guarantees this bond?31POST /v1/entities/traverse32{"start": {"type": "bond", "id": "893830AK8"}, "relationships": ["guarantees"]}33```34Guarantor chains, parent-subsidiary hierarchies, structural subordination—mapped and queryable. This data exists nowhere else in machine-readable form.3536**3. Agent-Ready Speed**37```38< 100ms response time39```40AI agents chain multiple calls. If each took 30 seconds (reading a filing), a portfolio analysis would take hours. DebtStack returns in milliseconds.4142---4344## Installation4546```bash47pip install debtstack-ai48```4950For LangChain integration:51```bash52pip install debtstack-ai[langchain]53```5455## Quick Start5657```python58from debtstack import DebtStackClient59import asyncio6061async def main():62 async with DebtStackClient(api_key="your-api-key") as client:6364 # Screen for high-leverage companies65 risky = await client.search_companies(66 sector="Telecommunications",67 min_leverage=4.0,68 fields="ticker,name,net_leverage_ratio,interest_coverage",69 sort="-net_leverage_ratio"70 )7172 # Drill into the riskiest one73 ticker = risky["data"][0]["ticker"]74 bonds = await client.search_bonds(ticker=ticker, has_pricing=True)7576 # Check guarantor coverage on their notes77 for bond in bonds["data"]:78 guarantors = await client.get_guarantors(bond["cusip"])79 print(f"{bond['name']}: {len(guarantors)} guarantors")8081asyncio.run(main())82```8384## Synchronous Usage8586```python87from debtstack import DebtStackSyncClient8889client = DebtStackSyncClient(api_key="your-api-key")90result = client.search_companies(sector="Energy", min_leverage=3.0)91```9293## What's In The Data9495| Coverage | Count |96|----------|-------|97| Companies | ~300 (S&P 100 + NASDAQ 100 + high-yield issuers) |98| Entities | ~39,000 (subsidiaries, holdcos, JVs, VIEs) |99| Debt Instruments | ~10,000 (bonds, loans, revolvers) with 96% document linkage |100| Bond Pricing | ~4,300 bonds with FINRA TRACE pricing (updated 3x daily) |101| SEC Filing Sections | ~25,000 (searchable full-text) |102| Covenants | ~1,800 structured covenant records |103104**Pre-computed metrics:** Leverage ratios, interest coverage, maturity profiles, structural subordination scores.105106**Relationships:** Guarantor chains, issuer-entity links, parent-subsidiary hierarchies.107108## API Methods109110| Method | What It Does |111|--------|--------------|112| `search_companies()` | Screen by leverage, sector, coverage, risk flags |113| `search_bonds()` | Filter by yield, spread, seniority, maturity |114| `resolve_bond()` | Look up CUSIP, ISIN, or "RIG 8% 2027" |115| `traverse_entities()` | Follow guarantor chains, map corporate structure |116| `search_pricing()` | FINRA TRACE bond prices, YTM, spreads |117| `search_documents()` | Full-text search across credit agreements, indentures |118| `batch()` | Run multiple queries in parallel |119| `get_changes()` | Track debt structure changes over time |120121## Examples122123### Which MAG7 company has the most debt?124125```python126result = await client.search_companies(127 ticker="AAPL,MSFT,GOOGL,AMZN,NVDA,META,TSLA",128 fields="ticker,name,total_debt,net_leverage_ratio",129 sort="-total_debt",130 limit=1131)132# Returns structured data in milliseconds, not minutes133```134135### Find high-yield bonds trading at a discount136137```python138result = await client.search_bonds(139 seniority="senior_unsecured",140 min_ytm=8.0,141 has_pricing=True,142 sort="-pricing.ytm"143)144```145146### Who guarantees a specific bond?147148```python149guarantors = await client.get_guarantors("893830AK8")150for g in guarantors:151 print(f"{g['name']} ({g['entity_type']}) - {g['jurisdiction']}")152153# Output:154# Transocean Ltd. (holdco) - Switzerland155# Transocean Inc. (finco) - Cayman Islands156# Transocean Offshore Deepwater Drilling Inc. (opco) - Delaware157# ... 42 more entities158```159160### Search for covenant language161162```python163result = await client.search_documents(164 q="maintenance covenant",165 section_type="credit_agreement",166 ticker="CHTR"167)168# Returns matching sections with highlighted snippets169```170171## LangChain Integration172173Build AI agents that can autonomously analyze corporate credit data.174175### Installation176177```bash178pip install debtstack-ai[langchain]179```180181### Available Tools182183| Tool | Description |184|------|-------------|185| `debtstack_search_companies` | Screen companies by leverage, sector, coverage ratios, and risk flags |186| `debtstack_search_bonds` | Filter bonds by yield, spread, seniority, maturity, and pricing |187| `debtstack_resolve_bond` | Look up bonds by CUSIP, ISIN, or description (e.g., "RIG 8% 2027") |188| `debtstack_traverse_entities` | Follow guarantor chains, map corporate structure, trace ownership |189| `debtstack_search_pricing` | Get FINRA TRACE bond prices, YTM, and spreads |190| `debtstack_search_documents` | Full-text search across credit agreements, indentures, and SEC filings |191| `debtstack_get_changes` | Track debt structure changes over time (new issuances, maturities, leverage) |192193### Full Example194195```python196from debtstack.langchain import DebtStackToolkit197from langchain.agents import AgentExecutor, create_openai_functions_agent198from langchain_openai import ChatOpenAI199from langchain import hub200201# Initialize toolkit with your API key202toolkit = DebtStackToolkit(api_key="your-api-key")203tools = toolkit.get_tools()204205# Create an agent with GPT-4 (or any LangChain-compatible LLM)206llm = ChatOpenAI(temperature=0, model="gpt-4")207prompt = hub.pull("hwchase17/openai-functions-agent")208agent = create_openai_functions_agent(llm, tools, prompt)209agent_executor = AgentExecutor(agent=agent, tools=tools, verbose=True)210211# Ask natural language questions about corporate credit212result = agent_executor.invoke({213 "input": "Which telecom companies are most at risk of default?"214})215print(result["output"])216```217218### Example Queries219220The agent can handle complex, multi-step credit analysis:221222- "Which telecom companies have leverage above 5x and near-term maturities?"223- "Find all bonds yielding above 8% with senior secured status"224- "Who guarantees Transocean's 8.75% 2030 notes? How many entities are in the guarantee chain?"225- "Compare Charter and Altice's corporate structures - which has more structural subordination risk?"226- "What changed in RIG's debt structure since January 2025?"227- "Search for maintenance covenant language in Charter's credit agreements"228- "Find distressed bonds trading below 80 cents on the dollar"229230## MCP Server (Claude Desktop, Claude Code, Cursor)231232Give Claude (or any MCP client) direct access to corporate credit data.233234### Installation235236```bash237pip install debtstack-ai[mcp]238```239240### Available Tools241242| Tool | Description |243|------|-------------|244| `search_companies` | Search companies by ticker, sector, leverage ratio, and risk flags |245| `search_bonds` | Search bonds by ticker, seniority, yield, spread, and maturity |246| `resolve_bond` | Look up a bond by CUSIP, ISIN, or description (e.g., "RIG 8% 2027") |247| `get_guarantors` | Find all entities that guarantee a bond |248| `get_corporate_structure` | Get full parent-subsidiary hierarchy for a company |249| `search_pricing` | Get FINRA TRACE bond prices, YTM, and spreads |250| `search_documents` | Search SEC filing sections (debt footnotes, credit agreements, indentures) |251| `get_changes` | See what changed in a company's debt structure since a date |252253### Claude Desktop254255Add to your Claude Desktop config (`~/.config/claude/mcp.json` on Mac/Linux, `%APPDATA%\Claude\mcp.json` on Windows):256257```json258{259 "mcpServers": {260 "debtstack-ai": {261 "command": "debtstack-mcp",262 "env": {263 "DEBTSTACK_API_KEY": "your-api-key"264 }265 }266 }267}268```269270### Claude Code271272Add to your Claude Code config (`~/.claude/mcp.json`):273274```json275{276 "mcpServers": {277 "debtstack-ai": {278 "command": "debtstack-mcp",279 "env": {280 "DEBTSTACK_API_KEY": "your-api-key"281 }282 }283 }284}285```286287### Cursor288289Add to your Cursor MCP settings (`.cursor/mcp.json`):290291```json292{293 "mcpServers": {294 "debtstack-ai": {295 "command": "debtstack-mcp",296 "env": {297 "DEBTSTACK_API_KEY": "your-api-key"298 }299 }300 }301}302```303304### Alternative: Run with Python Module305306If you prefer not to install the console script, you can use `python -m` instead:307308```json309{310 "mcpServers": {311 "debtstack-ai": {312 "command": "python",313 "args": ["-m", "debtstack.mcp_server"],314 "env": {315 "DEBTSTACK_API_KEY": "your-api-key"316 }317 }318 }319}320```321322### Example Queries323324Once configured, ask Claude:325326- "Which energy companies have near-term maturities and high leverage?"327- "Who guarantees the Transocean 8% 2027 notes?"328- "Compare Charter's debt structure to Altice"329- "Find all senior secured bonds yielding above 8%"330- "What are the financial covenants in Charter's credit agreement?"331- "Show me RIG's corporate structure - where does the debt sit?"332- "What changed in CVS's debt structure since June 2025?"333- "Search for change-of-control provisions in Altice's indentures"334335## Pricing336337DebtStack offers usage-based pricing with a free tier to get started.338339See [debtstack.ai/pricing](https://debtstack.ai/pricing) for details.340341## Links342343- **Docs:** [docs.debtstack.ai](https://docs.debtstack.ai)344- **Discord:** [discord.gg/debtstack-ai](https://discord.gg/debtstack-ai)345- **Issues:** [GitHub](https://github.com/debtstack-ai/debtstack-python/issues)346347## License348349Apache-2.0350
Full transparency — inspect the skill content before installing.