@cyanheads/geonames-mcp-server 0.0.0-stage → 0.1.2

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.
Files changed (91) hide show
  1. package/AGENTS.md +439 -0
  2. package/CLAUDE.md +439 -0
  3. package/Dockerfile +177 -0
  4. package/LICENSE +201 -0
  5. package/README.md +344 -2
  6. package/changelog/0.1.x/0.1.0.md +9 -0
  7. package/changelog/0.1.x/0.1.1.md +22 -0
  8. package/changelog/0.1.x/0.1.2.md +26 -0
  9. package/changelog/template.md +151 -0
  10. package/dist/config/server-config.d.ts +13 -0
  11. package/dist/config/server-config.d.ts.map +1 -0
  12. package/dist/config/server-config.js +21 -0
  13. package/dist/config/server-config.js.map +1 -0
  14. package/dist/index.d.ts +8 -0
  15. package/dist/index.d.ts.map +1 -0
  16. package/dist/index.js +30 -0
  17. package/dist/index.js.map +1 -0
  18. package/dist/mcp-server/tools/definitions/find-postal-codes.tool.d.ts +96 -0
  19. package/dist/mcp-server/tools/definitions/find-postal-codes.tool.d.ts.map +1 -0
  20. package/dist/mcp-server/tools/definitions/find-postal-codes.tool.js +274 -0
  21. package/dist/mcp-server/tools/definitions/find-postal-codes.tool.js.map +1 -0
  22. package/dist/mcp-server/tools/definitions/get-children.tool.d.ts +90 -0
  23. package/dist/mcp-server/tools/definitions/get-children.tool.d.ts.map +1 -0
  24. package/dist/mcp-server/tools/definitions/get-children.tool.js +287 -0
  25. package/dist/mcp-server/tools/definitions/get-children.tool.js.map +1 -0
  26. package/dist/mcp-server/tools/definitions/get-countries.tool.d.ts +90 -0
  27. package/dist/mcp-server/tools/definitions/get-countries.tool.d.ts.map +1 -0
  28. package/dist/mcp-server/tools/definitions/get-countries.tool.js +217 -0
  29. package/dist/mcp-server/tools/definitions/get-countries.tool.js.map +1 -0
  30. package/dist/mcp-server/tools/definitions/get-hierarchy.tool.d.ts +64 -0
  31. package/dist/mcp-server/tools/definitions/get-hierarchy.tool.d.ts.map +1 -0
  32. package/dist/mcp-server/tools/definitions/get-hierarchy.tool.js +168 -0
  33. package/dist/mcp-server/tools/definitions/get-hierarchy.tool.js.map +1 -0
  34. package/dist/mcp-server/tools/definitions/get-place.tool.d.ts +108 -0
  35. package/dist/mcp-server/tools/definitions/get-place.tool.d.ts.map +1 -0
  36. package/dist/mcp-server/tools/definitions/get-place.tool.js +300 -0
  37. package/dist/mcp-server/tools/definitions/get-place.tool.js.map +1 -0
  38. package/dist/mcp-server/tools/definitions/index.d.ts +760 -0
  39. package/dist/mcp-server/tools/definitions/index.d.ts.map +1 -0
  40. package/dist/mcp-server/tools/definitions/index.js +23 -0
  41. package/dist/mcp-server/tools/definitions/index.js.map +1 -0
  42. package/dist/mcp-server/tools/definitions/list-reference.tool.d.ts +103 -0
  43. package/dist/mcp-server/tools/definitions/list-reference.tool.d.ts.map +1 -0
  44. package/dist/mcp-server/tools/definitions/list-reference.tool.js +233 -0
  45. package/dist/mcp-server/tools/definitions/list-reference.tool.js.map +1 -0
  46. package/dist/mcp-server/tools/definitions/reverse-geocode.tool.d.ts +142 -0
  47. package/dist/mcp-server/tools/definitions/reverse-geocode.tool.d.ts.map +1 -0
  48. package/dist/mcp-server/tools/definitions/reverse-geocode.tool.js +421 -0
  49. package/dist/mcp-server/tools/definitions/reverse-geocode.tool.js.map +1 -0
  50. package/dist/mcp-server/tools/definitions/search-places.tool.d.ts +145 -0
  51. package/dist/mcp-server/tools/definitions/search-places.tool.d.ts.map +1 -0
  52. package/dist/mcp-server/tools/definitions/search-places.tool.js +385 -0
  53. package/dist/mcp-server/tools/definitions/search-places.tool.js.map +1 -0
  54. package/dist/mcp-server/tools/shared-inputs.d.ts +140 -0
  55. package/dist/mcp-server/tools/shared-inputs.d.ts.map +1 -0
  56. package/dist/mcp-server/tools/shared-inputs.js +240 -0
  57. package/dist/mcp-server/tools/shared-inputs.js.map +1 -0
  58. package/dist/services/geonames/country-codes.d.ts +26 -0
  59. package/dist/services/geonames/country-codes.d.ts.map +1 -0
  60. package/dist/services/geonames/country-codes.js +284 -0
  61. package/dist/services/geonames/country-codes.js.map +1 -0
  62. package/dist/services/geonames/feature-codes.d.ts +27 -0
  63. package/dist/services/geonames/feature-codes.d.ts.map +1 -0
  64. package/dist/services/geonames/feature-codes.js +723 -0
  65. package/dist/services/geonames/feature-codes.js.map +1 -0
  66. package/dist/services/geonames/geonames-service.d.ts +103 -0
  67. package/dist/services/geonames/geonames-service.d.ts.map +1 -0
  68. package/dist/services/geonames/geonames-service.js +561 -0
  69. package/dist/services/geonames/geonames-service.js.map +1 -0
  70. package/dist/services/geonames/response-cache.d.ts +24 -0
  71. package/dist/services/geonames/response-cache.d.ts.map +1 -0
  72. package/dist/services/geonames/response-cache.js +44 -0
  73. package/dist/services/geonames/response-cache.js.map +1 -0
  74. package/dist/services/geonames/response-parsers.d.ts +38 -0
  75. package/dist/services/geonames/response-parsers.d.ts.map +1 -0
  76. package/dist/services/geonames/response-parsers.js +369 -0
  77. package/dist/services/geonames/response-parsers.js.map +1 -0
  78. package/dist/services/geonames/types.d.ts +226 -0
  79. package/dist/services/geonames/types.d.ts.map +1 -0
  80. package/dist/services/geonames/types.js +10 -0
  81. package/dist/services/geonames/types.js.map +1 -0
  82. package/dist/services/geonames/upstream-errors.d.ts +54 -0
  83. package/dist/services/geonames/upstream-errors.d.ts.map +1 -0
  84. package/dist/services/geonames/upstream-errors.js +187 -0
  85. package/dist/services/geonames/upstream-errors.js.map +1 -0
  86. package/dist/utils/inline-text.d.ts +25 -0
  87. package/dist/utils/inline-text.d.ts.map +1 -0
  88. package/dist/utils/inline-text.js +60 -0
  89. package/dist/utils/inline-text.js.map +1 -0
  90. package/package.json +108 -4
  91. package/server.json +120 -0
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 Casey Hand @cyanheads
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md CHANGED
@@ -1,3 +1,345 @@
1
- # Temporary Holding Version
1
+ <div align="center">
2
+ <h1>@cyanheads/geonames-mcp-server</h1>
3
+ <p><b>Search GeoNames places, walk admin hierarchies, reverse geocode, get postal codes and country info via MCP. STDIO or Streamable HTTP.</b>
4
+ <div>8 Tools</div>
5
+ </p>
6
+ </div>
2
7
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
8
+ <div align="center">
9
+
10
+ [![Version](https://img.shields.io/badge/Version-0.1.2-blue.svg?style=flat-square)](./CHANGELOG.md) [![License](https://img.shields.io/badge/License-Apache%202.0-orange.svg?style=flat-square)](./LICENSE) [![Docker](https://img.shields.io/badge/Docker-ghcr.io-2496ED?style=flat-square&logo=docker&logoColor=white)](https://github.com/users/cyanheads/packages/container/package/geonames-mcp-server) [![MCP SDK](https://img.shields.io/badge/MCP%20SDK-^2.2.0-green.svg?style=flat-square)](https://modelcontextprotocol.io/) [![npm](https://img.shields.io/npm/v/@cyanheads/geonames-mcp-server?style=flat-square&logo=npm&logoColor=white)](https://www.npmjs.com/package/@cyanheads/geonames-mcp-server) [![TypeScript](https://img.shields.io/badge/TypeScript-^7.0.2-3178C6.svg?style=flat-square)](https://www.typescriptlang.org/) [![Bun](https://img.shields.io/badge/Bun-v1.4.2-blueviolet.svg?style=flat-square)](https://bun.sh/)
11
+
12
+ </div>
13
+
14
+ <div align="center">
15
+
16
+ [![Install in Claude Desktop](https://img.shields.io/badge/Install_in-Claude_Desktop-D97757?style=for-the-badge&logo=anthropic&logoColor=white)](https://github.com/cyanheads/geonames-mcp-server/releases/latest/download/geonames-mcp-server.mcpb) [![Install in Cursor](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en/install-mcp?name=geonames-mcp-server&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBjeWFuaGVhZHMvZ2VvbmFtZXMtbWNwLXNlcnZlciJdLCJlbnYiOnsiR0VPTkFNRVNfVVNFUk5BTUUiOiJ5b3VyX2dlb25hbWVzX3VzZXJuYW1lIn19) [![Install in VS Code](https://img.shields.io/badge/VS_Code-Install_Server-0098FF?style=for-the-badge&logo=visualstudiocode&logoColor=white)](https://vscode.dev/redirect?url=vscode:mcp/install?%7B%22name%22%3A%22geonames-mcp-server%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40cyanheads%2Fgeonames-mcp-server%22%5D%2C%22env%22%3A%7B%22GEONAMES_USERNAME%22%3A%22your_geonames_username%22%7D%7D)
17
+
18
+ [![Framework](https://img.shields.io/badge/Built%20on-@cyanheads/mcp--ts--core-67E8F9?style=flat-square)](https://www.npmjs.com/package/@cyanheads/mcp-ts-core)
19
+
20
+ </div>
21
+
22
+ <div align="center">
23
+
24
+ **Public Hosted Server:** [https://geonames.caseyjhand.com/mcp](https://geonames.caseyjhand.com/mcp)
25
+
26
+ </div>
27
+
28
+ ---
29
+
30
+ ## Overview
31
+
32
+ The [GeoNames](https://www.geonames.org/) gazetteer: 13M+ places worldwide, each keyed by a stable integer `geonameId` and linked into an administrative tree from continent to neighborhood. Search places, read full records, walk the admin hierarchy, reverse geocode coordinates, look up postal codes, and read country facts. Runs as a stdio process, a local Streamable HTTP server, or the public hosted endpoint above.
33
+
34
+ ### Tools
35
+
36
+ | Tool | Description |
37
+ |:---|:---|
38
+ | `geonames_search_places` | Search places by name, country, feature class or code, population tier, and bounding box |
39
+ | `geonames_get_place` | Full record for one `geonameId`: admin chain, timezone, elevation, alternate names, postal codes, external identifiers |
40
+ | `geonames_get_hierarchy` | Parent chain from Earth and the continent down to the feature |
41
+ | `geonames_get_children` | Direct children of a feature in the administrative, tourism, or dependency tree |
42
+ | `geonames_reverse_geocode` | Country and admin subdivisions (or the ocean) for a coordinate, plus the nearest places or features and an optional timezone |
43
+ | `geonames_find_postal_codes` | Postal codes by code, by place name, or near a coordinate |
44
+ | `geonames_get_countries` | Country facts: ISO and FIPS codes, `geonameId`, capital, population, area, languages, currency, postal-code format |
45
+ | `geonames_list_reference` | Feature classes, feature codes, and the countries with postal-code data |
46
+
47
+ ## Capability reference
48
+
49
+ ### `geonames_search_places` <sub>tool</sub>
50
+
51
+ - `query` (up to 200 characters) compared per `match`: `name_required` (default), `any_field`, `exact_name`, or `name_prefix`; filters `countries` (up to 10, by ISO alpha-2, alpha-3, or numeric code), `featureClasses`, `featureCodes` (up to 20), `cities` (`cities1000` / `cities5000` / `cities15000`), and `boundingBox`. A call needs `query` or one of `countries`, `featureClasses`, `featureCodes`, `boundingBox`
52
+ - `limit` 1–100 (default 10), `offset` 0–5000, `orderBy` `relevance` or `population`; returns `totalCount`, `effectiveQuery`, and `nextOffset`
53
+ - `featureClasses`, `featureCodes`, and `cities` (class P only) intersect: with both lists set, each code's class must be listed and each listed class needs a code; beside `cities`, only class P and its codes. Anything else fails as `feature_filter_mismatch`
54
+ - Fails before any request with `query_or_filter_required`, `query_required`, `unknown_country_code`, `unknown_feature_code`, `feature_filter_mismatch`, or `invalid_bounding_box`
55
+
56
+ ---
57
+
58
+ ### `geonames_get_place` <sub>tool</sub>
59
+
60
+ - One `geonameId`; an unknown id returns `found: false` with `guidance`
61
+ - Returns `adminLevels` 1–5 (code, name, `geonameId`), timezone (UTC offsets on 1 January and 1 July), bounding box, recorded and DEM elevation, population, Wikipedia URL, `alternateNames`, `postalCodes`, `links`, and `identifiers` (IATA, ICAO, FAA, Transport Canada, UN/LOCODE, Wikidata)
62
+ - `nameLanguages` (up to 20 tags; `zh` also matches `zh-CN`) filters `alternateNames` only
63
+
64
+ ---
65
+
66
+ ### `geonames_get_hierarchy` <sub>tool</sub>
67
+
68
+ - One `geonameId`; `chain` runs from Earth and its continent through the country and admin divisions down to the feature, skipping levels it does not sit under
69
+ - Each level carries `geonameId`, feature class and code, country and first-level codes, coordinates, and population; an unknown id returns `found: false`
70
+
71
+ ---
72
+
73
+ ### `geonames_get_children` <sub>tool</sub>
74
+
75
+ - `hierarchy`: `administrative` (default), `tourism` (islands, coasts, and their municipalities; almost all in Spain), or `dependency` (a country's dependent territories). Children are mostly admin divisions (class A) and populated places (class P); continents and coasts are class L, islands class T
76
+ - GeoNames answers a `tourism` or `dependency` request with the administrative children when the feature has no such tree. The tool compares the two lists and sets `sameAsAdministrative`, with a notice, when they match; the rows stay, since a real tree can match too
77
+ - Fetches up to 1,000 children per parent once and caches them, so `nameContains`, `limit` (1–500, default 100), and `offset` cost no extra credits; a notice says when GeoNames lists more
78
+ - An unknown id returns `found: false`; a leaf returns an empty `children` list with a notice
79
+
80
+ ---
81
+
82
+ ### `geonames_reverse_geocode` <sub>tool</sub>
83
+
84
+ - `lat` / `lng` resolve to `country` and `adminLevels` (down to ADM5, each with its `geonameId` and ISO 3166-2 subdivision code where one exists) or, offshore, the `ocean`
85
+ - `coastalBufferKm` (0–50, default 0) matches the nearest country within that distance when none contains the point, for harbor, pier, and shoreline fixes; a buffered match carries `country.distanceInKm`, and the nearby and timezone lookups keep the exact point
86
+ - `nearby` lists the nearest populated places (`nearbyLimit` 0–50, default 5; `radiusKm` up to 300, default 20; optional `cities` tier) or, when `featureClasses` / `featureCodes` is set, the nearest features of that type; `nearbyKind` says which. `featureClasses` and `featureCodes` intersect
87
+ - Fails before any request with `conflicting_filters` (`cities` with a feature filter), `unknown_feature_code`, or `feature_filter_mismatch` (a code whose class is not listed, or a listed class with no code)
88
+ - `includeTimezone` adds the IANA id, UTC offsets, local time, sunrise, and sunset (offsets only offshore, where 1 July is reported at the standard offset)
89
+
90
+ ---
91
+
92
+ ### `geonames_find_postal_codes` <sub>tool</sub>
93
+
94
+ - `mode`: `code` (needs `postalCode`), `place_name` (needs `placeName`), or `nearby` (needs `lat` and `lng`; `radiusKm` up to 30, default 10); a missing field, or `countries` in `nearby`, fails as `mode_fields_mismatch`
95
+ - `countries` filter for `code` and `place_name`, by ISO alpha-2, alpha-3, or numeric code (an alpha-3 or numeric code no country has fails as `unknown_country_code`); `limit` 1–100 (default 10); GeoNames reports no total, so a full page is marked truncated
96
+ - Covers 122 countries; Ireland returns only Eircode routing keys and Malta only letter prefixes
97
+
98
+ ---
99
+
100
+ ### `geonames_get_countries` <sub>tool</sub>
101
+
102
+ - Up to 50 `countries` by ISO alpha-2, alpha-3, or numeric code, a `continent`, `nameContains`, or no filter for all 250; `limit` 1–250 (default 50) with `offset`
103
+ - Rows carry ISO and FIPS codes, `geonameId` (the starting point for `geonames_get_children`), capital, population, area, continent, languages, currency, postal-code format, and mainland bounding box; unknown codes land in `notFound`
104
+
105
+ ---
106
+
107
+ ### `geonames_list_reference` <sub>tool</sub>
108
+
109
+ - `topic`: `feature_classes` (9), `feature_codes` (684, filterable by `featureClass`), or `postal_countries` (122, with each country's code range and count); `featureClass` with another topic fails as `filter_not_applicable`
110
+ - `nameContains`, `limit` 1–700 (default 100), and `offset`; feature classes and codes are bundled and spend no credits
111
+
112
+ ## Features
113
+
114
+ Built on [`@cyanheads/mcp-ts-core`](https://github.com/cyanheads/mcp-ts-core): stdio and Streamable HTTP transports, pluggable auth (`none` / `jwt` / `oauth`), swappable storage (`in-memory`, `filesystem`, `Supabase`, `Cloudflare KV/R2/D1`), structured logging with optional OpenTelemetry tracing.
115
+
116
+ GeoNames-specific:
117
+
118
+ - Data from [GeoNames](https://www.geonames.org/), licensed [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/): results you pass on must credit GeoNames. This server is independent of GeoNames.
119
+ - Per-account pacing at 1,000 requests an hour, with a cooldown after a quota error that holds only that account
120
+ - Responses are cached across callers: searches for 1 hour, timezones never, every other lookup for 24 hours. A cache hit spends no credit
121
+ - Forgiving inputs: comma-separated lists, any-case enums and codes, alpha-3 and numeric country codes, `UK` for `GB`, a `P.PPLC` class prefix, and a geonames.org URL in place of a `geonameId`
122
+
123
+ Agent-friendly output:
124
+
125
+ - Typed failure reasons separate the caller's account (`caller_account_rejected`) from the operator's (`server_account_rejected`), a spent quota (`quota_exhausted`, with `data.window` of `hour`, `day`, `week`, or `local`), and a value GeoNames rejected (`upstream_rejected_parameter`)
126
+ - Unknown ids return `found: false` with `guidance` rather than an error; empty or partial pages carry a `notice` naming the next `offset` or the filter to loosen
127
+ - GeoNames placeholders for "none" (`population: 0`, empty admin names, `geonameId: 0`) are dropped rather than reported as facts
128
+
129
+ Known limitations:
130
+
131
+ - **Shared quota on a shared deployment.** All callers without their own username share the server account's 1,000 credits an hour. A burst of reverse geocodes (up to 7 credits each) can exhaust it, and GeoNames does not say when the window resets.
132
+ - **Search reaches only offset 5000** on the free tier, and `limit` caps at 100, so a result set is reachable up to its 5,100th row.
133
+ - **Children cap at 1,000 per parent.**
134
+ - **Postal data covers 122 countries.** Ireland and Malta return only code prefixes. US nearby lookups place the first row at the query point rather than the ZIP centroid.
135
+ - **Nearby radius tops out at 300 km** for places and features and 30 km for postal codes, GeoNames' free-tier ceilings.
136
+ - **Bounding boxes cannot cross the 180° meridian.** Split such an area into two searches.
137
+ - **Coastal points can resolve to the ocean without a buffer.** By default only a country that contains the point matches, so a harbor or shoreline point just outside the outline returns the sea while its nearby places are on land. Set `coastalBufferKm` (up to 50) to match the nearest country instead; in a strait that can be either shore.
138
+ - **Microstates and enclaves can resolve to the surrounding country.** A point inside Vatican City returns Italy.
139
+ - **Nearest populated places include sections and historical places.** In a dense city the nearest rows are often `PPLX` quarters or `PPLH` former districts; each row's `featureCode` says which, and `cities` restricts to places above a population tier.
140
+ - **Offshore timezones are offsets only.** No IANA id, local time, sunrise, or sunset is available at sea, and the 1 July offset is the standard offset (open water has no DST).
141
+ - **`exact_name` matches alternate and historical names**, so a result's `name` can differ from the query: "Springfield" can return Plattsburg or Palmyra, MO.
142
+ - **Data is community-edited and provided "as is".** Many features have no recorded population or elevation.
143
+
144
+ ## Getting started
145
+
146
+ ### Public Hosted Instance
147
+
148
+ A public instance is available at `https://geonames.caseyjhand.com/mcp` — no installation required. Point any MCP client at it via Streamable HTTP:
149
+
150
+ ```json
151
+ {
152
+ "mcpServers": {
153
+ "geonames-mcp-server": {
154
+ "type": "streamable-http",
155
+ "url": "https://geonames.caseyjhand.com/mcp"
156
+ }
157
+ }
158
+ }
159
+ ```
160
+
161
+ A call that passes no `geonamesUsername` spends the hosted instance's GeoNames account, whose 1,000 credits an hour are shared by every such caller. Pass your own `geonamesUsername` to spend your account's quota instead.
162
+
163
+ ### Self-Hosted / Local
164
+
165
+ Add the following to your MCP client configuration file, with your GeoNames username in place of the placeholder.
166
+
167
+ ```json
168
+ {
169
+ "mcpServers": {
170
+ "geonames-mcp-server": {
171
+ "type": "stdio",
172
+ "command": "bunx",
173
+ "args": ["@cyanheads/geonames-mcp-server@latest"],
174
+ "env": {
175
+ "MCP_TRANSPORT_TYPE": "stdio",
176
+ "MCP_LOG_LEVEL": "info",
177
+ "GEONAMES_USERNAME": "your_geonames_username"
178
+ }
179
+ }
180
+ }
181
+ }
182
+ ```
183
+
184
+ Or with npx (no Bun required):
185
+
186
+ ```json
187
+ {
188
+ "mcpServers": {
189
+ "geonames-mcp-server": {
190
+ "type": "stdio",
191
+ "command": "npx",
192
+ "args": ["-y", "@cyanheads/geonames-mcp-server@latest"],
193
+ "env": {
194
+ "MCP_TRANSPORT_TYPE": "stdio",
195
+ "MCP_LOG_LEVEL": "info",
196
+ "GEONAMES_USERNAME": "your_geonames_username"
197
+ }
198
+ }
199
+ }
200
+ }
201
+ ```
202
+
203
+ Or with Docker:
204
+
205
+ ```json
206
+ {
207
+ "mcpServers": {
208
+ "geonames-mcp-server": {
209
+ "type": "stdio",
210
+ "command": "docker",
211
+ "args": [
212
+ "run", "-i", "--rm",
213
+ "-e", "MCP_TRANSPORT_TYPE=stdio",
214
+ "-e", "GEONAMES_USERNAME=your_geonames_username",
215
+ "ghcr.io/cyanheads/geonames-mcp-server:latest"
216
+ ]
217
+ }
218
+ }
219
+ }
220
+ ```
221
+
222
+ For Streamable HTTP, set the transport and start the server:
223
+
224
+ ```sh
225
+ MCP_TRANSPORT_TYPE=http MCP_HTTP_PORT=3010 GEONAMES_USERNAME=your_geonames_username bun run start:http
226
+ # Server listens at http://localhost:3010/mcp
227
+ ```
228
+
229
+ ### Prerequisites
230
+
231
+ - [Bun v1.4.0](https://bun.sh/) or higher (or Node.js v24+).
232
+ - A free [GeoNames account](https://www.geonames.org/login) with free web services enabled on its [account page](https://www.geonames.org/manageaccount). GeoNames rejects calls from an account until they are enabled.
233
+
234
+ ### Installation
235
+
236
+ 1. **Clone the repository:**
237
+
238
+ ```sh
239
+ git clone https://github.com/cyanheads/geonames-mcp-server.git
240
+ ```
241
+
242
+ 2. **Navigate into the directory:**
243
+
244
+ ```sh
245
+ cd geonames-mcp-server
246
+ ```
247
+
248
+ 3. **Install dependencies:**
249
+
250
+ ```sh
251
+ bun install
252
+ ```
253
+
254
+ 4. **Configure environment:**
255
+
256
+ ```sh
257
+ cp .env.example .env
258
+ # edit .env and set GEONAMES_USERNAME
259
+ ```
260
+
261
+ ## Configuration
262
+
263
+ Every GeoNames call spends credits from a GeoNames account. `GEONAMES_USERNAME` is the server's account: a free GeoNames account with free web services enabled on its account page. Every tool also takes `geonamesUsername` (alias `username`), so a caller on a shared deployment can spend their own account instead of the server's. When neither is set, calls fail with `username_required`; only the bundled `feature_classes` and `feature_codes` topics of `geonames_list_reference` work without an account.
264
+
265
+ A free account gets 1,000 credits an hour and 10,000 a day. Cached lookups spend nothing.
266
+
267
+ | Tool | Credits per call |
268
+ |:---|:---|
269
+ | `geonames_search_places`, `geonames_get_place`, `geonames_get_hierarchy` | 1 |
270
+ | `geonames_get_children` | 1; 2 for `tourism` or `dependency` when the parent's administrative list is not cached |
271
+ | `geonames_find_postal_codes` | 1 (`code`, `place_name`); 2 (`nearby`) |
272
+ | `geonames_reverse_geocode` | 1 for containment (with or without `coastalBufferKm`), plus 3 for nearest populated places or 4 for nearest features, 1 for the ocean when no country contains the point or lies within the buffer, and 1 for the timezone |
273
+ | `geonames_get_countries` | 1 a day; the country table is cached |
274
+ | `geonames_list_reference` | 0 for `feature_classes` and `feature_codes`; 1 a day for `postal_countries` |
275
+
276
+ | Variable | Description | Default |
277
+ |:---|:---|:---|
278
+ | `GEONAMES_USERNAME` | GeoNames account used when a call passes no `geonamesUsername`. Free at geonames.org; enable free web services on its account page. | none |
279
+ | `MCP_TRANSPORT_TYPE` | Transport: `stdio` or `http`. | `stdio` |
280
+ | `MCP_HTTP_PORT` | HTTP server port. | `3010` |
281
+ | `MCP_SESSION_MODE` | HTTP session mode: `stateless`, `stateful`, or `auto`. `.env.example` and the Docker image set `stateless`. | `auto` |
282
+ | `MCP_AUTH_MODE` | Authentication: `none`, `jwt`, or `oauth`. | `none` |
283
+ | `MCP_LOG_LEVEL` | Log level (`debug`, `info`, `warning`, `error`, etc.). | `info` |
284
+ | `LOGS_DIR` | Directory for log files (Node.js only). | `<app-root>/logs` |
285
+ | `LOG_TOOL_FAILURE_PAYLOADS` | Log each failed tool call's arguments and result, redacted by key name (`geonamesUsername` and `username` included). | `false` |
286
+ | `STORAGE_PROVIDER_TYPE` | Storage backend: `in-memory`, `filesystem`, `supabase`, `cloudflare-kv/r2/d1`. | `in-memory` |
287
+ | `OTEL_ENABLED` | Enable [OpenTelemetry](https://github.com/cyanheads/mcp-ts-core/tree/main/docs/telemetry). | `false` |
288
+
289
+ See [`.env.example`](./.env.example) for the full list of optional overrides.
290
+
291
+ ## Running the server
292
+
293
+ ### Local development
294
+
295
+ - **Build and run the production version**:
296
+
297
+ ```sh
298
+ # One-time build
299
+ bun run rebuild
300
+
301
+ # Run the built server
302
+ bun run start:http
303
+ # or
304
+ bun run start:stdio
305
+ ```
306
+
307
+ - **Run checks and tests**:
308
+ ```sh
309
+ bun run devcheck # Lints, formats, type-checks, and more
310
+ bun run test # Runs the test suite
311
+ ```
312
+
313
+ ## Project structure
314
+
315
+ | Directory | Purpose |
316
+ |:---|:---|
317
+ | `src/index.ts` | `createApp()` entry point: server instructions, tool registration, GeoNames service setup and teardown. |
318
+ | `src/config` | `GEONAMES_USERNAME` parsing and validation with Zod. |
319
+ | `src/mcp-server/tools` | The eight tool definitions (`*.tool.ts`) and the inputs they share (`shared-inputs.ts`). |
320
+ | `src/services/geonames` | GeoNames service: fetch boundary, status mapping, retry, per-account pacing, response cache, parsers, and the bundled feature-code and country-code tables. |
321
+ | `src/utils` | Inline-text sanitizer for GeoNames-authored text in `format()` output. |
322
+ | `tests/` | Unit and integration tests, mirroring the `src/` structure. |
323
+ | `docs/design.md` | Design notes: tool surface, credential model, upstream behavior. |
324
+
325
+ ## Development guide
326
+
327
+ See [`CLAUDE.md`](./CLAUDE.md) for development guidelines and architectural rules. The short version:
328
+
329
+ - Handlers throw, framework catches — no `try/catch` in tool logic
330
+ - Use `ctx.log` for logging, `ctx.state` for storage
331
+ - Register new tools in `src/mcp-server/tools/definitions/index.ts`
332
+ - Wrap external API calls: validate raw → normalize to domain type → return output schema; never fabricate missing fields
333
+
334
+ ## Contributing
335
+
336
+ Issues are welcome. Run checks and tests before submitting:
337
+
338
+ ```sh
339
+ bun run devcheck
340
+ bun run test
341
+ ```
342
+
343
+ ## License
344
+
345
+ This project is licensed under the Apache 2.0 License. See the [LICENSE](./LICENSE) file for details.
@@ -0,0 +1,9 @@
1
+ ---
2
+ summary: "Unpublished project scaffold from @cyanheads/mcp-ts-core — no package was released under this version."
3
+ breaking: false
4
+ security: false
5
+ ---
6
+
7
+ # 0.1.0 — 2026-09-29
8
+
9
+ Unpublished project scaffold from [@cyanheads/mcp-ts-core](https://www.npmjs.com/package/@cyanheads/mcp-ts-core). No package was released under this version.
@@ -0,0 +1,22 @@
1
+ ---
2
+ summary: "First published release — eight GeoNames tools for place search, full place records, admin hierarchies and children, reverse geocoding, postal codes, country facts, and reference vocabulary, spending the server's GeoNames account or the caller's own."
3
+ breaking: false
4
+ security: false
5
+ ---
6
+
7
+ # 0.1.1 — 2026-10-01
8
+
9
+ ## Added
10
+
11
+ - **`geonames_search_places`** — search 13M+ places by `query` (`match`: `name_required`, `any_field`, `exact_name`, `name_prefix`) and `countries`, `featureClasses`, `featureCodes`, `cities`, `boundingBox`; `orderBy` relevance or population, `limit` up to 100, `offset` up to 5000 with `nextOffset`. 1 credit, cached an hour.
12
+ - **`geonames_get_place`** — the full record for one `geonameId`: admin levels 1–5 with codes and ids, timezone with UTC offsets on 1 January and 1 July ([#1](https://github.com/cyanheads/geonames-mcp-server/issues/1)), elevations, alternate names (`nameLanguages` filter), postal codes, links, and airport, UN/LOCODE, and Wikidata identifiers.
13
+ - **`geonames_get_hierarchy`** — a feature's parent chain from Earth and its continent down to the feature, each level with `geonameId`, feature code, and coordinates.
14
+ - **`geonames_get_children`** — a feature's direct children in the `administrative` (default), `tourism`, `geography`, or `dependency` tree. Up to 1,000 children are fetched once and cached, so `nameContains`, `limit`, and `offset` spend no further credit.
15
+ - **`geonames_reverse_geocode`** — a coordinate's country and admin levels down to ADM5, or the ocean offshore, plus the nearest populated places or, with `featureClasses`/`featureCodes`, features; `includeTimezone` adds local time, sunrise, and sunset. 1 to 7 credits.
16
+ - **`geonames_find_postal_codes`** — `mode` `code`, `place_name`, or `nearby` (`radiusKm` up to 30) across the 122 countries with GeoNames postal data; a mode missing its fields fails as `mode_fields_mismatch`.
17
+ - **`geonames_get_countries`** — ISO alpha-2, alpha-3, numeric, and FIPS codes, `geonameId`, capital, population, area, languages, currency, and postal format, by code, `continent`, or `nameContains`; unknown codes land in `notFound`.
18
+ - **`geonames_list_reference`** — `topic` `feature_classes` (9) and `feature_codes` (684), bundled and free, or `postal_countries` (122, 1 credit a day).
19
+ - **`geonameId` inputs** accept a geonames.org URL and stop at 2147483647, the largest id GeoNames parses ([#2](https://github.com/cyanheads/geonames-mcp-server/issues/2)). List inputs also take a comma-separated string; codes match in any case, and `UK` reads as `GB`.
20
+ - **`GeoNamesService`** — one boundary to `secure.geonames.org`: per-endpoint parameter allowlists, a 20 s retry deadline, per-account pacing at 1,000 requests an hour, single-flight, and a cross-caller cache keyed without the account. GeoNames' absence placeholders (`population: 0`, `geonameId: 0`, `adminCode1: "00"`) are dropped.
21
+ - **`GEONAMES_USERNAME`** — the server's GeoNames account, optional; every tool also takes `geonamesUsername` (alias `username`) to spend the caller's own. Account failures are typed (`username_required`, `caller_account_rejected`, `server_account_rejected`, `quota_exhausted`), and the name never reaches logs, output, or cache keys.
22
+ - **Data terms** — GeoNames data is CC BY 4.0, and the server instructions tell callers to credit GeoNames when passing results on; community-edited names render as inline data in `content[]`.
@@ -0,0 +1,26 @@
1
+ ---
2
+ summary: "Feature filters GeoNames can never match now fail before the request, reverse geocoding gains an opt-in coastal buffer, and country filters accept alpha-3 and numeric codes."
3
+ breaking: false
4
+ security: false
5
+ ---
6
+
7
+ # 0.1.2 — 2026-10-01
8
+
9
+ ## Added
10
+
11
+ - **`coastalBufferKm`** on `geonames_reverse_geocode` (0–50, default 0) — when no country contains the point, matches the nearest country within that many km, for harbor and shoreline fixes; a buffered match carries `country.distanceInKm`, at no extra credit ([#7](https://github.com/cyanheads/geonames-mcp-server/issues/7)).
12
+ - **Alpha-3 and numeric country codes** (`USA`, `840`) in the `countries` filters of `geonames_search_places` and `geonames_find_postal_codes`, sent to GeoNames as alpha-2 from a bundled 250-country table; a well-formed code no country has fails as `unknown_country_code` ([#8](https://github.com/cyanheads/geonames-mcp-server/issues/8)).
13
+ - **`sameAsAdministrative`** on `geonames_get_children` — flags, with a notice, a `tourism` or `dependency` answer that equals the administrative children, GeoNames' fallback when the feature has no such tree; the check costs 1 more credit unless the administrative list is cached ([#5](https://github.com/cyanheads/geonames-mcp-server/issues/5)).
14
+ - **Public hosted endpoint** — `server.json` lists `https://geonames.caseyjhand.com/mcp` as a streamable-http remote, and the README documents the hosted instance.
15
+
16
+ ## Fixed
17
+
18
+ - **`hierarchy: "geography"`** on `geonames_get_children` now fails validation: GeoNames holds no geography tree and answered with the administrative children ([#5](https://github.com/cyanheads/geonames-mcp-server/issues/5)).
19
+ - **`feature_filter_mismatch`** — `geonames_search_places` and `geonames_reverse_geocode` reject, before the request, a code whose class is not in `featureClasses` or a listed class with no code; GeoNames intersects the two lists, so those entries matched nothing ([#6](https://github.com/cyanheads/geonames-mcp-server/issues/6)).
20
+ - **`cities` beside a non-P filter** in `geonames_search_places` — a class other than P or a code outside class P now fails as `feature_filter_mismatch` instead of returning an empty page ([#9](https://github.com/cyanheads/geonames-mcp-server/issues/9)).
21
+ - **Offshore `dstOffsetInHours`** in `geonames_reverse_geocode` reports the standard offset: without a `timezoneId`, GeoNames' `dstOffset: 0` placeholder is replaced by `rawOffset` ([#4](https://github.com/cyanheads/geonames-mcp-server/issues/4)).
22
+ - **Kosovo's `isoNumeric`** — GeoNames' `"0"` placeholder is dropped, so `geonames_get_countries` returns Kosovo with no numeric code and lists `000` in `notFound` ([#10](https://github.com/cyanheads/geonames-mcp-server/issues/10)).
23
+
24
+ ## Dependencies
25
+
26
+ - `@modelcontextprotocol/server` ^2.1.0 → ^2.2.0 (dev)