@sthan/mcp-server 0.1.1 → 0.1.3
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.js +20 -19
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -5,20 +5,21 @@ const mcp_js_1 = require("@modelcontextprotocol/sdk/server/mcp.js");
|
|
|
5
5
|
const stdio_js_1 = require("@modelcontextprotocol/sdk/server/stdio.js");
|
|
6
6
|
const core_1 = require("@sthan/core");
|
|
7
7
|
const zod_1 = require("zod");
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
const MISSING_KEY_MESSAGE = "STHAN_API_KEY environment variable is not set. " +
|
|
9
|
+
"Get a free key at https://sthan.io/dashboard, then set STHAN_API_KEY in your MCP client config.";
|
|
10
|
+
function getClient() {
|
|
11
|
+
const apiKey = process.env.STHAN_API_KEY;
|
|
12
|
+
if (!apiKey) {
|
|
13
|
+
throw new Error(MISSING_KEY_MESSAGE);
|
|
14
|
+
}
|
|
15
|
+
return new core_1.SthanClient({
|
|
16
|
+
apiKey,
|
|
17
|
+
baseUrl: process.env.STHAN_API_URL,
|
|
18
|
+
});
|
|
14
19
|
}
|
|
15
|
-
const client = new core_1.SthanClient({
|
|
16
|
-
apiKey,
|
|
17
|
-
baseUrl: process.env.STHAN_API_URL,
|
|
18
|
-
});
|
|
19
20
|
const server = new mcp_js_1.McpServer({
|
|
20
21
|
name: "sthan",
|
|
21
|
-
version: "0.1.
|
|
22
|
+
version: "0.1.3",
|
|
22
23
|
});
|
|
23
24
|
// --- Tool 1: Verify US Address ---
|
|
24
25
|
server.tool("sthan_verify_address", "Verify if a US address is real and deliverable. Returns standardized format, ZIP+4, delivery point validation (DPV), and whether it's residential or commercial. Use when someone asks 'is this address real?', 'can mail be delivered here?', or 'verify this address'.", {
|
|
@@ -27,7 +28,7 @@ server.tool("sthan_verify_address", "Verify if a US address is real and delivera
|
|
|
27
28
|
.describe("Full or partial US address in any format. Examples: '123 Main St, New York, NY 10001', '123 main st nyc', '1600 Pennsylvania Ave Washington DC'"),
|
|
28
29
|
}, async ({ address }) => {
|
|
29
30
|
try {
|
|
30
|
-
const response = await
|
|
31
|
+
const response = await getClient().verifyAddress(address);
|
|
31
32
|
return {
|
|
32
33
|
content: [{ type: "text", text: JSON.stringify(response.Result, null, 2) }],
|
|
33
34
|
};
|
|
@@ -43,7 +44,7 @@ server.tool("sthan_parse_address", "Parse a freeform US address string into stru
|
|
|
43
44
|
.describe("Raw address text to parse. Freeform input, abbreviations OK. Example: 'apt 2b 500 broadway new york ny'"),
|
|
44
45
|
}, async ({ address }) => {
|
|
45
46
|
try {
|
|
46
|
-
const response = await
|
|
47
|
+
const response = await getClient().parseAddress(address);
|
|
47
48
|
return {
|
|
48
49
|
content: [{ type: "text", text: JSON.stringify(response.Result, null, 2) }],
|
|
49
50
|
};
|
|
@@ -59,7 +60,7 @@ server.tool("sthan_autocomplete_address", "Get address suggestions from partial
|
|
|
59
60
|
.describe("Partial address text (3+ characters recommended). Example: '123 Main'"),
|
|
60
61
|
}, async ({ text }) => {
|
|
61
62
|
try {
|
|
62
|
-
const response = await
|
|
63
|
+
const response = await getClient().autocompleteAddress(text);
|
|
63
64
|
return {
|
|
64
65
|
content: [{ type: "text", text: JSON.stringify(response.Result, null, 2) }],
|
|
65
66
|
};
|
|
@@ -80,7 +81,7 @@ server.tool("sthan_autocomplete_city", "Get US city name suggestions from partia
|
|
|
80
81
|
.describe("0 = City, StateCode (e.g. 'San Francisco, CA'). 1 = City, State (e.g. 'San Francisco, California')"),
|
|
81
82
|
}, async ({ text, display_type }) => {
|
|
82
83
|
try {
|
|
83
|
-
const response = await
|
|
84
|
+
const response = await getClient().autocompleteCity(text, display_type);
|
|
84
85
|
return {
|
|
85
86
|
content: [{ type: "text", text: JSON.stringify(response.Result, null, 2) }],
|
|
86
87
|
};
|
|
@@ -101,7 +102,7 @@ server.tool("sthan_autocomplete_zipcode", "Get US ZIP code suggestions from part
|
|
|
101
102
|
.describe("0 = Zip,StateCode. 1 = Zip,State. 2 = Zip-Zip4,StateCode. 3 = Zip-Zip4,State"),
|
|
102
103
|
}, async ({ text, display_type }) => {
|
|
103
104
|
try {
|
|
104
|
-
const response = await
|
|
105
|
+
const response = await getClient().autocompleteZipCode(text, display_type);
|
|
105
106
|
return {
|
|
106
107
|
content: [{ type: "text", text: JSON.stringify(response.Result, null, 2) }],
|
|
107
108
|
};
|
|
@@ -117,7 +118,7 @@ server.tool("sthan_geocode", "Convert a US address to latitude/longitude coordin
|
|
|
117
118
|
.describe("US address to geocode (freeform text). Example: '1600 Pennsylvania Ave, Washington DC'"),
|
|
118
119
|
}, async ({ address }) => {
|
|
119
120
|
try {
|
|
120
|
-
const response = await
|
|
121
|
+
const response = await getClient().geocodeAddress(address);
|
|
121
122
|
return {
|
|
122
123
|
content: [{ type: "text", text: JSON.stringify(response.Result, null, 2) }],
|
|
123
124
|
};
|
|
@@ -132,7 +133,7 @@ server.tool("sthan_reverse_geocode", "Convert latitude/longitude coordinates to
|
|
|
132
133
|
longitude: zod_1.z.number().min(-180).max(180).describe("Longitude coordinate"),
|
|
133
134
|
}, async ({ latitude, longitude }) => {
|
|
134
135
|
try {
|
|
135
|
-
const response = await
|
|
136
|
+
const response = await getClient().reverseGeocode(latitude, longitude);
|
|
136
137
|
return {
|
|
137
138
|
content: [{ type: "text", text: JSON.stringify(response.Result, null, 2) }],
|
|
138
139
|
};
|
|
@@ -148,7 +149,7 @@ server.tool("sthan_ip_geolocation", "Look up the geographic location of an IPv4
|
|
|
148
149
|
.describe("IPv4 (e.g. '8.8.8.8') or IPv6 (e.g. '2001:4860:4860::8888') address"),
|
|
149
150
|
}, async ({ ip }) => {
|
|
150
151
|
try {
|
|
151
|
-
const response = await
|
|
152
|
+
const response = await getClient().ipGeolocation(ip);
|
|
152
153
|
return {
|
|
153
154
|
content: [{ type: "text", text: JSON.stringify(response.Result, null, 2) }],
|
|
154
155
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sthan/mcp-server",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"mcpName": "io.github.sthan-io/mcp-server",
|
|
5
5
|
"description": "MCP server for sthan.io — US address verification, parsing, autocomplete, geocoding, and IP geolocation",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"@modelcontextprotocol/sdk": "^1.12.1",
|
|
49
|
-
"@sthan/core": "0.1.
|
|
49
|
+
"@sthan/core": "0.1.3"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@types/node": "^25.5.0",
|