# Sergipe Dados Abertos MCP

> Sergipe Dados Abertos connects your AI agent directly to public government financial records for Sergipe, Brazil. You can run queries across four core areas: state spending (`get_despesas`), tax income (`get_receitas`), personnel payroll (`get_servidores`), and the official budget plan (`get_orcamento`). It lets you audit public funds—checking if revenue covers expenses or tracking staffing costs against allocated budgets—all through natural conversation.

## Overview
- **Category:** data-analytics
- **Price:** Free
- **Tags:** public-spending, transparency, open-data, financial-reporting, brazil

## Description

You wanna audit public money in Sergipe? This setup hooks your AI agent straight into the state's open government financial records. It lets you run deep queries across four core areas of finance: how they spend cash, where the money comes from, what the payroll looks like, and what the official budget law says. You don't need to know accounting jargon; you just ask your AI client, and it pulls the numbers.

Here’s how you use these tools:

**Auditing the Books (Spending vs. Money In)**

You can cross-reference detailed payments using `get_despesas` with all the state's total income reported by `get_receitas`. This lets you instantly check if the revenue collected covers the actual expenditures, giving you a clear picture of the state’s financial balance sheet. When you need to track specific cash flows, you can use `get_receitas` to query tax collections like ICMS or IPVA, or federal transfers, over custom date ranges for serious fiscal analysis. For historical deep dives into spending, run `get_despesas`; it pulls out payments broken down by supplier or even the type of inter-governmental transfer, year after year.

**Checking Budget Compliance (Payroll vs. Caps)**

You can track staffing costs against official budget limits by comparing active employee counts and salary data from `get_servidores` directly against the spending caps defined in `get_orcamento`. This is crucial for knowing if payroll is creeping over allocated funds. To get a full picture of the annual plan, you check `get_orcamento`; it pulls the Annual Budget Law (LOA) details and tracks the real-time progress of current spending relative to those set limits.

**The Data Deep Dive by Tool:**

*   **`get_despesas`**: This tool gives you detailed records of what the state spent. You can get payments broken out by specific suppliers, fiscal year, and even different types of transfers. It shows exactly where the money went.
*   **`get_receitas`**: Use this to monitor how much cash the state collected. You'll pull records for major taxes like ICMS or IPVA, plus federal transfer amounts, all confined within date ranges you set.
*   **`get_servidores`**: This tool covers the entire workforce picture—it gives you info on both active staff and retirees. It details positions held, salary data, and current employee status.
*   **`get_orcamento`**: You pull the Annual Budget Law (LOA) here. It lets you see how spending is progressing in real-time against the planned limits for a given year.

It’s all about connection: use your AI client to make these tools talk to each other. Need to know if salaries are eating up the budget? Run `get_servidores` data through `get_orcamento`. Wanna see if tax revenue covered supplier payments last quarter? Cross-reference `get_receitas` with `get_despesas`. It's a full audit suite, letting you go way beyond surface numbers and check the state’s financial health using natural conversation.

## Tools

### get_despesas
Retrieves detailed records of the state's expenditures, including payments by supplier and fiscal year.

### get_orcamento
Pulls data on the annual budget law (LOA) and tracks real-time spending execution against set limits.

### get_receitas
Gets records of state revenue collection, covering taxes like ICMS/IPVA and federal transfers by date range.

### get_servidores
Provides information on the state workforce, detailing active employees, positions, and salary data.

## Prompt Examples

**Prompt:** 
```
Show me the state expenditures for Sergipe in 2023.
```

**Response:** 
```
I've retrieved the expenditure data for 2023. The state processed various payments including supplier contracts and transfers. Would you like to see the breakdown by month or a specific government body?
```

**Prompt:** 
```
What were the total revenues collected between January and March 2024?
```

**Response:** 
```
Querying revenue data... For the first quarter of 2024, the state collected revenues from taxes like ICMS and federal transfers. I can provide the exact totals for each category if you'd like.
```

**Prompt:** 
```
List the active personnel in the state government for the last available month.
```

**Response:** 
```
I've accessed the personnel records. There are thousands of active employees across various departments. Would you like to see a summary of positions or filter by a specific employment bond type?
```

## Capabilities

### Audit spending against revenue
Cross-reference detailed payments from `get_despesas` with total income reported by `get_receitas` to check the state's financial balance.

### Track payroll costs against budget limits
Compare active employee counts and salary data from `get_servidores` directly against the spending caps defined in `get_orcamento`.

### Analyze tax collection trends
Use `get_receitas` to query specific taxes (ICMS, IPVA) and federal transfers over custom date ranges for fiscal analysis.

### Get historical spending breakdowns
Pull deep expenditure details using `get_despesas`, including payments by supplier or type of transfer, year by year.

### Review current budget status
Check the Annual Budget Law (LOA) and see the real-time progress of spending against allocated funds via `get_orcamento`.

## Use Cases

### Investigating spending gaps
A journalist needs to know if the state spent more on infrastructure than planned. They prompt their agent: 'Compare expenditures for construction in 2021 using `get_despesas` against the budget limits from `get_orcamento`.' The agent returns a precise comparison, proving potential overspending.

### Modeling payroll impact
A researcher wants to see how adding 50 new staff members affects the total budget. They run `get_servidores` for current personnel and then use that count against `get_orcamento`. The AI client calculates the remaining capacity, highlighting immediate budgetary strain.

### Auditing quarterly cash flow
A non-profit group needs to verify if tax revenue covered staffing. They prompt: 'What were revenues (`get_receitas`) from Jan-Mar 2024, and how much did personnel cost (`get_servidores`)?' The AI client gives a direct cash flow statement.

### Tracking year-over-year spending
A citizen wants to track if payments to specific suppliers increased over time. They use `get_despesas` multiple times for different years, gathering clean JSON data that proves a trend of rising costs.

## Benefits

- Check the state's actual cash flow. By querying `get_receitas`, you can track specific tax income (ICMS, IPVA) and federal transfers over custom date ranges without manually filtering spreadsheets.
- Know if money is being wasted. Comparing detailed spending via `get_despesas` against the planned limits in `get_orcamento` lets you spot budget deviations instantly.
- See payroll impact immediately. Use `get_servidores` to list active staff and then cross-reference those numbers with cost constraints using `get_orcamento` for a full picture of workforce costs.
- Avoid guessing the spending scope. You don't have to guess which ledger to check; running `get_despesas` gives you payments by supplier, sub-element, and transfer type all in one go.
- Get clean data for analysis. The tools deliver structured JSON records, meaning your AI client passes usable data directly into your downstream scripts—no manual CSV cleanup required.

## How It Works

The bottom line is: it lets your AI client talk to complex government databases without needing a developer or writing SQL queries.

1. Subscribe to the Sergipe Dados Abertos server. This links your AI client (Claude, Cursor, etc.) to the official State of Sergipe API.
2. Ask your agent a natural language question, like: 'What were expenditures in 2023?' or 'Show me personnel costs vs budget.'
3. The agent selects and runs the appropriate tool (`get_despesas`, `get_orcamento`, etc.) and returns clean JSON data you can work with immediately.

## Frequently Asked Questions

**How do I compare spending and revenue using get_despesas and get_receitas?**
You ask your agent to cross-reference them. The AI client runs both `get_despesas` and `get_receitas`, then compares the totals for a specific fiscal year, giving you an immediate balance sheet summary.

**Can I check budget status with get_orcamento?**
Yes. Running `get_orcamento` lets you see how far spending has progressed against the total allocated funds for a given period, helping you spot potential overruns early.

**What kind of data does get_servidores provide?**
It gives workforce details. You can access information on active and retired employees across various departments, along with salary structures needed for cost analysis.

**Do I need to know the specific API endpoints to use get_despesas?**
No. Just tell your agent what you want—for example, 'Show me payments to suppliers in 2023.' The server handles selecting and running `get_despesas` for you.

**What kind of structured data does using get_despesas return?**
It returns clean, machine-readable JSON objects. This format makes it simple for your AI client to process and analyze the spending records without requiring manual CSV downloads or data scrubbing.

**What parameters must I provide when using get_receitas?**
You need to pass specific start and end dates. The tool accepts defined date ranges, allowing you to monitor state collection—like ICMS or IPVA—for any exact period you specify.

**Are there rate limits when running queries with get_orcamento?**
The server handles standard usage volume. If your query exceeds the underlying API's capacity, your AI client will receive a clear error code telling you to pause or adjust your scope.

**How can I refine search results when calling get_servidores?**
You provide filters for employment status, specific positions, or departments. This lets your agent narrow down thousands of records quickly to only the active employees you're trying to track.

**Can I filter state expenditures by a specific government body?**
Yes. Use the `get_despesas` tool and provide the `codigoOrgao` parameter along with the fiscal year to see spending for a specific department.

**Is it possible to see the salary and position of state employees?**
Yes, the `get_servidores` tool allows you to fetch personnel data, including positions and remuneration, filtered by month, year, and type of bond.

**How can I check the total budget approved for a specific year?**
You can use the `get_orcamento` tool by passing the `exercicio` (year) parameter. It will return data regarding the Annual Budget Law (LOA) and its execution.