|
| 1 | +# Lithic TypeScript MCP Server |
| 2 | + |
| 3 | +## Installation |
| 4 | + |
| 5 | +### Direct invocation |
| 6 | + |
| 7 | +You can run the MCP Server directly via `npx`: |
| 8 | + |
| 9 | +```sh |
| 10 | +export LITHIC_API_KEY="My Lithic API Key" |
| 11 | +export LITHIC_WEBHOOK_SECRET="My Webhook Secret" |
| 12 | +export LITHIC_ENVIRONMENT="production" |
| 13 | +npx -y lithic-mcp@latest |
| 14 | +``` |
| 15 | + |
| 16 | +### Via MCP Client |
| 17 | + |
| 18 | +There is a partial list of existing clients at [modelcontextprotocol.io](https://modelcontextprotocol.io/clients). If you already |
| 19 | +have a client, consult their documentation to install the MCP server. |
| 20 | + |
| 21 | +For clients with a configuration JSON, it might look something like this: |
| 22 | + |
| 23 | +```json |
| 24 | +{ |
| 25 | + "mcpServers": { |
| 26 | + "lithic_api": { |
| 27 | + "command": "npx", |
| 28 | + "args": ["-y", "lithic-mcp"], |
| 29 | + "env": { |
| 30 | + "LITHIC_API_KEY": "My Lithic API Key", |
| 31 | + "LITHIC_WEBHOOK_SECRET": "My Webhook Secret", |
| 32 | + "LITHIC_ENVIRONMENT": "production" |
| 33 | + } |
| 34 | + } |
| 35 | + } |
| 36 | +} |
| 37 | +``` |
| 38 | + |
| 39 | +### Cursor |
| 40 | + |
| 41 | +If you use Cursor, you can install the MCP server by using the button below. You will need to set your environment variables |
| 42 | +in Cursor's `mcp.json`, which can be found in Cursor Settings > Tools & MCP > New MCP Server. |
| 43 | + |
| 44 | +[](https://cursor.com/en-US/install-mcp?name=lithic-mcp&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsImxpdGhpYy1tY3AiXSwiZW52Ijp7IkxJVEhJQ19BUElfS0VZIjoiU2V0IHlvdXIgTElUSElDX0FQSV9LRVkgaGVyZS4iLCJMSVRISUNfV0VCSE9PS19TRUNSRVQiOiJTZXQgeW91ciBMSVRISUNfV0VCSE9PS19TRUNSRVQgaGVyZS4ifX0) |
| 45 | + |
| 46 | +### VS Code |
| 47 | + |
| 48 | +If you use MCP, you can install the MCP server by clicking the link below. You will need to set your environment variables |
| 49 | +in VS Code's `mcp.json`, which can be found via Command Palette > MCP: Open User Configuration. |
| 50 | + |
| 51 | +[Open VS Code](https://vscode.stainless.com/mcp/%7B%22name%22%3A%22lithic-mcp%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22lithic-mcp%22%5D%2C%22env%22%3A%7B%22LITHIC_API_KEY%22%3A%22Set%20your%20LITHIC_API_KEY%20here.%22%2C%22LITHIC_WEBHOOK_SECRET%22%3A%22Set%20your%20LITHIC_WEBHOOK_SECRET%20here.%22%7D%7D) |
| 52 | + |
| 53 | +### Claude Code |
| 54 | + |
| 55 | +If you use Claude Code, you can install the MCP server by running the command below in your terminal. You will need to set your |
| 56 | +environment variables in Claude Code's `.claude.json`, which can be found in your home directory. |
| 57 | + |
| 58 | +``` |
| 59 | +claude mcp add lithic_mcp_api --env LITHIC_API_KEY="Your LITHIC_API_KEY here." LITHIC_WEBHOOK_SECRET="Your LITHIC_WEBHOOK_SECRET here." -- npx -y lithic-mcp |
| 60 | +``` |
| 61 | + |
| 62 | +## Code Mode |
| 63 | + |
| 64 | +This MCP server is built on the "Code Mode" tool scheme. In this MCP Server, |
| 65 | +your agent will write code against the TypeScript SDK, which will then be executed in an |
| 66 | +isolated sandbox. To accomplish this, the server will expose two tools to your agent: |
| 67 | + |
| 68 | +- The first tool is a docs search tool, which can be used to generically query for |
| 69 | + documentation about your API/SDK. |
| 70 | + |
| 71 | +- The second tool is a code tool, where the agent can write code against the TypeScript SDK. |
| 72 | + The code will be executed in a sandbox environment without web or filesystem access. Then, |
| 73 | + anything the code returns or prints will be returned to the agent as the result of the |
| 74 | + tool call. |
| 75 | + |
| 76 | +Using this scheme, agents are capable of performing very complex tasks deterministically |
| 77 | +and repeatably. |
| 78 | + |
| 79 | +## Running remotely |
| 80 | + |
| 81 | +Launching the client with `--transport=http` launches the server as a remote server using Streamable HTTP transport. The `--port` setting can choose the port it will run on, and the `--socket` setting allows it to run on a Unix socket. |
| 82 | + |
| 83 | +Authorization can be provided via the following headers: |
| 84 | +| Header | Equivalent client option | Security scheme | |
| 85 | +| ------------------ | ------------------------ | --------------- | |
| 86 | +| `x-lithic-api-key` | `apiKey` | ApiKeyAuth | |
| 87 | + |
| 88 | +A configuration JSON for this server might look like this, assuming the server is hosted at `http://localhost:3000`: |
| 89 | + |
| 90 | +```json |
| 91 | +{ |
| 92 | + "mcpServers": { |
| 93 | + "lithic_api": { |
| 94 | + "url": "http://localhost:3000", |
| 95 | + "headers": { |
| 96 | + "x-lithic-api-key": "My Lithic API Key" |
| 97 | + } |
| 98 | + } |
| 99 | + } |
| 100 | +} |
| 101 | +``` |
0 commit comments