@mcp-monorepo/location 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/fetch-ip-adress.d.ts +3 -0
- package/dist/lib/fetch-ip-adress.d.ts.map +1 -0
- package/dist/lib/fetch-ip-adress.js +17 -0
- package/dist/lib/fetch-ip-adress.js.map +1 -0
- package/dist/lib/format-output.d.ts +23 -0
- package/dist/lib/format-output.d.ts.map +1 -0
- package/dist/lib/format-output.js +38 -0
- package/dist/lib/format-output.js.map +1 -0
- package/dist/lib/ip-utils.d.ts +6 -0
- package/dist/lib/ip-utils.d.ts.map +1 -0
- package/dist/lib/ip-utils.js +24 -0
- package/dist/lib/ip-utils.js.map +1 -0
- package/dist/lib/types.d.ts +18 -0
- package/dist/lib/types.d.ts.map +1 -0
- package/dist/lib/types.js +2 -0
- package/dist/lib/types.js.map +1 -0
- package/dist/tools/get-current-location.d.ts +3 -0
- package/dist/tools/get-current-location.d.ts.map +1 -0
- package/dist/tools/get-current-location.js +18 -0
- package/dist/tools/get-current-location.js.map +1 -0
- package/dist/tools/get-location-by-ip.d.ts +3 -0
- package/dist/tools/get-location-by-ip.d.ts.map +1 -0
- package/dist/tools/get-location-by-ip.js +19 -0
- package/dist/tools/get-location-by-ip.js.map +1 -0
- package/package.json +38 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createMcpServer } from '@mcp-monorepo/shared';
|
|
3
|
+
import { registerGetCurrentLocationTool } from './tools/get-current-location.js';
|
|
4
|
+
import { registerGetLocationByIpTool } from './tools/get-location-by-ip.js';
|
|
5
|
+
createMcpServer({
|
|
6
|
+
name: 'location',
|
|
7
|
+
importMetaPath: import.meta.filename,
|
|
8
|
+
title: 'Location MCP Server',
|
|
9
|
+
tools: [registerGetCurrentLocationTool, registerGetLocationByIpTool],
|
|
10
|
+
});
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAEtD,OAAO,EAAE,8BAA8B,EAAE,MAAM,iCAAiC,CAAA;AAChF,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAA;AAE3E,eAAe,CAAC;IACd,IAAI,EAAE,UAAU;IAChB,cAAc,EAAE,MAAM,CAAC,IAAI,CAAC,QAAQ;IACpC,KAAK,EAAE,qBAAqB;IAC5B,KAAK,EAAE,CAAC,8BAA8B,EAAE,2BAA2B,CAAC;CACrE,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetch-ip-adress.d.ts","sourceRoot":"","sources":["../../src/lib/fetch-ip-adress.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAEpD,wBAAsB,aAAa,CAAC,SAAS,EAAE,MAAM,+BAiBpD"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { isValidIpAddress } from './ip-utils.js';
|
|
2
|
+
export async function fetchIpAdress(ipAddress) {
|
|
3
|
+
if (!isValidIpAddress(ipAddress)) {
|
|
4
|
+
throw new Error(`Invalid IP address format: ${ipAddress}`);
|
|
5
|
+
}
|
|
6
|
+
const url = `http://ip-api.com/json/${ipAddress}?fields=61439`;
|
|
7
|
+
const response = await fetch(url);
|
|
8
|
+
if (!response.ok) {
|
|
9
|
+
throw new Error(`HTTP error! status: ${response.status}`);
|
|
10
|
+
}
|
|
11
|
+
const data = (await response.json());
|
|
12
|
+
if (data.status === 'fail') {
|
|
13
|
+
throw new Error(data.message || 'Failed to fetch location data');
|
|
14
|
+
}
|
|
15
|
+
return data;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=fetch-ip-adress.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetch-ip-adress.js","sourceRoot":"","sources":["../../src/lib/fetch-ip-adress.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAIhD,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,SAAiB;IACnD,IAAI,CAAC,gBAAgB,CAAC,SAAS,CAAC,EAAE,CAAC;QACjC,MAAM,IAAI,KAAK,CAAC,8BAA8B,SAAS,EAAE,CAAC,CAAA;IAC5D,CAAC;IACD,MAAM,GAAG,GAAG,0BAA0B,SAAS,eAAe,CAAA;IAC9D,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,CAAC,CAAA;IAEjC,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CAAC,uBAAuB,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAA;IAC3D,CAAC;IAED,MAAM,IAAI,GAAG,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAuB,CAAA;IAE1D,IAAI,IAAI,CAAC,MAAM,KAAK,MAAM,EAAE,CAAC;QAC3B,MAAM,IAAI,KAAK,CAAC,IAAI,CAAC,OAAO,IAAI,+BAA+B,CAAC,CAAA;IAClE,CAAC;IACD,OAAO,IAAI,CAAA;AACb,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type SchemaTypeOf } from '@mcp-monorepo/shared';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import type { IpLocationResponse } from './types.js';
|
|
4
|
+
export declare const OutputSchema: {
|
|
5
|
+
ipAddress: z.ZodString;
|
|
6
|
+
location: z.ZodString;
|
|
7
|
+
coordinates: z.ZodOptional<z.ZodObject<{
|
|
8
|
+
lat: z.ZodNumber;
|
|
9
|
+
lon: z.ZodNumber;
|
|
10
|
+
}, "strip", z.ZodTypeAny, {
|
|
11
|
+
lat: number;
|
|
12
|
+
lon: number;
|
|
13
|
+
}, {
|
|
14
|
+
lat: number;
|
|
15
|
+
lon: number;
|
|
16
|
+
}>>;
|
|
17
|
+
timezone: z.ZodOptional<z.ZodString>;
|
|
18
|
+
zip: z.ZodOptional<z.ZodString>;
|
|
19
|
+
isp: z.ZodOptional<z.ZodString>;
|
|
20
|
+
org: z.ZodOptional<z.ZodString>;
|
|
21
|
+
};
|
|
22
|
+
export declare function formatter(data: IpLocationResponse): SchemaTypeOf<typeof OutputSchema>;
|
|
23
|
+
//# sourceMappingURL=format-output.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format-output.d.ts","sourceRoot":"","sources":["../../src/lib/format-output.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,sBAAsB,CAAA;AACxD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAEpD,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;CAaxB,CAAA;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,kBAAkB,GAAG,YAAY,CAAC,OAAO,YAAY,CAAC,CAsBrF"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export const OutputSchema = {
|
|
3
|
+
ipAddress: z.string(),
|
|
4
|
+
location: z.string(),
|
|
5
|
+
coordinates: z
|
|
6
|
+
.object({
|
|
7
|
+
lat: z.number(),
|
|
8
|
+
lon: z.number(),
|
|
9
|
+
})
|
|
10
|
+
.optional(),
|
|
11
|
+
timezone: z.string().optional(),
|
|
12
|
+
zip: z.string().optional(),
|
|
13
|
+
isp: z.string().optional(),
|
|
14
|
+
org: z.string().optional(),
|
|
15
|
+
};
|
|
16
|
+
export function formatter(data) {
|
|
17
|
+
const locationParts = [
|
|
18
|
+
...(data.city ? [data.city] : []),
|
|
19
|
+
...(data.regionName ? [data.regionName] : []),
|
|
20
|
+
...(data.country ? [data.country] : []),
|
|
21
|
+
];
|
|
22
|
+
return {
|
|
23
|
+
ipAddress: data.query,
|
|
24
|
+
location: locationParts.join(', ') || 'Unknown location',
|
|
25
|
+
...(data.lat !== undefined &&
|
|
26
|
+
data.lon !== undefined && {
|
|
27
|
+
coordinates: {
|
|
28
|
+
lat: data.lat,
|
|
29
|
+
lon: data.lon,
|
|
30
|
+
},
|
|
31
|
+
}),
|
|
32
|
+
...(data.timezone && { timezone: data.timezone }),
|
|
33
|
+
...(data.zip && { zip: data.zip }),
|
|
34
|
+
...(data.isp && { isp: data.isp }),
|
|
35
|
+
...(data.org && data.org !== data.isp && { org: data.org }),
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=format-output.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format-output.js","sourceRoot":"","sources":["../../src/lib/format-output.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAIvB,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;IACpB,WAAW,EAAE,CAAC;SACX,MAAM,CAAC;QACN,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE;QACf,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE;KAChB,CAAC;SACD,QAAQ,EAAE;IACb,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC/B,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC1B,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC1B,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC3B,CAAA;AAED,MAAM,UAAU,SAAS,CAAC,IAAwB;IAChD,MAAM,aAAa,GAAa;QAC9B,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QACjC,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAC7C,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;KACxC,CAAA;IAED,OAAO;QACL,SAAS,EAAE,IAAI,CAAC,KAAK;QACrB,QAAQ,EAAE,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,kBAAkB;QACxD,GAAG,CAAC,IAAI,CAAC,GAAG,KAAK,SAAS;YACxB,IAAI,CAAC,GAAG,KAAK,SAAS,IAAI;YACxB,WAAW,EAAE;gBACX,GAAG,EAAE,IAAI,CAAC,GAAG;gBACb,GAAG,EAAE,IAAI,CAAC,GAAG;aACd;SACF,CAAC;QACJ,GAAG,CAAC,IAAI,CAAC,QAAQ,IAAI,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC;QACjD,GAAG,CAAC,IAAI,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,CAAC;QAClC,GAAG,CAAC,IAAI,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,CAAC;QAClC,GAAG,CAAC,IAAI,CAAC,GAAG,IAAI,IAAI,CAAC,GAAG,KAAK,IAAI,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,CAAC;KAC5D,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ip-utils.d.ts","sourceRoot":"","sources":["../../src/lib/ip-utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,eAAO,MAAM,gBAAgB,GAAI,IAAI,MAAM,KAAG,OAK7C,CAAA;AAGD,eAAO,MAAM,mBAAmB,QAAa,OAAO,CAAC,MAAM,CAW1D,CAAA"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generic IP address utilities that can be used across multiple MCPs
|
|
3
|
+
*/
|
|
4
|
+
// Validate IP address format (IPv4 and IPv6)
|
|
5
|
+
export const isValidIpAddress = (ip) => {
|
|
6
|
+
const ipv4Regex = /^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/;
|
|
7
|
+
const ipv6Regex = /^(?:[0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$/;
|
|
8
|
+
return ipv4Regex.test(ip) || ipv6Regex.test(ip);
|
|
9
|
+
};
|
|
10
|
+
// Get current public IP address
|
|
11
|
+
export const getCurrentIpAddress = async () => {
|
|
12
|
+
try {
|
|
13
|
+
const response = await fetch('https://api.ipify.org?format=text');
|
|
14
|
+
if (!response.ok) {
|
|
15
|
+
throw new Error(`HTTP error! status: ${response.status}`);
|
|
16
|
+
}
|
|
17
|
+
const ip = await response.text();
|
|
18
|
+
return ip.trim();
|
|
19
|
+
}
|
|
20
|
+
catch (error) {
|
|
21
|
+
throw new Error(`Failed to get current IP address: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=ip-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ip-utils.js","sourceRoot":"","sources":["../../src/lib/ip-utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,6CAA6C;AAC7C,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,EAAU,EAAW,EAAE;IACtD,MAAM,SAAS,GAAG,6FAA6F,CAAA;IAC/G,MAAM,SAAS,GAAG,4CAA4C,CAAA;IAE9D,OAAO,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;AACjD,CAAC,CAAA;AAED,gCAAgC;AAChC,MAAM,CAAC,MAAM,mBAAmB,GAAG,KAAK,IAAqB,EAAE;IAC7D,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,mCAAmC,CAAC,CAAA;QACjE,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;YACjB,MAAM,IAAI,KAAK,CAAC,uBAAuB,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAA;QAC3D,CAAC;QACD,MAAM,EAAE,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAA;QAChC,OAAO,EAAE,CAAC,IAAI,EAAE,CAAA;IAClB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,qCAAqC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,EAAE,CAAC,CAAA;IAClH,CAAC;AACH,CAAC,CAAA"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface IpLocationResponse {
|
|
2
|
+
query: string;
|
|
3
|
+
status: 'success' | 'fail';
|
|
4
|
+
country?: string;
|
|
5
|
+
countryCode?: string;
|
|
6
|
+
region?: string;
|
|
7
|
+
regionName?: string;
|
|
8
|
+
city?: string;
|
|
9
|
+
zip?: string;
|
|
10
|
+
lat?: number;
|
|
11
|
+
lon?: number;
|
|
12
|
+
timezone?: string;
|
|
13
|
+
isp?: string;
|
|
14
|
+
org?: string;
|
|
15
|
+
as?: string;
|
|
16
|
+
message?: string;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/lib/types.ts"],"names":[],"mappings":"AACA,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,SAAS,GAAG,MAAM,CAAA;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/lib/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-current-location.d.ts","sourceRoot":"","sources":["../../src/tools/get-current-location.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;AAExE,eAAO,MAAM,8BAA8B,GAAI,QAAQ,SAAS,SAa5D,CAAA"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { registerTool } from '@mcp-monorepo/shared';
|
|
2
|
+
import { fetchIpAdress } from '../lib/fetch-ip-adress.js';
|
|
3
|
+
import { formatter, OutputSchema } from '../lib/format-output.js';
|
|
4
|
+
import { getCurrentIpAddress } from '../lib/ip-utils.js';
|
|
5
|
+
export const registerGetCurrentLocationTool = (server) => registerTool(server, {
|
|
6
|
+
name: 'get-current-location',
|
|
7
|
+
title: 'Get Current Location',
|
|
8
|
+
description: 'Get current location information based on current IP address.',
|
|
9
|
+
inputSchema: {},
|
|
10
|
+
outputSchema: OutputSchema,
|
|
11
|
+
isReadOnly: true,
|
|
12
|
+
async fetcher() {
|
|
13
|
+
const currentIp = await getCurrentIpAddress();
|
|
14
|
+
return await fetchIpAdress(currentIp);
|
|
15
|
+
},
|
|
16
|
+
formatter: formatter,
|
|
17
|
+
});
|
|
18
|
+
//# sourceMappingURL=get-current-location.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-current-location.js","sourceRoot":"","sources":["../../src/tools/get-current-location.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAEnD,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AACzD,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AACjE,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AAIxD,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAAC,MAAiB,EAAE,EAAE,CAClE,YAAY,CAAC,MAAM,EAAE;IACnB,IAAI,EAAE,sBAAsB;IAC5B,KAAK,EAAE,sBAAsB;IAC7B,WAAW,EAAE,+DAA+D;IAC5E,WAAW,EAAE,EAAE;IACf,YAAY,EAAE,YAAY;IAC1B,UAAU,EAAE,IAAI;IAChB,KAAK,CAAC,OAAO;QACX,MAAM,SAAS,GAAG,MAAM,mBAAmB,EAAE,CAAA;QAC7C,OAAO,MAAM,aAAa,CAAC,SAAS,CAAC,CAAA;IACvC,CAAC;IACD,SAAS,EAAE,SAAS;CACrB,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-location-by-ip.d.ts","sourceRoot":"","sources":["../../src/tools/get-location-by-ip.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;AAExE,eAAO,MAAM,2BAA2B,GAAI,QAAQ,SAAS,SAczD,CAAA"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { registerTool } from '@mcp-monorepo/shared';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { fetchIpAdress } from '../lib/fetch-ip-adress.js';
|
|
4
|
+
import { formatter, OutputSchema } from '../lib/format-output.js';
|
|
5
|
+
export const registerGetLocationByIpTool = (server) => registerTool(server, {
|
|
6
|
+
name: 'get-location-by-ip',
|
|
7
|
+
title: 'Get Location by IP',
|
|
8
|
+
description: 'Get location information for a given IP address.',
|
|
9
|
+
inputSchema: {
|
|
10
|
+
ipAddress: z.string().describe('IP address to lookup location information.'),
|
|
11
|
+
},
|
|
12
|
+
outputSchema: OutputSchema,
|
|
13
|
+
isReadOnly: true,
|
|
14
|
+
async fetcher({ ipAddress }) {
|
|
15
|
+
return await fetchIpAdress(ipAddress);
|
|
16
|
+
},
|
|
17
|
+
formatter: formatter,
|
|
18
|
+
});
|
|
19
|
+
//# sourceMappingURL=get-location-by-ip.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-location-by-ip.js","sourceRoot":"","sources":["../../src/tools/get-location-by-ip.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AACnD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AACzD,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AAIjE,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,MAAiB,EAAE,EAAE,CAC/D,YAAY,CAAC,MAAM,EAAE;IACnB,IAAI,EAAE,oBAAoB;IAC1B,KAAK,EAAE,oBAAoB;IAC3B,WAAW,EAAE,kDAAkD;IAC/D,WAAW,EAAE;QACX,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,4CAA4C,CAAC;KAC7E;IACD,YAAY,EAAE,YAAY;IAC1B,UAAU,EAAE,IAAI;IAChB,KAAK,CAAC,OAAO,CAAC,EAAE,SAAS,EAAE;QACzB,OAAO,MAAM,aAAa,CAAC,SAAS,CAAC,CAAA;IACvC,CAAC;IACD,SAAS,EAAE,SAAS;CACrB,CAAC,CAAA"}
|
package/package.json
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@mcp-monorepo/location",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "MCP server for location-based tools using IP address lookup",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"bin": {
|
|
9
|
+
"mcp-npm-server": "./dist/index.js"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"dist"
|
|
13
|
+
],
|
|
14
|
+
"publishConfig": {
|
|
15
|
+
"access": "public"
|
|
16
|
+
},
|
|
17
|
+
"scripts": {
|
|
18
|
+
"build": "tsc -b",
|
|
19
|
+
"dev": "tsc --watch",
|
|
20
|
+
"start": "node dist/index.js",
|
|
21
|
+
"test": "vitest run --passWithNoTests",
|
|
22
|
+
"test:watch": "vitest",
|
|
23
|
+
"test:coverage": "vitest run --coverage",
|
|
24
|
+
"typecheck": "tsc --noEmit",
|
|
25
|
+
"clean": "rimraf dist tsconfig.tsbuildinfo"
|
|
26
|
+
},
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"@modelcontextprotocol/sdk": "^1.0.0",
|
|
29
|
+
"zod": "^3.25.76",
|
|
30
|
+
"@mcp-monorepo/shared": "*"
|
|
31
|
+
},
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"@types/node": "^22.14.1",
|
|
34
|
+
"typescript": "^5.8.3",
|
|
35
|
+
"vitest": "^3.2.4",
|
|
36
|
+
"rimraf": "^6.0.1"
|
|
37
|
+
}
|
|
38
|
+
}
|