# SBA Loan Intelligence MCP (`andrew_avina/sba-loans-mcp`) Actor

An Apify MCP actor that queries the U.S. Small Business Administration's public loan guarantee database via the Socrata open data API at data.sba.gov. Returns structured records for SBA 7(a) and 504 loan programs covering borrower details, lender identity, NAICS industry class...

- **URL**: https://apify.com/andrew\_avina/sba-loans-mcp.md
- **Developed by:** [Andrew Avina](https://apify.com/andrew_avina) (community)
- **Categories:** MCP servers, Business
- **Stats:** 1 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$3.00 / 1,000 result item returneds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# README

## SBA Loan Intelligence MCP — 7(a) & 504 Business Loan Guarantees

An Apify MCP actor that queries the U.S. Small Business Administration's public loan guarantee database via the Socrata open data API at data.sba.gov. Returns structured records for SBA 7(a) and 504 loan programs covering borrower details, lender identity, NAICS industry classification, loan amounts, and approval dates.

### What This Actor Does

- Queries `data.sba.gov` for SBA 7(a) loan records (endpoint: `t4nb-5ku7`) and 504 loan records (endpoint: `quze-kivu`)
- Supports filtering by state, approval year, keyword, and loan type
- Normalizes raw API fields into a consistent output schema
- Falls back to 20 curated real SBA loan records if the API is unreachable
- Can run as an MCP server (HTTP) for integration with LLM tool-use pipelines

### Output Fields

| Field | Description |
|---|---|
| `borrower_name` | Name of the business that received the loan |
| `borrower_state` | Two-letter state abbreviation |
| `borrower_city` | City of borrower |
| `loan_amount` | Gross loan approval amount in USD |
| `loan_type` | `7a` or `504` |
| `naics_code` | North American Industry Classification System code |
| `naics_description` | Human-readable industry description |
| `lender` | Bank or lending institution name |
| `approval_date` | Date the SBA approved the loan |
| `loan_status` | Current loan status (e.g. Disbursed Current, Charged Off) |
| `source` | Data source identifier |

### Input Parameters

| Parameter | Type | Default | Description |
|---|---|---|---|
| `loanType` | string | `7a` | SBA loan program: `7a` or `504` |
| `state` | string | (all) | Two-letter state filter (e.g. `CA`, `TX`) |
| `keyword` | string | (none) | Full-text keyword search |
| `year` | integer | (none) | Filter by approval year (e.g. `2023`) |
| `limit` | integer | `50` | Max records returned (up to 1000) |
| `serveMcp` | boolean | `false` | Start HTTP MCP server instead of writing dataset |

### MCP Server Mode

Set `serveMcp: true` to run this actor as an HTTP MCP server. The server exposes:

- `GET /` — Health check
- `GET /mcp/tools` — Lists available tools
- `POST /` — Invoke a tool with `{"tool": "search_sba_loans", "arguments": {...}}`

### Data Source

- **SBA 7(a) Loans**: https://data.sba.gov/resource/t4nb-5ku7.json
- **SBA 504 Loans**: https://data.sba.gov/resource/quze-kivu.json
- API is public and requires no authentication key

### SBA Loan Programs Overview

**7(a) Loans**: The SBA's flagship program. Loan guarantees up to $5M for working capital, equipment, real estate, and business acquisitions. Delivered through commercial lenders.

**504 Loans**: Long-term, fixed-rate financing for major fixed assets (real estate and equipment). Involves a Certified Development Company (CDC) and a third-party lender.

### Use Cases

- Competitive intelligence: find SBA-backed competitors in a market
- Lender analysis: identify which banks are most active in SBA lending by state
- Industry research: filter by NAICS code to analyze loan activity in a sector
- Market sizing: aggregate loan volume by state, year, or industry
- Due diligence: verify SBA loan history for a business entity

### Categories

`MCP_SERVERS` · `BUSINESS`

# Actor input Schema

## `loanType` (type: `string`):

Type of SBA loan to query: '7a' for SBA 7(a) loans or '504' for SBA 504 loans.
## `state` (type: `string`):

Two-letter US state abbreviation to filter results (e.g. 'CA', 'TX', 'NY'). Leave empty for all states.
## `keyword` (type: `string`):

Optional keyword to search within borrower name, lender name, or NAICS description.
## `year` (type: `integer`):

Filter loans by approval year (e.g. 2022). Leave empty for all years from 2020 onward.
## `limit` (type: `integer`):

Maximum number of loan records to return.
## `serveMcp` (type: `boolean`):

When true, the actor starts an HTTP server exposing MCP tool endpoints instead of writing to dataset.

## Actor input object example

```json
{
  "loanType": "7a",
  "limit": 50,
  "serveMcp": false
}
````

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {};

// Run the Actor and wait for it to finish
const run = await client.actor("andrew_avina/sba-loans-mcp").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {}

# Run the Actor and wait for it to finish
run = client.actor("andrew_avina/sba-loans-mcp").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{}' |
apify call andrew_avina/sba-loans-mcp --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=andrew_avina/sba-loans-mcp",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "SBA Loan Intelligence MCP",
        "description": "An Apify MCP actor that queries the U.S. Small Business Administration's public loan guarantee database via the Socrata open data API at data.sba.gov. Returns structured records for SBA 7(a) and 504 loan programs covering borrower details, lender identity, NAICS industry class...",
        "version": "0.1",
        "x-build-id": "Ikcr6oamkFbh2Hp2d"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/andrew_avina~sba-loans-mcp/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-andrew_avina-sba-loans-mcp",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/andrew_avina~sba-loans-mcp/runs": {
            "post": {
                "operationId": "runs-sync-andrew_avina-sba-loans-mcp",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/andrew_avina~sba-loans-mcp/run-sync": {
            "post": {
                "operationId": "run-sync-andrew_avina-sba-loans-mcp",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "properties": {
                    "loanType": {
                        "title": "Loan Type",
                        "enum": [
                            "7a",
                            "504"
                        ],
                        "type": "string",
                        "description": "Type of SBA loan to query: '7a' for SBA 7(a) loans or '504' for SBA 504 loans.",
                        "default": "7a"
                    },
                    "state": {
                        "title": "State",
                        "type": "string",
                        "description": "Two-letter US state abbreviation to filter results (e.g. 'CA', 'TX', 'NY'). Leave empty for all states."
                    },
                    "keyword": {
                        "title": "Keyword",
                        "type": "string",
                        "description": "Optional keyword to search within borrower name, lender name, or NAICS description."
                    },
                    "year": {
                        "title": "Approval Year",
                        "type": "integer",
                        "description": "Filter loans by approval year (e.g. 2022). Leave empty for all years from 2020 onward."
                    },
                    "limit": {
                        "title": "Result Limit",
                        "minimum": 1,
                        "maximum": 1000,
                        "type": "integer",
                        "description": "Maximum number of loan records to return.",
                        "default": 50
                    },
                    "serveMcp": {
                        "title": "Serve as MCP Server",
                        "type": "boolean",
                        "description": "When true, the actor starts an HTTP server exposing MCP tool endpoints instead of writing to dataset.",
                        "default": false
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
