@blen/uspto-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.
- package/CHANGELOG.md +61 -0
- package/LICENSE +202 -0
- package/NOTICE +55 -0
- package/README.md +229 -2
- package/SECURITY.md +142 -0
- package/dist/accounts/app.d.ts +18 -0
- package/dist/accounts/app.d.ts.map +1 -0
- package/dist/accounts/app.js +407 -0
- package/dist/accounts/app.js.map +1 -0
- package/dist/accounts/config.d.ts +21 -0
- package/dist/accounts/config.d.ts.map +1 -0
- package/dist/accounts/config.js +55 -0
- package/dist/accounts/config.js.map +1 -0
- package/dist/accounts/crypto.d.ts +18 -0
- package/dist/accounts/crypto.d.ts.map +1 -0
- package/dist/accounts/crypto.js +43 -0
- package/dist/accounts/crypto.js.map +1 -0
- package/dist/accounts/keyGates.d.ts +19 -0
- package/dist/accounts/keyGates.d.ts.map +1 -0
- package/dist/accounts/keyGates.js +47 -0
- package/dist/accounts/keyGates.js.map +1 -0
- package/dist/accounts/paths.d.ts +10 -0
- package/dist/accounts/paths.d.ts.map +1 -0
- package/dist/accounts/paths.js +10 -0
- package/dist/accounts/paths.js.map +1 -0
- package/dist/accounts/portal.d.ts +7 -0
- package/dist/accounts/portal.d.ts.map +1 -0
- package/dist/accounts/portal.js +225 -0
- package/dist/accounts/portal.js.map +1 -0
- package/dist/accounts/provider.d.ts +2610 -0
- package/dist/accounts/provider.d.ts.map +1 -0
- package/dist/accounts/provider.js +108 -0
- package/dist/accounts/provider.js.map +1 -0
- package/dist/accounts/runtime.d.ts +26 -0
- package/dist/accounts/runtime.d.ts.map +1 -0
- package/dist/accounts/runtime.js +168 -0
- package/dist/accounts/runtime.js.map +1 -0
- package/dist/accounts/store.d.ts +30 -0
- package/dist/accounts/store.d.ts.map +1 -0
- package/dist/accounts/store.js +155 -0
- package/dist/accounts/store.js.map +1 -0
- package/dist/bin.d.ts +3 -0
- package/dist/bin.d.ts.map +1 -0
- package/dist/bin.js +195 -0
- package/dist/bin.js.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/dist/sandbox/deno.d.ts +35 -0
- package/dist/sandbox/deno.d.ts.map +1 -0
- package/dist/sandbox/deno.js +373 -0
- package/dist/sandbox/deno.js.map +1 -0
- package/dist/sandbox/index.d.ts +28 -0
- package/dist/sandbox/index.d.ts.map +1 -0
- package/dist/sandbox/index.js +55 -0
- package/dist/sandbox/index.js.map +1 -0
- package/dist/sandbox/isolate.d.ts +17 -0
- package/dist/sandbox/isolate.d.ts.map +1 -0
- package/dist/sandbox/isolate.js +195 -0
- package/dist/sandbox/isolate.js.map +1 -0
- package/dist/sandbox/limits.d.ts +60 -0
- package/dist/sandbox/limits.d.ts.map +1 -0
- package/dist/sandbox/limits.js +86 -0
- package/dist/sandbox/limits.js.map +1 -0
- package/dist/sandbox/policy.d.ts +7 -0
- package/dist/sandbox/policy.d.ts.map +1 -0
- package/dist/sandbox/policy.js +87 -0
- package/dist/sandbox/policy.js.map +1 -0
- package/dist/sandbox/types.d.ts +57 -0
- package/dist/sandbox/types.d.ts.map +1 -0
- package/dist/sandbox/types.js +6 -0
- package/dist/sandbox/types.js.map +1 -0
- package/dist/sdk/bindings.d.ts +13 -0
- package/dist/sdk/bindings.d.ts.map +1 -0
- package/dist/sdk/bindings.js +22 -0
- package/dist/sdk/bindings.js.map +1 -0
- package/dist/sdk/odp-client.d.ts +167 -0
- package/dist/sdk/odp-client.d.ts.map +1 -0
- package/dist/sdk/odp-client.js +253 -0
- package/dist/sdk/odp-client.js.map +1 -0
- package/dist/sdk/runtime.d.ts +21 -0
- package/dist/sdk/runtime.d.ts.map +1 -0
- package/dist/sdk/runtime.js +32 -0
- package/dist/sdk/runtime.js.map +1 -0
- package/dist/sdk/sources/corpus-loader.d.ts +8 -0
- package/dist/sdk/sources/corpus-loader.d.ts.map +1 -0
- package/dist/sdk/sources/corpus-loader.js +17 -0
- package/dist/sdk/sources/corpus-loader.js.map +1 -0
- package/dist/sdk/sources/index.d.ts +8 -0
- package/dist/sdk/sources/index.d.ts.map +1 -0
- package/dist/sdk/sources/index.js +25 -0
- package/dist/sdk/sources/index.js.map +1 -0
- package/dist/sdk/sources/odp.d.ts +5 -0
- package/dist/sdk/sources/odp.d.ts.map +1 -0
- package/dist/sdk/sources/odp.js +78 -0
- package/dist/sdk/sources/odp.js.map +1 -0
- package/dist/sdk/sources/source.d.ts +44 -0
- package/dist/sdk/sources/source.d.ts.map +1 -0
- package/dist/sdk/sources/source.js +3 -0
- package/dist/sdk/sources/source.js.map +1 -0
- package/dist/sdk/sources/tsdr.d.ts +5 -0
- package/dist/sdk/sources/tsdr.d.ts.map +1 -0
- package/dist/sdk/sources/tsdr.js +38 -0
- package/dist/sdk/sources/tsdr.js.map +1 -0
- package/dist/sdk/tsdr-client.d.ts +24 -0
- package/dist/sdk/tsdr-client.d.ts.map +1 -0
- package/dist/sdk/tsdr-client.js +65 -0
- package/dist/sdk/tsdr-client.js.map +1 -0
- package/dist/search/bm25.d.ts +25 -0
- package/dist/search/bm25.d.ts.map +1 -0
- package/dist/search/bm25.js +67 -0
- package/dist/search/bm25.js.map +1 -0
- package/dist/search/corpus.d.ts +24 -0
- package/dist/search/corpus.d.ts.map +1 -0
- package/dist/search/corpus.js +23 -0
- package/dist/search/corpus.js.map +1 -0
- package/dist/server/authz.d.ts +40 -0
- package/dist/server/authz.d.ts.map +1 -0
- package/dist/server/authz.js +70 -0
- package/dist/server/authz.js.map +1 -0
- package/dist/server/http.d.ts +44 -0
- package/dist/server/http.d.ts.map +1 -0
- package/dist/server/http.js +199 -0
- package/dist/server/http.js.map +1 -0
- package/dist/server/ipRateLimiter.d.ts +22 -0
- package/dist/server/ipRateLimiter.d.ts.map +1 -0
- package/dist/server/ipRateLimiter.js +58 -0
- package/dist/server/ipRateLimiter.js.map +1 -0
- package/dist/server/mcpServer.d.ts +22 -0
- package/dist/server/mcpServer.d.ts.map +1 -0
- package/dist/server/mcpServer.js +90 -0
- package/dist/server/mcpServer.js.map +1 -0
- package/dist/server/stdio.d.ts +3 -0
- package/dist/server/stdio.d.ts.map +1 -0
- package/dist/server/stdio.js +16 -0
- package/dist/server/stdio.js.map +1 -0
- package/dist/server/toolCatalog.d.ts +162 -0
- package/dist/server/toolCatalog.d.ts.map +1 -0
- package/dist/server/toolCatalog.js +83 -0
- package/dist/server/toolCatalog.js.map +1 -0
- package/dist/server/wellKnown.d.ts +16 -0
- package/dist/server/wellKnown.d.ts.map +1 -0
- package/dist/server/wellKnown.js +17 -0
- package/dist/server/wellKnown.js.map +1 -0
- package/dist/server/zodToJsonSchema.d.ts +8 -0
- package/dist/server/zodToJsonSchema.d.ts.map +1 -0
- package/dist/server/zodToJsonSchema.js +14 -0
- package/dist/server/zodToJsonSchema.js.map +1 -0
- package/dist/supervisor/index.d.ts +54 -0
- package/dist/supervisor/index.d.ts.map +1 -0
- package/dist/supervisor/index.js +62 -0
- package/dist/supervisor/index.js.map +1 -0
- package/dist/tools/describeSchema.d.ts +23 -0
- package/dist/tools/describeSchema.d.ts.map +1 -0
- package/dist/tools/describeSchema.js +14 -0
- package/dist/tools/describeSchema.js.map +1 -0
- package/dist/tools/execute.d.ts +36 -0
- package/dist/tools/execute.d.ts.map +1 -0
- package/dist/tools/execute.js +70 -0
- package/dist/tools/execute.js.map +1 -0
- package/dist/tools/searchApi.d.ts +21 -0
- package/dist/tools/searchApi.d.ts.map +1 -0
- package/dist/tools/searchApi.js +14 -0
- package/dist/tools/searchApi.js.map +1 -0
- package/dist/util/executionContext.d.ts +6 -0
- package/dist/util/executionContext.d.ts.map +1 -0
- package/dist/util/executionContext.js +26 -0
- package/dist/util/executionContext.js.map +1 -0
- package/dist/util/executionLimiter.d.ts +19 -0
- package/dist/util/executionLimiter.d.ts.map +1 -0
- package/dist/util/executionLimiter.js +41 -0
- package/dist/util/executionLimiter.js.map +1 -0
- package/dist/util/httpClient.d.ts +116 -0
- package/dist/util/httpClient.d.ts.map +1 -0
- package/dist/util/httpClient.js +434 -0
- package/dist/util/httpClient.js.map +1 -0
- package/dist/util/logger.d.ts +7 -0
- package/dist/util/logger.d.ts.map +1 -0
- package/dist/util/logger.js +25 -0
- package/dist/util/logger.js.map +1 -0
- package/dist/util/quotas.d.ts +13 -0
- package/dist/util/quotas.d.ts.map +1 -0
- package/dist/util/quotas.js +29 -0
- package/dist/util/quotas.js.map +1 -0
- package/dist/util/tokenBucket.d.ts +11 -0
- package/dist/util/tokenBucket.d.ts.map +1 -0
- package/dist/util/tokenBucket.js +30 -0
- package/dist/util/tokenBucket.js.map +1 -0
- package/dist/util/upstreamGate.d.ts +36 -0
- package/dist/util/upstreamGate.d.ts.map +1 -0
- package/dist/util/upstreamGate.js +112 -0
- package/dist/util/upstreamGate.js.map +1 -0
- package/dist/web/THIRD_PARTY_NOTICES.txt +1940 -0
- package/dist/web/assets/blen-logo-BKJFojyj.png +0 -0
- package/dist/web/assets/index-Dbbu8lq3.js +317 -0
- package/dist/web/assets/index-DkKvyv-b.css +2 -0
- package/dist/web/index.html +14 -0
- package/package.json +127 -4
- package/schema/odp.json +743 -0
- package/schema/tsdr.json +129 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project are documented here. Releases are cut automatically
|
|
4
|
+
from `main` (see CONTRIBUTING.md, "Releasing").
|
|
5
|
+
|
|
6
|
+
## [Unreleased]
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
## [0.1.2] - 2026-11-13
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
- ignore merge-message subjects that arrive as single-parent commits (release)
|
|
14
|
+
|
|
15
|
+
### Changed
|
|
16
|
+
- push the release commit as a GitHub App so main can require PRs (release)
|
|
17
|
+
## [0.1.1] - 2026-11-13
|
|
18
|
+
|
|
19
|
+
### Fixed
|
|
20
|
+
- derive the manifest Node range from engines and smoke it on Node 24 (mcpb)
|
|
21
|
+
- declare the same Node range as engines (mcpb)
|
|
22
|
+
|
|
23
|
+
### Changed
|
|
24
|
+
- make Node and @types/node major bumps deliberate (deps)
|
|
25
|
+
- package and release on Node 26 and test with Deno 2.9.8
|
|
26
|
+
- run Node 26 LTS on Debian 13 with Deno 2.9.8, pinned by digest (docker)
|
|
27
|
+
## [0.1.0] - 2026-11-12
|
|
28
|
+
|
|
29
|
+
### Added
|
|
30
|
+
|
|
31
|
+
- Code-mode MCP server for the USPTO Open Data Portal (`odp.*`: patent file wrapper,
|
|
32
|
+
PTAB trials/appeals/interferences, petition decisions, office actions, legacy office-action
|
|
33
|
+
datasets, bulk-dataset catalog) and TSDR trademark status (`tsdr.*`), with three tools
|
|
34
|
+
(`search_api`, `describe_schema`, `execute`), stdio and stateless Streamable HTTP
|
|
35
|
+
(MCP `2026-07-28`, with a legacy fallback) transports.
|
|
36
|
+
- Sandboxed execution: isolated-vm 7 (prebuilt for Node 24/26) for single-user use, and a
|
|
37
|
+
Deno runner — a permissionless supervisor process running user code in a stripped
|
|
38
|
+
Worker, with token-authenticated frames — which is the only runner for authenticated
|
|
39
|
+
HTTP serving. Host-owned deadlines, process-group cleanup, byte budgets enforced inside
|
|
40
|
+
and outside the sandbox, execution caps, and cancellation on client disconnect.
|
|
41
|
+
- Tool results as compact JSON plus `structuredContent` and `outputSchema`; failed
|
|
42
|
+
executions return `isError` with the full envelope; SDK errors keep their HTTP status.
|
|
43
|
+
- USPTO-aware HTTP client: one request in flight per key, a shared ≥ 5 s pause (or the full
|
|
44
|
+
`Retry-After`) on every `429`, per-attempt hourly budgets, response caching including
|
|
45
|
+
search POSTs, bounded gzip, 8 MiB response cap, and credential redaction in every mode.
|
|
46
|
+
Empty ODP searches return `count: 0` instead of a 404 error.
|
|
47
|
+
- Optional personal accounts (Google sign-in, OAuth/PKCE): each user's own ODP and TSDR keys,
|
|
48
|
+
encrypted at rest, admitted one request at a time per key. Keys are never shared: the
|
|
49
|
+
anonymous endpoint offers documentation tools only.
|
|
50
|
+
- Fail-closed HTTP security: authentication required unless `--insecure` (which binds to
|
|
51
|
+
loopback), OIDC issuer/audience/expiry/subject/scope checks, configured-Host validation,
|
|
52
|
+
Origin checks, and a 1 MiB request cap.
|
|
53
|
+
- Corpus with runnable examples verified against the live API, a field dictionary generated
|
|
54
|
+
from live captures (no personal data), and a generated SDK reference.
|
|
55
|
+
- Docker image (Node 24 + Deno), an MCPB bundle (manifest v0.4) that prompts for keys, and
|
|
56
|
+
third-party license notices in every artifact.
|
|
57
|
+
|
|
58
|
+
[Unreleased]: https://github.com/blen-labs/uspto-mcp-server/compare/v0.1.2...HEAD
|
|
59
|
+
[0.1.2]: https://github.com/blen-labs/uspto-mcp-server/compare/v0.1.1...v0.1.2
|
|
60
|
+
[0.1.1]: https://github.com/blen-labs/uspto-mcp-server/compare/v0.1.0...v0.1.1
|
|
61
|
+
[0.1.0]: https://github.com/blen-labs/uspto-mcp-server/releases/tag/v0.1.0
|
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/NOTICE
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
@blen/uspto-mcp-server
|
|
2
|
+
Copyright 2026 BLEN, Inc.
|
|
3
|
+
|
|
4
|
+
This product includes software developed at BLEN, Inc. (https://blenlabs.com).
|
|
5
|
+
|
|
6
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
you may not use this file except in compliance with the License.
|
|
8
|
+
You may obtain a copy of the License at
|
|
9
|
+
|
|
10
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
|
|
12
|
+
This product fetches data from public U.S. government APIs:
|
|
13
|
+
- USPTO Open Data Portal API (https://api.uspto.gov), U.S. Patent and Trademark Office
|
|
14
|
+
- USPTO Trademark Status & Document Retrieval (TSDR) API (https://tsdrapi.uspto.gov)
|
|
15
|
+
Use of those APIs is subject to USPTO's terms; API keys are issued to individuals and
|
|
16
|
+
must not be shared ("Do not share it with others": https://data.uspto.gov/apis/getting-started).
|
|
17
|
+
|
|
18
|
+
Endpoint paths were checked against the official OpenAPI specifications published
|
|
19
|
+
at https://data.uspto.gov/swagger.
|
|
20
|
+
|
|
21
|
+
The response-field dictionary in schema/odp.json and schema/tsdr.json (entries with
|
|
22
|
+
ids `<binding>.fields.*`) is generated by scripts/gen-fields.mjs from sample API
|
|
23
|
+
responses; each schema file records its sources and file hashes in a `provenance`
|
|
24
|
+
block. The Open Data Portal entries are generated from responses captured from the
|
|
25
|
+
live API with scripts/capture-samples.mjs. Only field names and non-personal example
|
|
26
|
+
values are kept; captured responses are not distributed.
|
|
27
|
+
|
|
28
|
+
The TSDR entries (schema/tsdr.json) are generated from sample API responses published
|
|
29
|
+
in https://github.com/patent-dev/uspto-odp (demo/examples, commit
|
|
30
|
+
8b4114dd095fccc126fcf16b4884755f7b14c3b3), which is licensed under the MIT License:
|
|
31
|
+
|
|
32
|
+
MIT License
|
|
33
|
+
|
|
34
|
+
Copyright (c) 2025 Funktionslust GmbH, Wolfgang Stark, patent.dev
|
|
35
|
+
|
|
36
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
37
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
38
|
+
in the Software without restriction, including without limitation the rights
|
|
39
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
40
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
41
|
+
furnished to do so, subject to the following conditions:
|
|
42
|
+
|
|
43
|
+
The above copyright notice and this permission notice shall be included in all
|
|
44
|
+
copies or substantial portions of the Software.
|
|
45
|
+
|
|
46
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
47
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
48
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
49
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
50
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
51
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
52
|
+
SOFTWARE.
|
|
53
|
+
|
|
54
|
+
The web portal bundle (dist/web) includes third-party open-source packages; their
|
|
55
|
+
license texts are collected at build time in dist/web/THIRD_PARTY_NOTICES.txt.
|
package/README.md
CHANGED
|
@@ -1,3 +1,230 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Patents & Trademarks MCP
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://github.com/blen-labs/uspto-mcp-server/actions/workflows/ci.yml)
|
|
4
|
+
[](https://www.npmjs.com/package/@blen/uspto-mcp-server)
|
|
5
|
+
[](./LICENSE)
|
|
6
|
+
[](https://nodejs.org/)
|
|
7
|
+
[](https://modelcontextprotocol.io/specification/2026-07-28)
|
|
8
|
+
|
|
9
|
+
**Ask your AI assistant real questions about U.S. patents and trademarks — and get answers grounded in the official USPTO APIs.**
|
|
10
|
+
|
|
11
|
+
This is a [Model Context Protocol](https://modelcontextprotocol.io) server that connects any MCP client (Claude Desktop and others) to the U.S. Patent and Trademark Office's public APIs:
|
|
12
|
+
|
|
13
|
+
- **[USPTO Open Data Portal (ODP)](https://data.uspto.gov)** — `api.uspto.gov`: the Patent File Wrapper (bibliographic data, status, continuity, assignments, patent term adjustment, attorneys, transactions, document lists), PTAB trials, appeals and interferences, petition decisions, office actions (full text, rejections, citations), and the bulk-dataset catalog. `developer.uspto.gov` now redirects here.
|
|
14
|
+
- **[TSDR](https://tsdrapi.uspto.gov)** — Trademark Status & Document Retrieval: trademark case status and document lists.
|
|
15
|
+
|
|
16
|
+
Instead of bolting on dozens of rigid, narrow tools, it hands the model a small, well-documented SDK and lets it write the exact query it needs in JavaScript — then runs that code in a locked-down sandbox. This is the **code-mode** pattern, and it makes wide government APIs usable without overwhelming the model with tool definitions.
|
|
17
|
+
|
|
18
|
+
> Independent open-source project. It calls public USPTO APIs and is not affiliated with or endorsed by the USPTO or the U.S. government.
|
|
19
|
+
|
|
20
|
+
## API keys
|
|
21
|
+
|
|
22
|
+
Both sources need a free, **personal** API key. USPTO issues one key per account and says: *"Do not share it with others. It is an identifier unique to you"* ([Getting Started](https://data.uspto.gov/apis/getting-started)). The keys are held host-side and never reach the sandbox.
|
|
23
|
+
|
|
24
|
+
| Source | Key | How to get it | Env var |
|
|
25
|
+
|---|---|---|---|
|
|
26
|
+
| `odp` | ODP API key, sent as `X-API-KEY` | A USPTO.gov account with multi-factor authentication (required for all ODP use since June 18, 2026), linked once to a verified ID.me identity; then sign in at [data.uspto.gov/myodp](https://data.uspto.gov/myodp) and use **Manage API Key**. See [Register for ODP access](https://data.uspto.gov/support/universal-registration). | `USPTO_API_KEY` |
|
|
27
|
+
| `tsdr` | TSDR key, sent as `USPTO-API-KEY` (separate from the ODP key; the ODP key does not work on TSDR) | [USPTO API Key Manager](https://account.uspto.gov/api-manager) | `USPTO_TSDR_API_KEY` |
|
|
28
|
+
|
|
29
|
+
USPTO says a key "shouldn't expire if it is used at least one time per year". Since August 18, 2026, USPTO.gov profiles must include four additional fields; keys of accounts that had not completed them by October 8, 2026 were **deactivated** (every call returns `403`). To reactivate, complete the fields under **Open Data Portal** in your USPTO.gov account settings, then click **Activate API Key** on the ODP Manage API Key page.
|
|
30
|
+
|
|
31
|
+
Without a key, that source is **disabled**: its global still exists in the sandbox, but calls return a `SourceUnavailable` error that says how to get one, while the other source keeps working.
|
|
32
|
+
|
|
33
|
+
## Quickstart (Claude Desktop)
|
|
34
|
+
|
|
35
|
+
Add the server to your Claude Desktop config (**Settings → Developer → Edit Config**):
|
|
36
|
+
|
|
37
|
+
```json
|
|
38
|
+
{
|
|
39
|
+
"mcpServers": {
|
|
40
|
+
"uspto": {
|
|
41
|
+
"command": "npx",
|
|
42
|
+
"args": ["-y", "@blen/uspto-mcp-server"],
|
|
43
|
+
"env": {
|
|
44
|
+
"USPTO_API_KEY": "your-odp-key",
|
|
45
|
+
"USPTO_TSDR_API_KEY": "your-tsdr-key"
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Restart Claude Desktop, then ask in plain language:
|
|
53
|
+
|
|
54
|
+
> *"Which IPRs have been filed against patent 10,169,987, and how did they end?"*
|
|
55
|
+
> *"Show the office actions and rejection grounds for application 17/248,024."*
|
|
56
|
+
> *"What's the status of trademark serial number 97123456?"*
|
|
57
|
+
|
|
58
|
+
Requires **Node.js 24 or 26** (LTS). `npx` downloads and runs the server on demand. If `execute` reports `SandboxUnavailable`, see [Sandbox runtimes](#sandbox-runtimes). A Claude Desktop extension bundle (`.mcpb`) that asks for the keys at install time is built from this repository (`pnpm mcpb:prepare && pnpm mcpb:pack`).
|
|
59
|
+
|
|
60
|
+
## See it in action
|
|
61
|
+
|
|
62
|
+
> *"Has anyone challenged patent 10,169,987 at the PTAB?"*
|
|
63
|
+
|
|
64
|
+
The model finds the right calls with `search_api` and runs them in the sandbox:
|
|
65
|
+
|
|
66
|
+
```js
|
|
67
|
+
const trials = await odp.ptab.proceedings.search({
|
|
68
|
+
q: 'patentOwnerData.patentNumber:10169987',
|
|
69
|
+
fields: ['trialNumber', 'trialMetaData.trialTypeCode', 'trialMetaData.trialStatusCategory',
|
|
70
|
+
'regularPetitionerData.realPartyInInterestName'],
|
|
71
|
+
});
|
|
72
|
+
const first = trials.patentTrialProceedingDataBag[0].trialNumber;
|
|
73
|
+
const decisions = await odp.ptab.decisions.byTrial(first);
|
|
74
|
+
return decisions.patentTrialDocumentDataBag.map(d => ({
|
|
75
|
+
date: d.decisionData?.decisionIssueDate,
|
|
76
|
+
outcome: d.decisionData?.trialOutcomeCategory,
|
|
77
|
+
}));
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
…then answers in plain English, citing the trials and decisions it found.
|
|
81
|
+
|
|
82
|
+
## What's covered
|
|
83
|
+
|
|
84
|
+
| Need | Call |
|
|
85
|
+
|---|---|
|
|
86
|
+
| Find applications/patents by title, applicant, inventor, CPC, dates, status | `odp.patents.search` |
|
|
87
|
+
| Application behind a granted patent number | `odp.patents.byPatentNumber` |
|
|
88
|
+
| One application's metadata, continuity, assignments, PTA, attorney, transactions, documents | `odp.patents.get` / `metaData` / `continuity` / `assignment` / `adjustment` / `attorney` / `transactions` / `documents` |
|
|
89
|
+
| PTAB trials (IPR/PGR/CBM/DER), decisions, papers | `odp.ptab.proceedings.*`, `odp.ptab.decisions.*`, `odp.ptab.documents.*` |
|
|
90
|
+
| Ex parte appeals and interferences | `odp.ptab.appeals.*`, `odp.ptab.interferences.*` |
|
|
91
|
+
| Petition decisions (with decision documents) | `odp.petitions.*` |
|
|
92
|
+
| Office action full text and rejection grounds | `odp.officeActions.*` (current) and `odp.oa.*` (legacy DSAPI: text, citations, per-claim rejections, enriched citations) |
|
|
93
|
+
| Bulk dataset catalog and file lists | `odp.bulk.*` |
|
|
94
|
+
| Trademark status (1–25 cases per call), documents, last update | `tsdr.*` |
|
|
95
|
+
|
|
96
|
+
Full surface: [`docs/sdk-reference.md`](./docs/sdk-reference.md). File downloads — PDFs, bulk files, and `search/download` CSV exports — are intentionally **not** exposed; the SDK returns their URLs instead.
|
|
97
|
+
|
|
98
|
+
## How it works
|
|
99
|
+
|
|
100
|
+
Three tools, in the order the model uses them:
|
|
101
|
+
|
|
102
|
+
| Tool | What it does |
|
|
103
|
+
|---|---|
|
|
104
|
+
| `search_api(query, k?)` | BM25 over the SDK method docs and a response-field dictionary. Returns signatures and ready-to-run JavaScript. |
|
|
105
|
+
| `describe_schema({ path? \| prefix? })` | Looks up an exact entry (`odp.patents.search`) or lists a namespace (`odp.ptab.`). |
|
|
106
|
+
| `execute({ code, timeoutMs?, memoryMb? })` | Runs JavaScript (no type annotations; top-level `await`/`return` allowed) in the sandbox with `odp` and `tsdr` as globals. `timeoutMs` defaults to 30 s (max 120 s). |
|
|
107
|
+
|
|
108
|
+
All three are annotated read-only and non-destructive (`execute` is also `openWorldHint: true`) and publish an `outputSchema`. Results come back as compact JSON text plus the same object as `structuredContent`. A failed execution (thrown error, timeout, limit) is returned with `isError: true` and the full envelope — `{ ok: false, error: { name, message, status? }, logs, durationMs }` — so the model sees what went wrong. A search with no hits returns `{ count: 0, …Bag: [] }`, not an error.
|
|
109
|
+
|
|
110
|
+
```text
|
|
111
|
+
MCP client → execute(code) → sandbox → odp.* / tsdr.* RPC bridge → host HttpClient (key, queue, cache) → api.uspto.gov / tsdrapi.uspto.gov
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Architecture: [`docs/architecture.md`](./docs/architecture.md) · Paste-ready examples: [`examples/`](./examples/).
|
|
115
|
+
|
|
116
|
+
### USPTO rate limits, and how the server respects them
|
|
117
|
+
|
|
118
|
+
USPTO [allows](https://data.uspto.gov/apis/api-rate-limits) **one request in flight per API key** (burst 1; concurrent calls get `429`), 4–15 requests/second, and 5 million metadata plus 1.2 million document calls per key per week (reset Sunday 00:00 UTC). It asks clients to wait at least 5 seconds after a `429`. So the server:
|
|
119
|
+
|
|
120
|
+
- queues each key's calls through a gate: one in flight, at most 4 starts/s for ODP and 1/s for TSDR (`Promise.all` in sandbox code is safe but not faster);
|
|
121
|
+
- on a `429`, pauses every caller of that key for at least 5 s (or the full `Retry-After`, if longer), then retries that one call once if the pause is 30 s or less; otherwise the call fails with `RateLimited`;
|
|
122
|
+
- caps upstream calls per `execute()` (ODP 50, TSDR 25), per hour per key (counting every real attempt, retries included), and per authenticated subject;
|
|
123
|
+
- caches responses, including search POSTs keyed by their body, so repeated questions don't spend quota;
|
|
124
|
+
- rejects upstream bodies over 8 MiB (`ResponseTooLarge`) and results over 256 KiB returned from `execute` (`ResultTooLarge`) — use `fields` and `limit` to keep records small.
|
|
125
|
+
|
|
126
|
+
## Personal accounts (hosted mode)
|
|
127
|
+
|
|
128
|
+
`USPTO_AUTH_PROVIDER=accounts` adds Google sign-in, an `/account` page where each user saves their own ODP and TSDR keys (checked against USPTO, encrypted in PostgreSQL, never shown again), and OAuth/PKCE connections at `/mcp/account`. Each signed-in user's queries use only that user's own keys. Because USPTO keys are personal, account mode **never** uses an operator key (`USPTO_API_KEY`, `USPTO_TSDR_API_KEY` are ignored there): the anonymous `/mcp` endpoint offers only the documentation tools (`search_api`, `describe_schema`), and `execute` requires signing in. See [docs/accounts.md](docs/accounts.md).
|
|
129
|
+
|
|
130
|
+
## Sandbox runtimes
|
|
131
|
+
|
|
132
|
+
`execute` needs a sandbox runner:
|
|
133
|
+
|
|
134
|
+
1. **`isolated-vm`** — a fresh V8 isolate per execution, with a heap cap and a host-enforced deadline. `isolated-vm` 7 ships prebuilt binaries for Node 24 and 26 on macOS arm64, Linux x64/arm64 (glibc and musl) and Windows x64, so no compiler is needed. Preferred for single-user use (stdio, `--insecure` local HTTP).
|
|
135
|
+
2. **Deno** — user code runs in a separate `deno` process with no permissions (no network, files, env or subprocesses), inside a Worker stripped of `Deno`, `fetch` and messaging globals; the server owns the deadline and kills the process group. Install [Deno](https://docs.deno.com/runtime/getting_started/installation/) and it is used when `isolated-vm` is unavailable, or always with `--sandbox deno` (`USPTO_SANDBOX=deno`).
|
|
136
|
+
3. **Authenticated HTTP serving** (OIDC or accounts) runs user code **only** in the Deno runner — a separate, killable process per execution. `--sandbox isolate` is refused there, and without Deno, `execute` reports `SandboxUnavailable` instead of falling back to in-process execution.
|
|
137
|
+
4. If no runner is available, `search_api` and `describe_schema` still work; `execute` returns `SandboxUnavailable` with instructions.
|
|
138
|
+
|
|
139
|
+
Every execution is bounded: code 256 KiB, returned value 256 KiB (`ResultTooLarge`), logs 64 KiB / 1,000 lines, SDK-call arguments 64 KiB, 16 calls pending at once. At most 8 executions run at once per server and 2 per authenticated subject (`USPTO_MAX_CONCURRENT_EXECUTIONS`, `USPTO_MAX_EXECUTIONS_PER_SUBJECT`); a client that cancels or disconnects stops its execution and any upstream calls in flight.
|
|
140
|
+
|
|
141
|
+
## Self-hosting (remote HTTP)
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
# Local, single user, no auth (binds 127.0.0.1 unless HOST/--host says otherwise):
|
|
145
|
+
USPTO_API_KEY=... npx @blen/uspto-mcp-server --http --insecure --port 8080
|
|
146
|
+
|
|
147
|
+
# Your own server, authenticated via an OIDC issuer (your key serves only you: see API keys).
|
|
148
|
+
# Issuer, audience and an https JWKS URL are all required; Deno must be installed.
|
|
149
|
+
USPTO_API_KEY=... \
|
|
150
|
+
USPTO_AUTH_PROVIDER=clerk \
|
|
151
|
+
USPTO_AUTH_ISSUER=https://<tenant>.clerk.accounts.dev \
|
|
152
|
+
USPTO_AUTH_AUDIENCE=https://your-host.example.com/mcp \
|
|
153
|
+
USPTO_AUTH_JWKS_URL=https://<tenant>.clerk.accounts.dev/.well-known/jwks.json \
|
|
154
|
+
USPTO_PUBLIC_ORIGIN=https://your-host.example.com \
|
|
155
|
+
npx @blen/uspto-mcp-server --http
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
Then point any MCP client at it:
|
|
159
|
+
|
|
160
|
+
```json
|
|
161
|
+
{ "mcpServers": { "uspto": { "type": "http", "url": "https://your-host.example.com/mcp" } } }
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
The HTTP transport implements the stateless MCP `2026-07-28` Streamable HTTP profile — no `initialize` handshake and no `Mcp-Session-Id` — with a stateless legacy fallback for pre-2026 clients. It fails closed:
|
|
165
|
+
|
|
166
|
+
- `--http` without `--insecure` refuses to start unless real authentication is configured (an OIDC provider, or `accounts`). OIDC tokens must carry the configured issuer and audience, an expiry and a subject, use an asymmetric algorithm, and hold every scope in `USPTO_AUTH_SCOPES` (otherwise `403 insufficient_scope`).
|
|
167
|
+
- Listening on anything but loopback requires `USPTO_PUBLIC_ORIGIN` or `USPTO_ALLOWED_HOSTS`: every request's `Host` must match the configured names (DNS-rebinding protection); the trusted origin is never taken from the request. Browser `Origin`s other than the server's own, loopback, or `USPTO_ALLOWED_ORIGINS` get `403`.
|
|
168
|
+
- Request bodies are capped at 1 MiB, and tool arguments at a fixed number of elements.
|
|
169
|
+
|
|
170
|
+
It also serves OAuth 2.0 Protected Resource Metadata (RFC 9728), per-IP rate limiting and per-subject daily quotas. A Railway walkthrough is in [`deploy/RAILWAY.md`](./deploy/RAILWAY.md); the [`Dockerfile`](./deploy/Dockerfile) runs on Node 26 (LTS) with Deno included.
|
|
171
|
+
|
|
172
|
+
The per-key gates, hourly buckets and quotas are in memory, so run **one replica** — and avoid deploys where an old and a new instance serve at the same time — or USPTO sees concurrent requests with one key.
|
|
173
|
+
|
|
174
|
+
### Configuration
|
|
175
|
+
|
|
176
|
+
The most common knobs (full list and defaults in [`.env.example`](./.env.example)):
|
|
177
|
+
|
|
178
|
+
| Variable | Default | Notes |
|
|
179
|
+
|---|---|---|
|
|
180
|
+
| `USPTO_API_KEY` | — | ODP key. Unset ⇒ `odp` disabled. |
|
|
181
|
+
| `USPTO_TSDR_API_KEY` | — | TSDR key. Unset ⇒ `tsdr` disabled. |
|
|
182
|
+
| `USPTO_SANDBOX` | `auto` | `auto` / `isolate` / `deno` |
|
|
183
|
+
| `USPTO_USER_AGENT` | `uspto-mcp-server/0.1 …` | Identify your deployment. |
|
|
184
|
+
| `USPTO_ODP_MAX_CALLS_PER_EXECUTE` / `USPTO_TSDR_MAX_CALLS_PER_EXECUTE` | `50` / `25` | Upstream calls per `execute()` (`CallBudgetExceeded`). |
|
|
185
|
+
| `USPTO_ODP_RATE_PER_HOUR` / `USPTO_TSDR_RATE_PER_HOUR` | `5000` / `3000` | Hourly attempts per configured key (per account in account mode). Must be ≥ 1. |
|
|
186
|
+
| `USPTO_ODP_SUBJECT_RATE_PER_HOUR` / `USPTO_TSDR_SUBJECT_RATE_PER_HOUR` | `1000` / `600` | Per authenticated subject per hour (HTTP only). |
|
|
187
|
+
| `USPTO_ODP_CONCURRENCY` / `USPTO_TSDR_CONCURRENCY` | `1` / `1` | Requests in flight per key. Keep 1. |
|
|
188
|
+
| `USPTO_ODP_RATE_PER_SEC` / `USPTO_TSDR_RATE_PER_SEC` | `4` / `1` | Requests started per second per key. |
|
|
189
|
+
| `USPTO_MAX_RESPONSE_BYTES` | `8388608` | Largest upstream body accepted. |
|
|
190
|
+
| `USPTO_MAX_CONCURRENT_EXECUTIONS` / `USPTO_MAX_EXECUTIONS_PER_SUBJECT` | `8` / `2` | Simultaneous executions per server / per authenticated subject (`Busy` beyond). |
|
|
191
|
+
| `USPTO_CACHE_TTL_MS` / `USPTO_CACHE_MAX_ITEMS` | `600000` / `1000` | Response cache. |
|
|
192
|
+
| `USPTO_AUTH_PROVIDER` | `none` | `none` (only with `--insecure`) / `generic-oidc` / `clerk` / `workos` / `auth0` / `accounts`. Unknown values stop startup. The OIDC providers serve every token holder with this server's own USPTO keys, so use them only for yourself; to host for other people use `accounts`, where each user brings their own key (USPTO keys are personal). |
|
|
193
|
+
| `USPTO_AUTH_ISSUER` / `USPTO_AUTH_AUDIENCE` / `USPTO_AUTH_JWKS_URL` | — | Required for OIDC providers (JWKS over https; http only on loopback). |
|
|
194
|
+
| `USPTO_AUTH_SCOPES` | — | Comma-separated scopes every token must carry; advertised in resource metadata. |
|
|
195
|
+
| `USPTO_PUBLIC_ORIGIN` | — | Public origin clients reach (OAuth metadata, trusted Host). Required for non-loopback HTTP unless `USPTO_ALLOWED_HOSTS` is set. |
|
|
196
|
+
| `USPTO_ALLOWED_HOSTS` | — | Extra accepted `Host` values (comma-separated); `*` disables the check (unsafe). |
|
|
197
|
+
| `USPTO_IP_RPS` / `USPTO_IP_BURST` | `5` / `20` | Per-IP token bucket on the HTTP transport. |
|
|
198
|
+
| `USPTO_CLIENT_IP_HEADER` | unset | Header your proxy overwrites with the client address (Railway: `x-real-ip`). |
|
|
199
|
+
| `USPTO_SUBJECT_DAILY_QUOTA` | `10000` | Requests per authenticated subject per UTC day. |
|
|
200
|
+
|
|
201
|
+
CLI options: `--http`, `--port`, `--host`, `--sandbox auto|isolate|deno`, `--insecure`, `--help`.
|
|
202
|
+
|
|
203
|
+
## Security
|
|
204
|
+
|
|
205
|
+
User code is sandboxed by design — no network, filesystem, env, or subprocess access, an `acorn` AST preflight, a host-enforced wall-clock deadline, byte budgets, and a V8 heap cap. API keys stay in the host process; any key an upstream echoes back is redacted from results and errors in every mode. The threat model is in [`SECURITY.md`](./SECURITY.md). Found a sandbox escape or auth bypass? Please open a [private Security Advisory](https://github.com/blen-labs/uspto-mcp-server/security/advisories/new) rather than a public issue.
|
|
206
|
+
|
|
207
|
+
## Contributing
|
|
208
|
+
|
|
209
|
+
See [`CONTRIBUTING.md`](./CONTRIBUTING.md) for the dev setup and ground rules, and please open an issue before anything non-trivial. By participating you agree to the [Code of Conduct](./CODE_OF_CONDUCT.md).
|
|
210
|
+
|
|
211
|
+
## License
|
|
212
|
+
|
|
213
|
+
[Apache-2.0](./LICENSE) © 2026 BLEN, Inc. See also [`NOTICE`](./NOTICE).
|
|
214
|
+
|
|
215
|
+
## Hosted service policies
|
|
216
|
+
|
|
217
|
+
The BLEN-hosted connector's [Privacy Policy](./legal/privacy-policy.md) and
|
|
218
|
+
[Terms of Service](./legal/terms.md) describe data handling and conditions of
|
|
219
|
+
use. The software remains licensed under Apache-2.0; self-hosted operators
|
|
220
|
+
are responsible for their own policies.
|
|
221
|
+
|
|
222
|
+
## Acknowledgements
|
|
223
|
+
|
|
224
|
+
- The USPTO for publishing the Open Data Portal and TSDR APIs.
|
|
225
|
+
- [patent-dev/uspto-odp](https://github.com/patent-dev/uspto-odp) (MIT) for published sample responses, used for the TSDR part of the field dictionary until it can be captured live (the ODP part is generated from live captures).
|
|
226
|
+
- The [Model Context Protocol](https://modelcontextprotocol.io) team for the spec and TypeScript SDK.
|
|
227
|
+
|
|
228
|
+
---
|
|
229
|
+
|
|
230
|
+
Built by [BLEN, Inc](https://www.blencorp.com).
|