npm package: @messari/sdk-ts-mcp
Description: The official MCP Server for the Messari SDK API
Author: Messari SDK
Latest version: 0.4.0

# Messari SDK TypeScript MCP Server

It is generated with [Stainless](https://www.stainless.com/).

## Installation

### Direct invocation

You can run the MCP Server directly via `npx`:

```sh
export MESSARI_SDK_API_KEY="My API Key"
npx -y @messari/sdk-ts-mcp@latest
```

### Via MCP Client

There is a partial list of existing clients at [modelcontextprotocol.io](https://modelcontextprotocol.io/clients). If you already
have a client, consult their documentation to install the MCP server.

For clients with a configuration JSON, it might look something like this:

```json
{
  "mcpServers": {
    "messari_sdk_ts_api": {
      "command": "npx",
      "args": ["-y", "@messari/sdk-ts-mcp", "--client=claude", "--tools=dynamic"],
      "env": {
        "MESSARI_SDK_API_KEY": "My API Key"
      }
    }
  }
}
```

## Exposing endpoints to your MCP Client

There are two ways to expose endpoints as tools in the MCP server:

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

### Filtering endpoints and tools

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.

### 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
```

## Importing the tools and server individually

```js
// Import the server, generated endpoints, or the init function
import { server, endpoints, init } from "@messari/sdk-ts-mcp/server";

// import a specific tool
import generateCompletionOpenAIAIChat from "@messari/sdk-ts-mcp/tools/ai/openai/chat/generate-completion-openai-ai-chat";

// 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: [generateCompletionOpenAIAIChat, myCustomEndpoint] });
```

## Available Tools

The following tools are available in this MCP server.

### Resource `ai.openai.chat`:

- `generate_completion_openai_ai_chat` (`write`): Processes a conversation and returns an AI-generated response in OpenAI-compatible format. Consumes 5 credits per request.

### Resource `ai.v1.agent`:

- `generate_signal_v1_ai_agent` (`write`): Provides crypto market and social signals by processing user queries through an LLM that accesses Messari's research and data. Consumes 1 credit per request.

### Resource `ai.v1.classification`:

- `extract_entities_v1_ai_classification` (`write`): Extract entities from a user message by calling an LLM and doing searches in the internal database. Consumes 1 credit per request.

### Resource `ai.v2.chat`:

- `create_completion_v2_ai_chat` (`write`): Processes a conversation and returns an AI-generated response with Messari's standard format. Consumes 5 credits per request.

### Resource `funding.v1`:

- `list_acquisition_deals_funding_v1` (`read`): Lookup M&A Deals given a set of filters.
- `list_organizations_funding_v1` (`read`): Lookup Organizations given a set of filters.
- `list_projects_funding_v1` (`read`): Lookup Projects given a set of filters.

### Resource `funding.v1.funds`:

- `list_v1_funding_funds` (`read`): Lookup Funds given a set of filters.
- `list_managers_v1_funding_funds` (`read`): Lookup the Managers of a set of Funds defined by the filters. Filters are applied to the Funds, and then their Managers are returned.

### Resource `funding.v1.rounds`:

- `list_v1_funding_rounds` (`read`): Lookup Funding Rounds given a set of filters.
- `list_investors_v1_funding_rounds` (`read`): Lookup Investors that participated in a set of Funding Rounds given a set of filters. Filters are applied to the Funding Rounds, and then their Investors are returned.

### Resource `metrics.v1.exchanges`:

- `retrieve_v1_metrics_exchanges` (`read`): Retrieve a specific exchange
- `list_v1_metrics_exchanges` (`read`): Retrieve a list of exchanges

### Resource `metrics.v1.exchanges.metrics`:

- `list_exchanges_v1_metrics_metrics` (`read`): Get metric catalog of datasets for exchanges.

### Resource `metrics.v1.exchanges.metrics.time_series`:

- `retrieve_metrics_exchanges_v1_metrics_time_series` (`read`): Retrieve a specific exchange's timeseries data
- `retrieve_with_granularity_metrics_exchanges_v1_metrics_time_series` (`read`): Retrieve a specific exchange's timeseries data

### Resource `metrics.v1.markets`:

- `retrieve_v1_metrics_markets` (`read`): Retrieve a specific market
- `list_v1_metrics_markets` (`read`): Retrieve a list of markets

### Resource `metrics.v1.markets.metrics`:

- `list_markets_v1_metrics_metrics` (`read`): Get metric catalog of datasets for markets.

### Resource `metrics.v1.markets.metrics.time_series`:

- `retrieve_metrics_markets_v1_metrics_time_series` (`read`): Retrieve a specific market's timeseries data
- `retrieve_with_granularity_metrics_markets_v1_metrics_time_series` (`read`): Retrieve a specific market's timeseries data

### Resource `metrics.v1.networks`:

- `retrieve_v1_metrics_networks` (`read`): Retrieve a specific network
- `list_v1_metrics_networks` (`read`): Retrieve a list of networks

### Resource `metrics.v2.assets`:

- `list_v2_metrics_assets` (`read`): Retrieve a list of assets
- `retrieve_ath_v2_metrics_assets` (`read`): Retrieve a specific asset's ATH
- `retrieve_details_v2_metrics_assets` (`read`): Retrieve a specific asset's details
- `retrieve_roi_v2_metrics_assets` (`read`): Retrieve a specific asset's ROI

### Resource `metrics.v2.assets.metrics`:

- `list_assets_v2_metrics_metrics` (`read`): Get metric catalog of datasets for assets.

### Resource `metrics.v2.assets.metrics.time_series`:

- `retrieve_metrics_assets_v2_metrics_time_series` (`read`): Retrieve a specific asset's timeseries data
- `retrieve_with_granularity_metrics_assets_v2_metrics_time_series` (`read`): Retrieve a specific asset's timeseries data

### Resource `metrics.v2.networks`:

- `list_v2_metrics_networks` (`read`): Retrieve a list of networks

### Resource `metrics.v2.networks.metrics`:

- `list_networks_v2_metrics_metrics` (`read`): Get metric catalog of datasets for networks.

### Resource `metrics.v2.networks.metrics.time_series`:

- `retrieve_metrics_networks_v2_metrics_time_series` (`read`): Retrieve a specific network's timeseries data
- `retrieve_with_granularity_metrics_networks_v2_metrics_time_series` (`read`): Retrieve a specific network's timeseries data

### Resource `news.v1.news`:

- `list_assets_v1_news_news` (`read`): Get News Feed Assets
- `list_sources_v1_news_news` (`read`): Get News Sources
- `retrieve_feed_v1_news_news` (`read`): Gets the news feed for the user

### Resource `token_unlocks.v1`:

- `get_allocations_token_unlocks_v1` (`read`): Returns allocation information given a set of asset IDs and optional filters

### Resource `token_unlocks.v1.assets`:

- `list_v1_token_unlocks_assets` (`read`): Returns assets with allocation information given a set of filters
- `get_events_v1_token_unlocks_assets` (`read`): Returns unlock events for a given asset
- `get_unlocks_v1_token_unlocks_assets` (`read`): Returns interval-based unlock timeseries data for a given asset and interval
- `get_vesting_schedule_v1_token_unlocks_assets` (`read`): Returns vesting schedule timeseries data for a given asset

### Resource `user_management.v1.api`:

- `list_permissions_v1_user_management_api` (`read`): Returns all available permissions with flags indicating which ones are granted to the current user

### Resource `user_management.v1.api.credits`:

- `get_allowance_api_v1_user_management_credits` (`read`): Returns the current credit allowance for the team

### Resource `user_management.v1.watchlists`:

- `create_watchlist_v1_user_management_watchlists` (`write`): Create a new watchlist for the authenticated user
- `delete_watchlist_v1_user_management_watchlists` (`write`): Delete a specific watchlist by ID for the authenticated user
- `get_watchlist_v1_user_management_watchlists` (`read`): Get a specific watchlist by ID for the authenticated user
- `list_watchlists_v1_user_management_watchlists` (`read`): Get all watchlists for the authenticated user
- `modify_watchlist_assets_v1_user_management_watchlists` (`write`): Modify the assets in a specific watchlist by ID for the authenticated user

### Resource `signal.v0.assets`:

- `retrieve_v0_signal_assets` (`read`): Retrieve a specific asset
- `list_v0_signal_assets` (`read`): Retrieve a list of Assets

### Resource `signal.v0.assets.time_series.mindshare`:

- `retrieve_time_series_assets_v0_signal_mindshare` (`read`): Retrieve a specific asset's mindshare timeseries data
- `retrieve_with_granularity_time_series_assets_v0_signal_mindshare` (`read`): Retrieve a specific asset's mindshare timeseries data

### Resource `signal.v0.topics`:

- `list_classes_v0_signal_topics` (`read`): Retrieve a list of topic classes

### Resource `signal.v0.topics.global`:

- `list_current_topics_v0_signal_global` (`read`): Retrieve a list of current global topics
- `list_daily_topics_v0_signal_global` (`read`): Retrieve a timeseries of global topics

### Resource `signal.v0.x_users`:

- `retrieve_v0_signal_x_users` (`read`): Retrieve a specific X User
- `list_v0_signal_x_users` (`read`): Get a list of X users

### Resource `signal.v0.x_users.time_series`:

- `retrieve_engagement_x_users_v0_signal_time_series` (`read`): Retrieve a specific X User's engagement timeseries data
- `retrieve_mindshare_with_granularity_x_users_v0_signal_time_series` (`read`): Retrieve a specific X User's mindshare timeseries data