Skip to content

Commit 7fccfb6

Browse files
committed
Removed unnecessary dependency on axios
1 parent 2274463 commit 7fccfb6

6 files changed

Lines changed: 18 additions & 28 deletions

File tree

.changeset/sharp-chicken-follow.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@sei-js/mcp-server": patch
3+
---
4+
5+
Removed unnecessary dependencies

.yarn/install-state.gz

-11.4 KB
Binary file not shown.

packages/mcp-server/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
},
2626
"dependencies": {
2727
"@modelcontextprotocol/sdk": "^1.7.0",
28-
"axios": "^1.10.0",
2928
"cors": "^2.8.5",
3029
"dotenv": "^16.5.0",
3130
"express": "^4.21.2",

packages/mcp-server/src/mintlify/search.ts

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,29 @@
11
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2-
import axios, { AxiosError } from 'axios';
32
import { TrieveSDK } from 'trieve-ts-sdk';
43
import { z } from 'zod';
54

65
import { DEFAULT_BASE_URL, SERVER_URL, SUBDOMAIN } from './config.js';
76
import type { MintlifySearchConfig, SeiSearchResponse, TrieveResponse, TrieveSearchResult } from './types.js';
8-
import { formatErr, throwOnAxiosError } from './utils.js';
7+
import { formatErr } from './utils.js';
98

109
/**
1110
* Fetch Mintlify configuration for the given subdomain
1211
*/
1312
const fetchMintlifyConfig = async (subdomain: string): Promise<MintlifySearchConfig> => {
1413
try {
1514
const url = `${SERVER_URL}/api/mcp/config/${subdomain}`;
16-
const response = await axios.get(url, {
17-
validateStatus() {
18-
return true;
15+
const response = await fetch(url);
16+
17+
if (!response.ok) {
18+
if (response.status === 404) {
19+
throw new Error(`${subdomain} not found`);
1920
}
20-
});
21-
throwOnAxiosError(response, 'Failed to fetch MCP config');
22-
return response.data;
21+
throw new Error(`Failed to fetch MCP config: ${response.status} ${response.statusText}`);
22+
}
23+
24+
return (await response.json()) as MintlifySearchConfig;
2325
} catch (err) {
24-
throw new Error(formatErr(err).replace('Request failed with status code 404', `${subdomain} not found`));
26+
throw new Error(formatErr(err));
2527
}
2628
};
2729

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,9 @@
1-
import type { AxiosError, AxiosResponse } from 'axios';
2-
31
/**
42
* Format error messages for consistent error handling
53
*/
6-
export const formatErr = (err: AxiosError | Error | unknown): string => {
7-
if (err && typeof err === 'object' && 'response' in err) {
8-
const axiosErr = err as AxiosError;
9-
return `Request failed with status code ${axiosErr.response?.status}`;
10-
}
4+
export const formatErr = (err: Error | unknown): string => {
115
if (err instanceof Error) {
126
return err.message;
137
}
148
return String(err);
159
};
16-
17-
/**
18-
* Throw an error if the axios response indicates failure
19-
*/
20-
export const throwOnAxiosError = (response: AxiosResponse, message: string): void => {
21-
if (response.status < 200 || response.status >= 300) {
22-
throw new Error(`${message}: ${response.status} ${response.statusText}`);
23-
}
24-
};

yarn.lock

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3509,7 +3509,6 @@ __metadata:
35093509
"@modelcontextprotocol/sdk": "npm:^1.7.0"
35103510
"@types/cors": "npm:^2.8.17"
35113511
"@types/express": "npm:^5.0.0"
3512-
axios: "npm:^1.10.0"
35133512
cors: "npm:^2.8.5"
35143513
dotenv: "npm:^16.5.0"
35153514
express: "npm:^4.21.2"
@@ -5024,7 +5023,7 @@ __metadata:
50245023
languageName: node
50255024
linkType: hard
50265025

5027-
"axios@npm:^1.10.0, axios@npm:^1.4.0, axios@npm:^1.6.2":
5026+
"axios@npm:^1.4.0, axios@npm:^1.6.2":
50285027
version: 1.10.0
50295028
resolution: "axios@npm:1.10.0"
50305029
dependencies:

0 commit comments

Comments
 (0)