Skip to content

Commit 2ef83d6

Browse files
feat(api): add mcp-server package, CI/CD workflows, build scripts, update README
1 parent 6383efa commit 2ef83d6

56 files changed

Lines changed: 8491 additions & 49 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.dockerignore

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# Dependencies
2+
node_modules/
3+
**/node_modules/
4+
5+
# Build outputs
6+
dist/
7+
**/dist/
8+
9+
# Git
10+
.git/
11+
.gitignore
12+
13+
# CI/CD
14+
.github/
15+
.gitlab-ci.yml
16+
.travis.yml
17+
18+
# IDE
19+
.vscode/
20+
.idea/
21+
*.swp
22+
*.swo
23+
*~
24+
25+
# OS
26+
.DS_Store
27+
Thumbs.db
28+
29+
# Testing
30+
test/
31+
tests/
32+
__tests__/
33+
*.test.js
34+
*.spec.js
35+
coverage/
36+
.nyc_output/
37+
38+
# Logs
39+
*.log
40+
npm-debug.log*
41+
yarn-debug.log*
42+
yarn-error.log*
43+
44+
# Environment
45+
.env
46+
.env.*
47+
48+
# Temporary files
49+
*.tmp
50+
*.temp
51+
.cache/
52+
53+
# Examples and scripts
54+
examples/
55+
bin/
56+
57+
# Other packages (we only need mcp-server)
58+
packages/*/
59+
!packages/mcp-server/

.github/workflows/ci.yml

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
- name: Set up Node
2525
uses: actions/setup-node@v4
2626
with:
27-
node-version: '20'
27+
node-version: '22'
2828

2929
- name: Bootstrap
3030
run: ./scripts/bootstrap
@@ -46,7 +46,7 @@ jobs:
4646
- name: Set up Node
4747
uses: actions/setup-node@v4
4848
with:
49-
node-version: '20'
49+
node-version: '22'
5050

5151
- name: Bootstrap
5252
run: ./scripts/bootstrap
@@ -72,6 +72,17 @@ jobs:
7272
AUTH: ${{ steps.github-oidc.outputs.github_token }}
7373
SHA: ${{ github.sha }}
7474
run: ./scripts/utils/upload-artifact.sh
75+
76+
- name: Upload MCP Server tarball
77+
if: |-
78+
github.repository == 'stainless-sdks/lithic-typescript' &&
79+
!startsWith(github.ref, 'refs/heads/stl/')
80+
env:
81+
URL: https://pkg.stainless.com/s?subpackage=mcp-server
82+
AUTH: ${{ steps.github-oidc.outputs.github_token }}
83+
SHA: ${{ github.sha }}
84+
BASE_PATH: packages/mcp-server
85+
run: ./scripts/utils/upload-artifact.sh
7586
test:
7687
timeout-minutes: 10
7788
name: test
@@ -83,11 +94,14 @@ jobs:
8394
- name: Set up Node
8495
uses: actions/setup-node@v4
8596
with:
86-
node-version: '20'
97+
node-version: '22'
8798

8899
- name: Bootstrap
89100
run: ./scripts/bootstrap
90101

102+
- name: Build
103+
run: ./scripts/build
104+
91105
- name: Run tests
92106
run: ./scripts/test
93107
examples:

.github/workflows/publish-npm.yml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
name: Publish NPM
55
on:
66
workflow_dispatch:
7+
inputs:
8+
path:
9+
description: The path to run the release in, e.g. '.' or 'packages/mcp-server'
10+
required: true
711

812
release:
913
types: [published]
@@ -12,6 +16,8 @@ jobs:
1216
publish:
1317
name: publish
1418
runs-on: ubuntu-latest
19+
permissions:
20+
contents: write
1521

1622
steps:
1723
- uses: actions/checkout@v6
@@ -27,6 +33,18 @@ jobs:
2733
2834
- name: Publish to NPM
2935
run: |
30-
bash ./bin/publish-npm
36+
if [ -n "${{ github.event.inputs.path }}" ]; then
37+
PATHS_RELEASED='[\"${{ github.event.inputs.path }}\"]'
38+
else
39+
PATHS_RELEASED='[\".\", \"packages/mcp-server\"]'
40+
fi
41+
yarn tsn scripts/publish-packages.ts "{ \"paths_released\": \"$PATHS_RELEASED\" }"
3142
env:
3243
NPM_TOKEN: ${{ secrets.LITHIC_NPM_TOKEN || secrets.NPM_TOKEN }}
44+
45+
- name: Upload MCP Server DXT GitHub release asset
46+
run: |
47+
gh release upload ${{ github.event.release.tag_name }} \
48+
packages/mcp-server/lithic_api.mcpb
49+
env:
50+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@ dist-deno
88
/*.tgz
99
.idea/
1010
.eslintcache
11-
11+
dist-bundle
12+
*.mcpb

.prettierignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ CHANGELOG.md
44
/deno
55

66
# don't format tsc output, will break source maps
7-
/dist
7+
dist

.stats.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
configured_endpoints: 189
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic%2Flithic-c37843d1525e87f47a292bf11a6fdcc277157556da21c923cc1b4a4473147ef0.yml
3-
openapi_spec_hash: 29a8c4637c8a00339aa0095a929a6096
4-
config_hash: 8799cfd589579f105ef8696a6d664c71
1+
configured_endpoints: 190
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic%2Flithic-e88a4837037207e9591d48d534bd61acca57ca6e7c59ec0d4fdcf6e05288cc6d.yml
3+
openapi_spec_hash: fd8bbc173d1b6dafd117fb1a3a3d446c
4+
config_hash: f227b67dc32a8917717490e63f855d42

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,15 @@ This library provides convenient access to the Lithic REST API from server-side
66

77
The REST API documentation can be found on [docs.lithic.com](https://docs.lithic.com). The full API of this library can be found in [api.md](api.md).
88

9+
## MCP Server
10+
11+
Use the Lithic MCP Server to enable AI assistants to interact with this API, allowing them to explore endpoints, make test requests, and use documentation to help integrate this SDK into your application.
12+
13+
[![Add to Cursor](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en-US/install-mcp?name=lithic-mcp&config=eyJuYW1lIjoibGl0aGljLW1jcCIsInRyYW5zcG9ydC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aIi8+PC9zdmc+)](https://vscode.stainless.com/mcp/%7B%22name%22%3A%22lithic-mcp%22%2C%22type%22%3A%22http%22%2C%22url%22%3A%22https%3A%2F%2Flithic.stlmcp.com%22%2C%22headers%22%3A%7B%22x-lithic-api-key%22%3A%22My%20Lithic%20API%20Key%22%7D%7D)
15+
16+
> Note: You may need to set environment variables in your MCP client.
17+
918
## Installation
1019

1120
```sh

api.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ Types:
8484

8585
- <code><a href="./src/resources/auth-rules/v2/v2.ts">AuthRule</a></code>
8686
- <code><a href="./src/resources/auth-rules/v2/v2.ts">AuthRuleCondition</a></code>
87+
- <code><a href="./src/resources/auth-rules/v2/v2.ts">AuthRuleVersion</a></code>
8788
- <code><a href="./src/resources/auth-rules/v2/v2.ts">BacktestStats</a></code>
8889
- <code><a href="./src/resources/auth-rules/v2/v2.ts">Conditional3DSActionParameters</a></code>
8990
- <code><a href="./src/resources/auth-rules/v2/v2.ts">ConditionalACHActionParameters</a></code>
@@ -102,6 +103,7 @@ Types:
102103
- <code><a href="./src/resources/auth-rules/v2/v2.ts">VelocityLimitParams</a></code>
103104
- <code><a href="./src/resources/auth-rules/v2/v2.ts">VelocityLimitPeriod</a></code>
104105
- <code><a href="./src/resources/auth-rules/v2/v2.ts">V2ListResultsResponse</a></code>
106+
- <code><a href="./src/resources/auth-rules/v2/v2.ts">V2ListVersionsResponse</a></code>
105107
- <code><a href="./src/resources/auth-rules/v2/v2.ts">V2RetrieveFeaturesResponse</a></code>
106108
- <code><a href="./src/resources/auth-rules/v2/v2.ts">V2RetrieveReportResponse</a></code>
107109

@@ -114,6 +116,7 @@ Methods:
114116
- <code title="delete /v2/auth_rules/{auth_rule_token}">client.authRules.v2.<a href="./src/resources/auth-rules/v2/v2.ts">delete</a>(authRuleToken) -> void</code>
115117
- <code title="post /v2/auth_rules/{auth_rule_token}/draft">client.authRules.v2.<a href="./src/resources/auth-rules/v2/v2.ts">draft</a>(authRuleToken, { ...params }) -> AuthRule</code>
116118
- <code title="get /v2/auth_rules/results">client.authRules.v2.<a href="./src/resources/auth-rules/v2/v2.ts">listResults</a>({ ...params }) -> V2ListResultsResponsesCursorPage</code>
119+
- <code title="get /v2/auth_rules/{auth_rule_token}/versions">client.authRules.v2.<a href="./src/resources/auth-rules/v2/v2.ts">listVersions</a>(authRuleToken) -> V2ListVersionsResponse</code>
117120
- <code title="post /v2/auth_rules/{auth_rule_token}/promote">client.authRules.v2.<a href="./src/resources/auth-rules/v2/v2.ts">promote</a>(authRuleToken) -> AuthRule</code>
118121
- <code title="get /v2/auth_rules/{auth_rule_token}/features">client.authRules.v2.<a href="./src/resources/auth-rules/v2/v2.ts">retrieveFeatures</a>(authRuleToken, { ...params }) -> V2RetrieveFeaturesResponse</code>
119122
- <code title="get /v2/auth_rules/{auth_rule_token}/report">client.authRules.v2.<a href="./src/resources/auth-rules/v2/v2.ts">retrieveReport</a>(authRuleToken, { ...params }) -> V2RetrieveReportResponse</code>

eslint.config.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export default tseslint.config(
3434
},
3535
},
3636
{
37-
files: ['tests/**', 'examples/**'],
37+
files: ['tests/**', 'examples/**', 'packages/**'],
3838
rules: {
3939
'no-restricted-imports': 'off',
4040
},

packages/mcp-server/Dockerfile

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# Dockerfile for Lithic MCP Server
2+
#
3+
# This Dockerfile builds a Docker image for the MCP Server.
4+
#
5+
# To build the image locally:
6+
# docker build -f packages/mcp-server/Dockerfile -t lithic-mcp:local .
7+
#
8+
# To run the image:
9+
# docker run -i lithic-mcp:local [OPTIONS]
10+
#
11+
# Common options:
12+
# --tool=<name> Include specific tools
13+
# --resource=<name> Include tools for specific resources
14+
# --operation=read|write Filter by operation type
15+
# --client=<type> Set client compatibility (e.g., claude, cursor)
16+
# --transport=<type> Set transport type (stdio or http)
17+
#
18+
# For a full list of options:
19+
# docker run -i lithic-mcp:local --help
20+
#
21+
# Note: The MCP server uses stdio transport by default. Docker's -i flag
22+
# enables interactive mode, allowing the container to communicate over stdin/stdout.
23+
24+
# Build stage
25+
FROM node:24-alpine AS builder
26+
27+
# Install bash for build script
28+
RUN apk add --no-cache bash openssl
29+
30+
# Set working directory
31+
WORKDIR /build
32+
33+
# Copy entire repository
34+
COPY . .
35+
36+
# Install all dependencies and build everything
37+
RUN yarn install --frozen-lockfile && \
38+
yarn build
39+
40+
FROM denoland/deno:alpine-2.7.1
41+
42+
# Install node and npm
43+
RUN apk add --no-cache nodejs npm
44+
45+
ENV LD_LIBRARY_PATH=/usr/lib:/usr/local/lib
46+
47+
# Add non-root user
48+
RUN addgroup -g 1001 -S nodejs && adduser -S nodejs -u 1001
49+
50+
# Set working directory
51+
WORKDIR /app
52+
53+
# Copy the built mcp-server dist directory
54+
COPY --from=builder /build/packages/mcp-server/dist ./
55+
56+
# Copy node_modules from mcp-server (includes all production deps)
57+
COPY --from=builder /build/packages/mcp-server/node_modules ./node_modules
58+
59+
# Copy the built lithic into node_modules
60+
COPY --from=builder /build/dist ./node_modules/lithic
61+
62+
# Change ownership to nodejs user
63+
RUN chown -R nodejs:nodejs /app
64+
RUN chown -R nodejs:nodejs /deno-dir
65+
66+
# Switch to non-root user
67+
USER nodejs
68+
69+
# The MCP server uses stdio transport by default
70+
# No exposed ports needed for stdio communication
71+
72+
# Set the entrypoint to the MCP server
73+
ENTRYPOINT ["node", "index.js"]
74+
75+
# Allow passing arguments to the MCP server
76+
CMD []

0 commit comments

Comments
 (0)