Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "7.0.0"
".": "8.0.0"
}
4 changes: 2 additions & 2 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 46
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch%2Ffinch-39e0191e43a9db93c8f35e91d10013f05352a2bedcf7ead6bac437957f6e922e.yml
openapi_spec_hash: 58c2cf578f0736b8c5df957f6a61190b
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch%2Ffinch-f81c5824a9002c980fc0d66c4d52e6cbd8baf7678f5e0f2215909357cff6f82c.yml
openapi_spec_hash: 7714062cac3bb5597b8571172775bc92
config_hash: 0892e2e0eeb0343a022afa62e9080dd1
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
# Changelog

## 8.0.0 (2025-12-18)

Full Changelog: [v7.0.0...v8.0.0](https://github.com/Finch-API/finch-api-node/compare/v7.0.0...v8.0.0)

### ⚠ BREAKING CHANGES

* **mcp:** remove deprecated tool schemes
* **mcp:** **Migration:** To migrate, simply modify the command used to invoke the MCP server. Currently, the only supported tool scheme is code mode. Now, starting the server with just `node /path/to/mcp/server` or `npx package-name` will invoke code tools: changing your command to one of these is likely all you will need to do.

### Bug Fixes

* **mcp:** pass base url to code tool ([631bb5c](https://github.com/Finch-API/finch-api-node/commit/631bb5c63a966a3227a94488d92b135457075dad))


### Chores

* **mcp:** remove deprecated tool schemes ([9b1ff85](https://github.com/Finch-API/finch-api-node/commit/9b1ff85ec8bfb1195a63f8d16174800735c6997a))

## 7.0.0 (2025-12-17)

Full Changelog: [v6.38.0...v7.0.0](https://github.com/Finch-API/finch-api-node/compare/v6.38.0...v7.0.0)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tryfinch/finch-api",
"version": "7.0.0",
"version": "8.0.0",
"description": "The official TypeScript library for the Finch API",
"author": "Finch <founders@tryfinch.com>",
"types": "dist/index.d.ts",
Expand Down
314 changes: 13 additions & 301 deletions packages/mcp-server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ For clients with a configuration JSON, it might look something like this:
"mcpServers": {
"tryfinch_finch_api_api": {
"command": "npx",
"args": ["-y", "@tryfinch/finch-api-mcp", "--client=claude", "--tools=dynamic"],
"args": ["-y", "@tryfinch/finch-api-mcp"],
"env": {
"FINCH_ACCESS_TOKEN": "My Access Token",
"FINCH_CLIENT_ID": "4ab15e51-11ad-49f4-acae-f343b7794375",
Expand Down Expand Up @@ -63,110 +63,22 @@ environment variables in Claude Code's `.claude.json`, which can be found in you
claude mcp add --transport stdio tryfinch_finch_api_api --env FINCH_ACCESS_TOKEN="Your FINCH_ACCESS_TOKEN here." FINCH_CLIENT_ID="Your FINCH_CLIENT_ID here." FINCH_CLIENT_SECRET="Your FINCH_CLIENT_SECRET here." FINCH_WEBHOOK_SECRET="Your FINCH_WEBHOOK_SECRET here." -- npx -y @tryfinch/finch-api-mcp
```

## Exposing endpoints to your MCP Client
## Code Mode

There are three ways to expose endpoints as tools in the MCP server:
This MCP server is built on the "Code Mode" tool scheme. In this MCP Server,
your agent will write code against the TypeScript SDK, which will then be executed in an
isolated sandbox. To accomplish this, the server will expose two tools to your agent:

1. Exposing one tool per endpoint, and filtering as necessary
2. Exposing a set of tools to dynamically discover and invoke endpoints from the API
3. Exposing a docs search tool and a code execution tool, allowing the client to write code to be executed against the TypeScript client
- The first tool is a docs search tool, which can be used to generically query for
documentation about your API/SDK.

### Filtering endpoints and tools
- The second tool is a code tool, where the agent can write code against the TypeScript SDK.
The code will be executed in a sandbox environment without web or filesystem access. Then,
anything the code returns or prints will be returned to the agent as the result of the
tool call.

You can run the package on the command line to discover and filter the set of tools that are exposed by the
MCP Server. This can be helpful for large APIs where including all endpoints at once is too much for your AI's
context window.

You can filter by multiple aspects:

- `--tool` includes a specific tool by name
- `--resource` includes all tools under a specific resource, and can have wildcards, e.g. `my.resource*`
- `--operation` includes just read (get/list) or just write operations

### Dynamic tools

If you specify `--tools=dynamic` to the MCP server, instead of exposing one tool per endpoint in the API, it will
expose the following tools:

1. `list_api_endpoints` - Discovers available endpoints, with optional filtering by search query
2. `get_api_endpoint_schema` - Gets detailed schema information for a specific endpoint
3. `invoke_api_endpoint` - Executes any endpoint with the appropriate parameters

This allows you to have the full set of API endpoints available to your MCP Client, while not requiring that all
of their schemas be loaded into context at once. Instead, the LLM will automatically use these tools together to
search for, look up, and invoke endpoints dynamically. However, due to the indirect nature of the schemas, it
can struggle to provide the correct properties a bit more than when tools are imported explicitly. Therefore,
you can opt-in to explicit tools, the dynamic tools, or both.

See more information with `--help`.

All of these command-line options can be repeated, combined together, and have corresponding exclusion versions (e.g. `--no-tool`).

Use `--list` to see the list of available tools, or see below.

### Code execution

If you specify `--tools=code` to the MCP server, it will expose just two tools:

- `search_docs` - Searches the API documentation and returns a list of markdown results
- `execute` - Runs code against the TypeScript client

This allows the LLM to implement more complex logic by chaining together many API calls without loading
intermediary results into its context window.

The code execution itself happens in a Deno sandbox that has network access only to the base URL for the API.

### Specifying the MCP Client

Different clients have varying abilities to handle arbitrary tools and schemas.

You can specify the client you are using with the `--client` argument, and the MCP server will automatically
serve tools and schemas that are more compatible with that client.

- `--client=<type>`: Set all capabilities based on a known MCP client

- Valid values: `openai-agents`, `claude`, `claude-code`, `cursor`
- Example: `--client=cursor`

Additionally, if you have a client not on the above list, or the client has gotten better
over time, you can manually enable or disable certain capabilities:

- `--capability=<name>`: Specify individual client capabilities
- Available capabilities:
- `top-level-unions`: Enable support for top-level unions in tool schemas
- `valid-json`: Enable JSON string parsing for arguments
- `refs`: Enable support for $ref pointers in schemas
- `unions`: Enable support for union types (anyOf) in schemas
- `formats`: Enable support for format validations in schemas (e.g. date-time, email)
- `tool-name-length=N`: Set maximum tool name length to N characters
- Example: `--capability=top-level-unions --capability=tool-name-length=40`
- Example: `--capability=top-level-unions,tool-name-length=40`

### Examples

1. Filter for read operations on cards:

```bash
--resource=cards --operation=read
```

2. Exclude specific tools while including others:

```bash
--resource=cards --no-tool=create_cards
```

3. Configure for Cursor client with custom max tool name length:

```bash
--client=cursor --capability=tool-name-length=40
```

4. Complex filtering with multiple criteria:

```bash
--resource=cards,accounts --operation=read --tag=kyc --no-tool=create_cards
```
Using this scheme, agents are capable of performing very complex tasks deterministically
and repeatably.

## Running remotely

Expand Down Expand Up @@ -194,203 +106,3 @@ A configuration JSON for this server might look like this, assuming the server i
}
}
```

The command-line arguments for filtering tools and specifying clients can also be used as query parameters in the URL.
For example, to exclude specific tools while including others, use the URL:

```
http://localhost:3000?resource=cards&resource=accounts&no_tool=create_cards
```

Or, to configure for the Cursor client, with a custom max tool name length, use the URL:

```
http://localhost:3000?client=cursor&capability=tool-name-length%3D40
```

## Importing the tools and server individually

```js
// Import the server, generated endpoints, or the init function
import { server, endpoints, init } from "@tryfinch/finch-api-mcp/server";

// import a specific tool
import createAccessTokens from "@tryfinch/finch-api-mcp/tools/access-tokens/create-access-tokens";

// initialize the server and all endpoints
init({ server, endpoints });

// manually start server
const transport = new StdioServerTransport();
await server.connect(transport);

// or initialize your own server with specific tools
const myServer = new McpServer(...);

// define your own endpoint
const myCustomEndpoint = {
tool: {
name: 'my_custom_tool',
description: 'My custom tool',
inputSchema: zodToJsonSchema(z.object({ a_property: z.string() })),
},
handler: async (client: client, args: any) => {
return { myResponse: 'Hello world!' };
})
};

// initialize the server with your custom endpoints
init({ server: myServer, endpoints: [createAccessTokens, myCustomEndpoint] });
```

## Available Tools

The following tools are available in this MCP server.

### Resource `access_tokens`:

- `create_access_tokens` (`write`): Exchange the authorization code for an access token

### Resource `hris.company`:

- `retrieve_hris_company` (`read`): Read basic company data

### Resource `hris.company.pay_statement_item`:

- `list_company_hris_pay_statement_item` (`read`): **Beta:** this endpoint currently serves employers onboarded after March 4th and historical support will be added soon
Retrieve a list of detailed pay statement items for the access token's connection account.

### Resource `hris.company.pay_statement_item.rules`:

- `create_pay_statement_item_company_hris_rules` (`write`): **Beta:** this endpoint currently serves employers onboarded after March 4th and historical support will be added soon
Custom rules can be created to associate specific attributes to pay statement items depending on the use case. For example, pay statement items that meet certain conditions can be labeled as a pre-tax 401k. This metadata can be retrieved where pay statement item information is available.
- `update_pay_statement_item_company_hris_rules` (`write`): **Beta:** this endpoint currently serves employers onboarded after March 4th and historical support will be added soon
Update a rule for a pay statement item.
- `list_pay_statement_item_company_hris_rules` (`read`): **Beta:** this endpoint currently serves employers onboarded after March 4th and historical support will be added soon
List all rules of a connection account.
- `delete_pay_statement_item_company_hris_rules` (`write`): **Beta:** this endpoint currently serves employers onboarded after March 4th and historical support will be added soon
Delete a rule for a pay statement item.

### Resource `hris.directory`:

- `list_hris_directory` (`read`): Read company directory and organization structure

### Resource `hris.individuals`:

- `retrieve_many_hris_individuals` (`write`): Read individual data, excluding income and employment data

### Resource `hris.employments`:

- `retrieve_many_hris_employments` (`write`): Read individual employment and income data

### Resource `hris.payments`:

- `list_hris_payments` (`read`): Read payroll and contractor related payments by the company.

### Resource `hris.pay_statements`:

- `retrieve_many_hris_pay_statements` (`write`): Read detailed pay statements for each individual.

Deduction and contribution types are supported by the payroll systems that supports Benefits.

### Resource `hris.documents`:

- `list_hris_documents` (`read`): **Beta:** This endpoint is in beta and may change.
Retrieve a list of company-wide documents.
- `retreive_hris_documents` (`read`): **Beta:** This endpoint is in beta and may change.
Retrieve details of a specific document by its ID.

### Resource `hris.benefits`:

- `create_hris_benefits` (`write`): Creates a new company-wide deduction or contribution. Please use the `/providers` endpoint to view available types for each provider.
- `retrieve_hris_benefits` (`read`): Lists deductions and contributions information for a given item
- `update_hris_benefits` (`write`): Updates an existing company-wide deduction or contribution
- `list_hris_benefits` (`read`): List all company-wide deductions and contributions.
- `list_supported_benefits_hris_benefits` (`read`): Get deductions metadata

### Resource `hris.benefits.individuals`:

- `enroll_many_benefits_hris_individuals` (`write`): Enroll an individual into a deduction or contribution. This is an overwrite operation. If the employee is already enrolled, the enrollment amounts will be adjusted. Making the same request multiple times will not create new enrollments, but will continue to set the state of the existing enrollment.
- `enrolled_ids_benefits_hris_individuals` (`read`): Lists individuals currently enrolled in a given deduction.
- `retrieve_many_benefits_benefits_hris_individuals` (`read`): Get enrollment information for the given individuals.
- `unenroll_many_benefits_hris_individuals` (`write`): Unenroll individuals from a deduction or contribution

### Resource `providers`:

- `list_providers` (`read`): Return details on all available payroll and HR systems.

### Resource `account`:

- `disconnect_account` (`write`): Disconnect one or more `access_token`s from your application.
- `introspect_account` (`read`): Read account information associated with an `access_token`

### Resource `request_forwarding`:

- `forward_request_forwarding` (`write`): The Forward API allows you to make direct requests to an employment system. If Finch's unified API
doesn't have a data model that cleanly fits your needs, then Forward allows you to push or pull
data models directly against an integration's API.

### Resource `jobs.automated`:

- `create_jobs_automated` (`write`): Enqueue an automated job.

`data_sync_all`: Enqueue a job to re-sync all data for a connection. `data_sync_all` has a concurrency limit of 1 job at a time per connection. This means that if this endpoint is called while a job is already in progress for this connection, Finch will return the `job_id` of the job that is currently in progress. Finch allows a fixed window rate limit of 1 forced refresh per hour per connection.

`w4_form_employee_sync`: Enqueues a job for sync W-4 data for a particular individual, identified by `individual_id`. This feature is currently in beta.

This endpoint is available for _Scale_ tier customers as an add-on. To request access to this endpoint, please contact your Finch account manager.

- `retrieve_jobs_automated` (`read`): Get an automated job by `job_id`.
- `list_jobs_automated` (`read`): Get all automated jobs. Automated jobs are completed by a machine. By default, jobs are sorted in descending order by submission time. For scheduled jobs such as data syncs, only the next scheduled job is shown.

### Resource `jobs.manual`:

- `retrieve_jobs_manual` (`read`): Get a manual job by `job_id`. Manual jobs are completed by a human and include Assisted Benefits jobs.

### Resource `sandbox.connections`:

- `create_sandbox_connections` (`write`): Create a new connection (new company/provider pair) with a new account

### Resource `sandbox.connections.accounts`:

- `create_connections_sandbox_accounts` (`write`): Create a new account for an existing connection (company/provider pair)
- `update_connections_sandbox_accounts` (`write`): Update an existing sandbox account. Change the connection status to understand how the Finch API responds.

### Resource `sandbox.company`:

- `update_sandbox_company` (`write`): Update a sandbox company's data

### Resource `sandbox.directory`:

- `create_sandbox_directory` (`write`): Add new individuals to a sandbox company

### Resource `sandbox.individual`:

- `update_sandbox_individual` (`write`): Update sandbox individual

### Resource `sandbox.employment`:

- `update_sandbox_employment` (`write`): Update sandbox employment

### Resource `sandbox.payment`:

- `create_sandbox_payment` (`write`): Add a new sandbox payment

### Resource `sandbox.jobs`:

- `create_sandbox_jobs` (`write`): Enqueue a new sandbox job

### Resource `sandbox.jobs.configuration`:

- `retrieve_jobs_sandbox_configuration` (`read`): Get configurations for sandbox jobs
- `update_jobs_sandbox_configuration` (`write`): Update configurations for sandbox jobs

### Resource `payroll.pay_groups`:

- `retrieve_payroll_pay_groups` (`read`): Read information from a single pay group
- `list_payroll_pay_groups` (`read`): Read company pay groups and frequencies

### Resource `connect.sessions`:

- `new_connect_sessions` (`write`): Create a new connect session for an employer
- `reauthenticate_connect_sessions` (`write`): Create a new Connect session for reauthenticating an existing connection
2 changes: 1 addition & 1 deletion packages/mcp-server/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tryfinch/finch-api-mcp",
"version": "7.0.0",
"version": "8.0.0",
"description": "The official MCP Server for the Finch API",
"author": "Finch <founders@tryfinch.com>",
"types": "dist/index.d.ts",
Expand Down
Loading