🎃 Import a HAR file (browser network capture) as REST tools
メンテナーはふだん 1 日以内に返信
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 42/100
- issue の種類
- 機能追加
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- typescript
- 領域
- backend, documentation, frontend
調査の方向性
Start with parsers/curl.parser.ts for the query, body and header mapping and parsers/tool-name.util.ts for capToolName, then read importTools in connectors.controller.ts and register the new HarParser in connectors.module.ts. Build a new parsers/har.parser.ts with a scrubbed HAR fixture and a spec under parsers/fixtures/. Done when the parser spec covers origin filtering, id-path grouping and credential stripping, and npx jest src/connectors/parsers passes.
索引モデルが issue の本文から書いたものです。
説明
Part of the October Challenge #997.
Why
Many internal tools and SaaS products have an API but no OpenAPI spec or Postman collection: the only description of it is what their own web app sends. A HAR file (browser DevTools → Network → "Save all as HAR") records exactly those requests. Importing it turns "click through the app once" into a set of REST tools. Today people do this by hand, one cURL command at a time ("Copy as cURL" in DevTools, then source: 'curl'). Insomnia and other API clients import HAR files for the same reason.
What already exists: POST /api/connectors/:id/import with the sources openapi, wsdl, graphql, postman, curl, json, mcp and odata (connectors.controller.ts:335-376, :1613-1794). curl and json imports are additive: they add or update the given tools and retire nothing (:1776-1781). The cURL parser (parsers/curl.parser.ts) already maps query parameters, JSON bodies and headers to tool parameters and an endpointMapping; follow its approach.
Self-hosted vs Cloud
- Self-hosted: enabled in Community and Business. No
ee/code. Parsing makes no outbound request: the HAR is uploaded as content and never fetched from a URL (nourloption, so no SSRF surface). - Cloud (
DEPLOYMENT_MODE=cloud): enabled. A HAR file is sensitive: it contains the user's session cookies, bearer tokens and full response bodies with personal data. These rules apply to both deployments: the browser removes response bodies, cookies and credential headers before upload (which also keeps the request under the 10 MB body limit,main.ts:53); the backend works in memory, never stores or logs the HAR, and never keeps a credential value in a tool, neither as a header mapping nor as a parameter default. - Who can use it: the same roles as the other import sources: the connector's owner or an org
ADMIN, neverVIEWER(assertCanWrite,connectors.controller.ts:595-603).
What to build
- Parser
packages/backend/src/connectors/parsers/har.parser.ts(HarParser, added toPARSERSinconnectors.module.ts:35) withparse(har: string, opts: { baseUrl: string }): ParsedTool[]:- Accept HAR 1.2 (
log.entries[].request); anything else gets a clear error. - Keep only entries with the same origin as the connector's
baseUrlwhose path starts with the base URL's path, and strip that prefix soendpointMapping.pathis relative, as with other imports. SkipOPTIONSandHEAD, static assets (by file extension and by_resourceTypewhen present: script, stylesheet, image, font, media) and WebSocket entries. - Group by method and path template: segments that look like ids (numbers, UUIDs, long hex strings) become path parameters, so
/orders/123and/orders/456produce one tool with an{id}parameter. - Query string → optional parameters with the observed value as default. JSON body (
postData.mimeTypeapplication/json) → body mapping like the cURL parser.application/x-www-form-urlencoded→ fields frompostData.params. - Drop credentials:
Cookie,Authorization,Proxy-Authorization, HTTP/2 pseudo-headers (:authority…), and any header, query parameter or body field whose name matches/(token|secret|password|passwd|api[-_]?key|session|csrf|xsrf|auth|signature|sig)/i. A dropped body field stays a parameter, without a default. Also drop browser noise (User-Agent,Accept-*,Sec-*,Origin,Referer,Content-Length). The connector's own auth settings supply credentials at call time. - Tool names follow the cURL parser's scheme (
<method>_<path>), capped withcapToolName()(parsers/tool-name.util.ts) and made unique. Description:<METHOD> <path> (from HAR). - Never read
response.content.
- Accept HAR 1.2 (
- Controller: add
'har'toImportToolsDto.sourceand to the switch, requirecontent, passconnector.baseUrl, and treat it as additive likecurl/json(:1781). Return how many entries were skipped and why (other origin, static asset, duplicate). - UI: add "HAR file (browser capture)" to
IMPORT_SOURCES(connectors/[id]/page.tsx:23-32) with a file picker (.har,.json) instead of the URL and text fields. Before sending, the browser parses the file and removesresponse.content,request.cookies,response.cookiesand the credential headers listed above, then sends the slimmed JSON ascontent. One line in the panel says that HAR files contain session data and that the import removes it. - Docs: a "From a HAR file" section in
docs/connectors/rest.mdafter "From cURL Commands" (:111), and an example in the Import Tools block ofdocs/api-reference.md:111-149.
Where to look
packages/backend/src/connectors/connectors.controller.ts:335-376(ImportToolsDto),:1613-1794(importTools),:2009(createToolsFromParsed, which matches existing tools by operationId, then method and path, then name).packages/backend/src/connectors/parsers/curl.parser.ts: header, query and body mapping,generateToolName.packages/backend/src/connectors/parsers/openapi.parser.ts:12-35: theParsedToolshape.packages/backend/src/connectors/parsers/tool-name.util.ts:capToolName().packages/backend/src/connectors/connectors.module.ts:35: parser registration.packages/frontend/src/app/connectors/[id]/page.tsx:23-32(IMPORT_SOURCES),:466-500(handleImportTools),:1578-1660(import panel).
Acceptance criteria
-
har.parser.spec.tswith a small HAR fixture exported from a browser and scrubbed by hand (inparsers/__fixtures__/): other origins and static assets are skipped;/orders/123and/orders/456become one tool with an{id}parameter; query and JSON body parameters are mapped; a base URL with a path prefix works. - Credential spec: a HAR with
Cookie,Authorization,X-API-Key,?access_token=and apasswordbody field yields tools in which none of those values appear (assert onJSON.stringify(tools)). - An invalid file returns
{ error }like the other sources; importing the same HAR twice updates the tools instead of duplicating them. -
cd packages/backend && npx jest src/connectors/parserspasses. - Manual check: capture a HAR from a web app you use, import it into a local instance and call one generated tool (describe it in the PR, without attaching the HAR).
- Docs updated.
Out of scope
- Building
outputSchemaor response mappings from recorded responses. - Detecting the auth scheme and configuring the connector's auth automatically.
- Creating a new connector from a HAR in one step.
- Splitting GraphQL requests in a HAR into separate tools.
Size
M (1–2 days)
How to claim
Comment "I'd like to work on this" and we'll assign you. Rules in #997.
- 主要言語
- TypeScript
- スター
- 856
- フォーク
- 82
- 平均マージ
- 6時間 15分
- マージ済み PR(30日)
- 141
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
HelpCode-ai/anythingmcp のほかの issue
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
HelpCode-ai/anythingmcp#1049 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
good first issue hacktoberfest
難易度 2/5 半日 初心者へのやさしさ 70/100
HelpCode-ai/anythingmcp#996 ·
メンテナーはふだん 1 日以内に返信
-
good first issue hacktoberfest
難易度 2/5 半日 初心者へのやさしさ 72/100
HelpCode-ai/anythingmcp#995 ·
メンテナーはふだん 1 日以内に返信
-
enhancement good first issue hacktoberfest help wanted
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
HelpCode-ai/anythingmcp#982 ·
メンテナーはふだん 1 日以内に返信
-
good first issue hacktoberfest
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
HelpCode-ai/anythingmcp#745 ·
メンテナーはふだん 1 日以内に返信
HelpCode-ai/anythingmcp の issue をすべて見る
似ている issue
-
A hung CI job runs for 6 hours before it is cancelled対応中かも @Olanetsoft が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
Olanetsoft/agent-lookout#110 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
thedotmack/claude-mem#4757 ·
メンテナーはふだん 1 日以内に返信
-
🐛 bug 🗺️ MCP OAuth
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
LibreChat-AI/LibreChat#17077 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 75/100