machine-internet 0.1.0__tar.gz
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.
- machine_internet-0.1.0/.gitignore +16 -0
- machine_internet-0.1.0/LICENSE +201 -0
- machine_internet-0.1.0/PKG-INFO +201 -0
- machine_internet-0.1.0/README.md +173 -0
- machine_internet-0.1.0/machine_internet/__init__.py +0 -0
- machine_internet-0.1.0/machine_internet/ai/__init__.py +0 -0
- machine_internet-0.1.0/machine_internet/ai/client.py +146 -0
- machine_internet-0.1.0/machine_internet/auth/__init__.py +0 -0
- machine_internet-0.1.0/machine_internet/auth/injector.py +102 -0
- machine_internet-0.1.0/machine_internet/cli.py +361 -0
- machine_internet-0.1.0/machine_internet/condensation/__init__.py +0 -0
- machine_internet-0.1.0/machine_internet/condensation/condenser.py +262 -0
- machine_internet-0.1.0/machine_internet/condensation/eval.py +131 -0
- machine_internet-0.1.0/machine_internet/config.py +26 -0
- machine_internet-0.1.0/machine_internet/discovery/__init__.py +0 -0
- machine_internet-0.1.0/machine_internet/discovery/errors.py +60 -0
- machine_internet-0.1.0/machine_internet/discovery/openapi.py +281 -0
- machine_internet-0.1.0/machine_internet/discovery/schema.py +104 -0
- machine_internet-0.1.0/machine_internet/discovery/traffic.py +433 -0
- machine_internet-0.1.0/machine_internet/examples/archive_org.json +127 -0
- machine_internet-0.1.0/machine_internet/examples/bundlephobia.json +200 -0
- machine_internet-0.1.0/machine_internet/examples/caniuse.json +133 -0
- machine_internet-0.1.0/machine_internet/examples/crates_io.json +273 -0
- machine_internet-0.1.0/machine_internet/examples/deps_dev.json +332 -0
- machine_internet-0.1.0/machine_internet/examples/hacker_news.json +86 -0
- machine_internet-0.1.0/machine_internet/examples/huggingface.json +56 -0
- machine_internet-0.1.0/machine_internet/examples/npm_trends.json +154 -0
- machine_internet-0.1.0/machine_internet/examples/ossinsight.json +98 -0
- machine_internet-0.1.0/machine_internet/examples/regex101.json +126 -0
- machine_internet-0.1.0/machine_internet/serving/__init__.py +0 -0
- machine_internet-0.1.0/machine_internet/serving/executor.py +140 -0
- machine_internet-0.1.0/machine_internet/serving/mcp_server.py +158 -0
- machine_internet-0.1.0/pyproject.toml +45 -0
|
@@ -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 [yyyy] [name of copyright owner]
|
|
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.
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: machine-internet
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Turn any website into an MCP server. No API needed.
|
|
5
|
+
Project-URL: Homepage, https://github.com/chetanty/machine_internet
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
License-File: LICENSE
|
|
8
|
+
Keywords: ai-agents,api,claude,mcp,model-context-protocol,openapi,scraping
|
|
9
|
+
Classifier: Intended Audience :: Developers
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
12
|
+
Requires-Python: >=3.10
|
|
13
|
+
Requires-Dist: anthropic>=2.8.0
|
|
14
|
+
Requires-Dist: click>=8.1.7
|
|
15
|
+
Requires-Dist: google-genai>=0.5.0
|
|
16
|
+
Requires-Dist: httpx>=0.27.0
|
|
17
|
+
Requires-Dist: mcp<2,>=1.27
|
|
18
|
+
Requires-Dist: openai>=1.0.0
|
|
19
|
+
Requires-Dist: playwright>=1.44.0
|
|
20
|
+
Requires-Dist: pydantic-settings>=2.3.0
|
|
21
|
+
Requires-Dist: pydantic>=2.7.0
|
|
22
|
+
Requires-Dist: pyyaml>=6.0.1
|
|
23
|
+
Requires-Dist: uvicorn>=0.30.0
|
|
24
|
+
Provides-Extra: dev
|
|
25
|
+
Requires-Dist: pytest-asyncio>=0.23.0; extra == 'dev'
|
|
26
|
+
Requires-Dist: pytest>=8.2.0; extra == 'dev'
|
|
27
|
+
Description-Content-Type: text/markdown
|
|
28
|
+
|
|
29
|
+
# Machine Internet
|
|
30
|
+
|
|
31
|
+
**Turn any website into an MCP server. No API needed.**
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
uvx machine-internet wrap https://bundlephobia.com/package/react
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Machine Internet opens the site in a headless browser, watches the hidden API calls the page makes, and turns them into a small set of clean tools that Claude, Cursor or any MCP client can call directly.
|
|
38
|
+
|
|
39
|
+

|
|
40
|
+
|
|
41
|
+
[](https://github.com/chetanty/machine_internet/actions/workflows/ci.yml)
|
|
42
|
+

|
|
43
|
+

|
|
44
|
+

|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## Try it in 30 seconds (no API key)
|
|
49
|
+
|
|
50
|
+
Ten sites come pre-wrapped, most with no public API. Add one to your Claude Desktop or Cursor config:
|
|
51
|
+
|
|
52
|
+
```json
|
|
53
|
+
{
|
|
54
|
+
"mcpServers": {
|
|
55
|
+
"bundlephobia": {
|
|
56
|
+
"command": "uvx",
|
|
57
|
+
"args": ["machine-internet", "serve", "bundlephobia"]
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Restart your client and ask: *"How big is react-dom gzipped, and is lodash-es tree-shakeable?"*
|
|
64
|
+
|
|
65
|
+
| Example | Site | Tools |
|
|
66
|
+
|---|---|---|
|
|
67
|
+
| `bundlephobia` | [bundlephobia.com](https://bundlephobia.com) | 6: package size, tree-shaking check, size history, similar packages, per-export sizes, recent |
|
|
68
|
+
| `caniuse` | [caniuse.com](https://caniuse.com) | 4: search features, browser support data, feature details, news |
|
|
69
|
+
| `npm_trends` | [npmtrends.com](https://npmtrends.com) | 4: package info, weekly downloads, download trends, GitHub stats |
|
|
70
|
+
| `deps_dev` | [deps.dev](https://deps.dev) | 7: versions, dependencies, dependency graph, dependents, requirements, stats |
|
|
71
|
+
| `crates_io` | [crates.io](https://crates.io) | 6: search crates, crate info, versions, version details, stats, summary |
|
|
72
|
+
| `huggingface` | [huggingface.co](https://huggingface.co) | 1: search models, datasets and Spaces |
|
|
73
|
+
| `hacker_news` | [hn.algolia.com](https://hn.algolia.com) | 1: full-text search of HN stories and comments |
|
|
74
|
+
| `archive_org` | [archive.org](https://archive.org) | 3: search the archive, item metadata, item favorites |
|
|
75
|
+
| `ossinsight` | [ossinsight.io](https://ossinsight.io) | 2: search GitHub repos, users and orgs, live GitHub event stats |
|
|
76
|
+
| `regex101` | [regex101.com](https://regex101.com) | 3: browse the community library, get a saved regex, list versions |
|
|
77
|
+
|
|
78
|
+
You need [uv](https://docs.astral.sh/uv/) for `uvx`. Or install it once with `pip install machine-internet` (or straight from GitHub: `pip install git+https://github.com/chetanty/machine_internet`) and use `machine-internet` as the command.
|
|
79
|
+
|
|
80
|
+
**Hosted, nothing to install:** every example is also live at [machine-internet.vercel.app](https://machine-internet.vercel.app) as a remote MCP endpoint, e.g. `https://machine-internet.vercel.app/mcp/bundlephobia`. Clients with remote MCP support take the URL directly; others can use `npx mcp-remote <url>`. Some sites rate-limit requests from cloud servers (npm's download stats do), so for heavy use run `serve` locally, which calls the site from your own connection.
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
## Wrap your own site
|
|
85
|
+
|
|
86
|
+
Set an LLM key (any one of these works):
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
export ANTHROPIC_API_KEY=... # or OPENAI_API_KEY, or GEMINI_API_KEY
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Then point it at a page that loads data as you use it:
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
uvx machine-internet wrap https://bundlephobia.com/package/react
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
```
|
|
99
|
+
Wrapping https://bundlephobia.com/package/react
|
|
100
|
+
Checking for an OpenAPI spec ...
|
|
101
|
+
Sniffing network traffic in a headless browser ...
|
|
102
|
+
[OK] Inferred 4 endpoints
|
|
103
|
+
Condensing into agent tools ...
|
|
104
|
+
[OK] 4 tools:
|
|
105
|
+
get_package_size: Use this tool to get detailed size information for a JavaScript packag
|
|
106
|
+
get_package_history: Use this tool to retrieve the historical versions of a specific JavaSc
|
|
107
|
+
...
|
|
108
|
+
|
|
109
|
+
Add this to your MCP client config (Claude Desktop, Cursor, ...):
|
|
110
|
+
{ "mcpServers": { "bundlephobia_api": { "command": "uvx", "args": ["machine-internet", "serve", "bundlephobia_api"] } } }
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
The first run downloads headless Chromium once (about 150 MB). Wrapping takes 1 to 3 minutes and costs a few cents of LLM usage. Serving afterwards needs no LLM at all.
|
|
114
|
+
|
|
115
|
+
**Tips**
|
|
116
|
+
- Pick a page that fetches data: a search results page or an item page works better than a static landing page.
|
|
117
|
+
- If the site publishes an OpenAPI spec, it is used automatically and nothing is sniffed. Point at one directly with `--spec <url>`.
|
|
118
|
+
- Large specs: keep only some areas with `--tags repos,issues`.
|
|
119
|
+
|
|
120
|
+
---
|
|
121
|
+
|
|
122
|
+
## How it works
|
|
123
|
+
|
|
124
|
+
1. **Spec check.** Probes about 20 standard locations (`/openapi.json`, `/swagger.json`, ...). If a real spec exists, it is parsed directly.
|
|
125
|
+
2. **Traffic sniffing.** Otherwise, launches headless Chromium, loads the page, scrolls and clicks through it, and records every same-site JSON request. Analytics and ad trackers are filtered out.
|
|
126
|
+
3. **Inference.** An LLM reads the captured requests and responses and infers each endpoint's path, parameters and types.
|
|
127
|
+
4. **Condensation.** An LLM collapses the endpoints into at most 15 `verb_noun` tools, with descriptions written so an agent knows when to use each one.
|
|
128
|
+
5. **Serving.** The result is a small JSON file. `machine-internet serve` exposes it as a standard MCP server (stdio by default, SSE with `--sse`) that makes real calls to the real site.
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
## Commands
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
machine-internet wrap <url> [--name NAME] [--spec URL] [--tags a,b] [--sniff] [-o FILE]
|
|
136
|
+
machine-internet serve <name-or-file.json> [--sse --port 8000]
|
|
137
|
+
machine-internet list # bundled examples and servers you have wrapped
|
|
138
|
+
machine-internet tools <name> # show a server's tools and parameters
|
|
139
|
+
machine-internet call <name> <tool> key=value ... # call a tool from the terminal
|
|
140
|
+
machine-internet config <name> # print the MCP client config block
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
Wrapped servers are saved to `~/.machine-internet/schemas/`.
|
|
144
|
+
|
|
145
|
+
**APIs that need auth:** credentials are read from the environment when the server runs: `MI_TOKEN` (bearer), `MI_API_KEY` (plus `MI_API_KEY_NAME`, `MI_API_KEY_IN=header|query`), `MI_USERNAME` / `MI_PASSWORD`, or `MI_TOKEN_URL` / `MI_CLIENT_ID` / `MI_CLIENT_SECRET` for OAuth2 client credentials. Put them in the `env` block of your MCP client config.
|
|
146
|
+
|
|
147
|
+
---
|
|
148
|
+
|
|
149
|
+
## What it works on
|
|
150
|
+
|
|
151
|
+
It works on sites whose pages load their data with API calls from the browser: most single-page apps, search pages, dashboards and developer tools. It does not work on sites that render pages on the server, or that block headless browsers.
|
|
152
|
+
|
|
153
|
+
Results from pointing `wrap` at 15 popular sites, with each generated tool then called for real:
|
|
154
|
+
|
|
155
|
+
| Result | Sites |
|
|
156
|
+
|---|---|
|
|
157
|
+
| Works | crates.io, deps.dev, Hugging Face, archive.org, HN Search (Algolia), OSS Insight |
|
|
158
|
+
| Partly works | Open Library (1 of 2 tools) |
|
|
159
|
+
| No hidden API found (server-rendered) | IMDb, Reddit, GitHub Trending, npmjs.com |
|
|
160
|
+
| Blocked or only trackers seen | Product Hunt, lichess, packagephobia |
|
|
161
|
+
| Nothing useful captured | dev.to (only a session-token call) |
|
|
162
|
+
|
|
163
|
+
So roughly half of the arbitrary sites tried. When it fails, it says why and suggests a page that is more likely to work.
|
|
164
|
+
|
|
165
|
+
## Limitations
|
|
166
|
+
|
|
167
|
+
- **Internal APIs change without notice.** A wrapped site can break when it ships a new frontend. Re-run `wrap` to refresh it.
|
|
168
|
+
- **It only sees what the page does while loading and being clicked.** Actions behind logins, multi-step forms or heavy anti-bot protection usually are not captured.
|
|
169
|
+
- **LLM output varies.** If the tools look wrong, run `wrap` again or narrow the page you point it at.
|
|
170
|
+
|
|
171
|
+
## Use responsibly
|
|
172
|
+
|
|
173
|
+
Undocumented APIs are still someone else's service. Check the site's terms before wrapping it, keep request volume reasonable, and do not use this to get around access controls or rate limits.
|
|
174
|
+
|
|
175
|
+
---
|
|
176
|
+
|
|
177
|
+
## How it compares
|
|
178
|
+
|
|
179
|
+
| | Machine Internet | OpenAPI-to-MCP converters | Browser agents |
|
|
180
|
+
|---|---|---|---|
|
|
181
|
+
| Works without an API spec | Yes | No | Yes |
|
|
182
|
+
| Agent calls the API directly (fast, cheap per call) | Yes | Yes | No, drives a browser every time |
|
|
183
|
+
| One command from URL to MCP server | Yes | Needs a spec | No |
|
|
184
|
+
|
|
185
|
+
Related work worth knowing: [Integuru](https://github.com/Integuru-AI/Integuru) generates integration code from captured traffic, and [mitmproxy2swagger](https://github.com/alufers/mitmproxy2swagger) builds OpenAPI specs from recorded traffic. Machine Internet's focus is going straight from a URL to a running MCP server.
|
|
186
|
+
|
|
187
|
+
---
|
|
188
|
+
|
|
189
|
+
## Development
|
|
190
|
+
|
|
191
|
+
```bash
|
|
192
|
+
git clone https://github.com/chetanty/machine_internet
|
|
193
|
+
cd machine_internet
|
|
194
|
+
pip install -e ".[dev]"
|
|
195
|
+
pytest
|
|
196
|
+
python evals/score.py # condensation quality evals (needs an LLM key)
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
## License
|
|
200
|
+
|
|
201
|
+
Apache 2.0
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
# Machine Internet
|
|
2
|
+
|
|
3
|
+
**Turn any website into an MCP server. No API needed.**
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
uvx machine-internet wrap https://bundlephobia.com/package/react
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
Machine Internet opens the site in a headless browser, watches the hidden API calls the page makes, and turns them into a small set of clean tools that Claude, Cursor or any MCP client can call directly.
|
|
10
|
+
|
|
11
|
+

|
|
12
|
+
|
|
13
|
+
[](https://github.com/chetanty/machine_internet/actions/workflows/ci.yml)
|
|
14
|
+

|
|
15
|
+

|
|
16
|
+

|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Try it in 30 seconds (no API key)
|
|
21
|
+
|
|
22
|
+
Ten sites come pre-wrapped, most with no public API. Add one to your Claude Desktop or Cursor config:
|
|
23
|
+
|
|
24
|
+
```json
|
|
25
|
+
{
|
|
26
|
+
"mcpServers": {
|
|
27
|
+
"bundlephobia": {
|
|
28
|
+
"command": "uvx",
|
|
29
|
+
"args": ["machine-internet", "serve", "bundlephobia"]
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Restart your client and ask: *"How big is react-dom gzipped, and is lodash-es tree-shakeable?"*
|
|
36
|
+
|
|
37
|
+
| Example | Site | Tools |
|
|
38
|
+
|---|---|---|
|
|
39
|
+
| `bundlephobia` | [bundlephobia.com](https://bundlephobia.com) | 6: package size, tree-shaking check, size history, similar packages, per-export sizes, recent |
|
|
40
|
+
| `caniuse` | [caniuse.com](https://caniuse.com) | 4: search features, browser support data, feature details, news |
|
|
41
|
+
| `npm_trends` | [npmtrends.com](https://npmtrends.com) | 4: package info, weekly downloads, download trends, GitHub stats |
|
|
42
|
+
| `deps_dev` | [deps.dev](https://deps.dev) | 7: versions, dependencies, dependency graph, dependents, requirements, stats |
|
|
43
|
+
| `crates_io` | [crates.io](https://crates.io) | 6: search crates, crate info, versions, version details, stats, summary |
|
|
44
|
+
| `huggingface` | [huggingface.co](https://huggingface.co) | 1: search models, datasets and Spaces |
|
|
45
|
+
| `hacker_news` | [hn.algolia.com](https://hn.algolia.com) | 1: full-text search of HN stories and comments |
|
|
46
|
+
| `archive_org` | [archive.org](https://archive.org) | 3: search the archive, item metadata, item favorites |
|
|
47
|
+
| `ossinsight` | [ossinsight.io](https://ossinsight.io) | 2: search GitHub repos, users and orgs, live GitHub event stats |
|
|
48
|
+
| `regex101` | [regex101.com](https://regex101.com) | 3: browse the community library, get a saved regex, list versions |
|
|
49
|
+
|
|
50
|
+
You need [uv](https://docs.astral.sh/uv/) for `uvx`. Or install it once with `pip install machine-internet` (or straight from GitHub: `pip install git+https://github.com/chetanty/machine_internet`) and use `machine-internet` as the command.
|
|
51
|
+
|
|
52
|
+
**Hosted, nothing to install:** every example is also live at [machine-internet.vercel.app](https://machine-internet.vercel.app) as a remote MCP endpoint, e.g. `https://machine-internet.vercel.app/mcp/bundlephobia`. Clients with remote MCP support take the URL directly; others can use `npx mcp-remote <url>`. Some sites rate-limit requests from cloud servers (npm's download stats do), so for heavy use run `serve` locally, which calls the site from your own connection.
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## Wrap your own site
|
|
57
|
+
|
|
58
|
+
Set an LLM key (any one of these works):
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
export ANTHROPIC_API_KEY=... # or OPENAI_API_KEY, or GEMINI_API_KEY
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Then point it at a page that loads data as you use it:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
uvx machine-internet wrap https://bundlephobia.com/package/react
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
```
|
|
71
|
+
Wrapping https://bundlephobia.com/package/react
|
|
72
|
+
Checking for an OpenAPI spec ...
|
|
73
|
+
Sniffing network traffic in a headless browser ...
|
|
74
|
+
[OK] Inferred 4 endpoints
|
|
75
|
+
Condensing into agent tools ...
|
|
76
|
+
[OK] 4 tools:
|
|
77
|
+
get_package_size: Use this tool to get detailed size information for a JavaScript packag
|
|
78
|
+
get_package_history: Use this tool to retrieve the historical versions of a specific JavaSc
|
|
79
|
+
...
|
|
80
|
+
|
|
81
|
+
Add this to your MCP client config (Claude Desktop, Cursor, ...):
|
|
82
|
+
{ "mcpServers": { "bundlephobia_api": { "command": "uvx", "args": ["machine-internet", "serve", "bundlephobia_api"] } } }
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
The first run downloads headless Chromium once (about 150 MB). Wrapping takes 1 to 3 minutes and costs a few cents of LLM usage. Serving afterwards needs no LLM at all.
|
|
86
|
+
|
|
87
|
+
**Tips**
|
|
88
|
+
- Pick a page that fetches data: a search results page or an item page works better than a static landing page.
|
|
89
|
+
- If the site publishes an OpenAPI spec, it is used automatically and nothing is sniffed. Point at one directly with `--spec <url>`.
|
|
90
|
+
- Large specs: keep only some areas with `--tags repos,issues`.
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
## How it works
|
|
95
|
+
|
|
96
|
+
1. **Spec check.** Probes about 20 standard locations (`/openapi.json`, `/swagger.json`, ...). If a real spec exists, it is parsed directly.
|
|
97
|
+
2. **Traffic sniffing.** Otherwise, launches headless Chromium, loads the page, scrolls and clicks through it, and records every same-site JSON request. Analytics and ad trackers are filtered out.
|
|
98
|
+
3. **Inference.** An LLM reads the captured requests and responses and infers each endpoint's path, parameters and types.
|
|
99
|
+
4. **Condensation.** An LLM collapses the endpoints into at most 15 `verb_noun` tools, with descriptions written so an agent knows when to use each one.
|
|
100
|
+
5. **Serving.** The result is a small JSON file. `machine-internet serve` exposes it as a standard MCP server (stdio by default, SSE with `--sse`) that makes real calls to the real site.
|
|
101
|
+
|
|
102
|
+
---
|
|
103
|
+
|
|
104
|
+
## Commands
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
machine-internet wrap <url> [--name NAME] [--spec URL] [--tags a,b] [--sniff] [-o FILE]
|
|
108
|
+
machine-internet serve <name-or-file.json> [--sse --port 8000]
|
|
109
|
+
machine-internet list # bundled examples and servers you have wrapped
|
|
110
|
+
machine-internet tools <name> # show a server's tools and parameters
|
|
111
|
+
machine-internet call <name> <tool> key=value ... # call a tool from the terminal
|
|
112
|
+
machine-internet config <name> # print the MCP client config block
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
Wrapped servers are saved to `~/.machine-internet/schemas/`.
|
|
116
|
+
|
|
117
|
+
**APIs that need auth:** credentials are read from the environment when the server runs: `MI_TOKEN` (bearer), `MI_API_KEY` (plus `MI_API_KEY_NAME`, `MI_API_KEY_IN=header|query`), `MI_USERNAME` / `MI_PASSWORD`, or `MI_TOKEN_URL` / `MI_CLIENT_ID` / `MI_CLIENT_SECRET` for OAuth2 client credentials. Put them in the `env` block of your MCP client config.
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
## What it works on
|
|
122
|
+
|
|
123
|
+
It works on sites whose pages load their data with API calls from the browser: most single-page apps, search pages, dashboards and developer tools. It does not work on sites that render pages on the server, or that block headless browsers.
|
|
124
|
+
|
|
125
|
+
Results from pointing `wrap` at 15 popular sites, with each generated tool then called for real:
|
|
126
|
+
|
|
127
|
+
| Result | Sites |
|
|
128
|
+
|---|---|
|
|
129
|
+
| Works | crates.io, deps.dev, Hugging Face, archive.org, HN Search (Algolia), OSS Insight |
|
|
130
|
+
| Partly works | Open Library (1 of 2 tools) |
|
|
131
|
+
| No hidden API found (server-rendered) | IMDb, Reddit, GitHub Trending, npmjs.com |
|
|
132
|
+
| Blocked or only trackers seen | Product Hunt, lichess, packagephobia |
|
|
133
|
+
| Nothing useful captured | dev.to (only a session-token call) |
|
|
134
|
+
|
|
135
|
+
So roughly half of the arbitrary sites tried. When it fails, it says why and suggests a page that is more likely to work.
|
|
136
|
+
|
|
137
|
+
## Limitations
|
|
138
|
+
|
|
139
|
+
- **Internal APIs change without notice.** A wrapped site can break when it ships a new frontend. Re-run `wrap` to refresh it.
|
|
140
|
+
- **It only sees what the page does while loading and being clicked.** Actions behind logins, multi-step forms or heavy anti-bot protection usually are not captured.
|
|
141
|
+
- **LLM output varies.** If the tools look wrong, run `wrap` again or narrow the page you point it at.
|
|
142
|
+
|
|
143
|
+
## Use responsibly
|
|
144
|
+
|
|
145
|
+
Undocumented APIs are still someone else's service. Check the site's terms before wrapping it, keep request volume reasonable, and do not use this to get around access controls or rate limits.
|
|
146
|
+
|
|
147
|
+
---
|
|
148
|
+
|
|
149
|
+
## How it compares
|
|
150
|
+
|
|
151
|
+
| | Machine Internet | OpenAPI-to-MCP converters | Browser agents |
|
|
152
|
+
|---|---|---|---|
|
|
153
|
+
| Works without an API spec | Yes | No | Yes |
|
|
154
|
+
| Agent calls the API directly (fast, cheap per call) | Yes | Yes | No, drives a browser every time |
|
|
155
|
+
| One command from URL to MCP server | Yes | Needs a spec | No |
|
|
156
|
+
|
|
157
|
+
Related work worth knowing: [Integuru](https://github.com/Integuru-AI/Integuru) generates integration code from captured traffic, and [mitmproxy2swagger](https://github.com/alufers/mitmproxy2swagger) builds OpenAPI specs from recorded traffic. Machine Internet's focus is going straight from a URL to a running MCP server.
|
|
158
|
+
|
|
159
|
+
---
|
|
160
|
+
|
|
161
|
+
## Development
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
git clone https://github.com/chetanty/machine_internet
|
|
165
|
+
cd machine_internet
|
|
166
|
+
pip install -e ".[dev]"
|
|
167
|
+
pytest
|
|
168
|
+
python evals/score.py # condensation quality evals (needs an LLM key)
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
## License
|
|
172
|
+
|
|
173
|
+
Apache 2.0
|
|
File without changes
|
|
File without changes
|