DevWeave logoDevWeave
CommunitiesDiscoverHelp ForumFeaturesWhy DevWeaveAI & Verification
Log inGet started
Back to Issue Discovery
OWASP/legacy2mcp #176openPythonCybersecurity

Support a configured Accept header in the REST adapter

Opened by @Mahnoor-Zaffar · Assignees: None

View on GitHub
enhancementgood first issue

Solve & Merge Reward: Up to +210 XP & +60 Coins

+30 XP on PR open · +180 XP & +60 coins on merge

17 GitHub Stars

Claim Status & GitHub Signal

Unassigned, with 2 comments. Unassigned does not guarantee unclaimed—read comments and linked PRs first.

AI Issue Assessment · Grounded Analyzer
2.8 / 10 · 3–4 · Beginner

Estimated from issue labels (enhancement, good first issue), Python context, and discussion depth. There are 2 GitHub comments to review for maintainer clarifications. Note: this is an estimate, not a guarantee.

What It's About

Support a configured Accept header in the REST adapter. Problem The REST adapter currently sends authentication headers but has no way to declare an Accept media type. FHIR servers commonly use application/fhir+json, so the guide in PR 173 has to expose a required _format=json query argument on every endpoint to fo

Why It Matters

Resolving #176 improves reliability and developer experience in OWASP/legacy2mcp.

Expected Outcome

A focused pull request addressing #176 with relevant checks or tests verified locally.

Skill Match Breakdown

Log in to compare this issue's requirements against your profile skills. Required concepts: Python, HTTP & REST APIs, SQL & Databases, Git & Collaboration, AppSec & Validation, Machine Learning.

Progressive AI Hints

Hint #1 is always free and calibrated to your experience level. Extra hints unlock with coins without spoiling the full solution.

Log in to receive your free level-adapted Hint #1 grounded in this repository's files.

Skill-Gap Learning

Gap-Targeted
Learn Git

Branching, commits, rebasing, and collaborative Git workflows.

Addresses skill gap: Git & Collaboration

Learn SQL

Relational modeling, joins, constraints, and query optimization.

Addresses skill gap: SQL & Databases

Learn Code in Python

Core Python syntax, functions, control flow, and debugging basics.

Addresses skill gap: Python

Hands-On CodeCrafters Practice
Skill-Gap Challenge
Build your own Kafka
Python

Implement binary wire protocols, correlation IDs, and concurrent broker requests.

Practice skill gap: Python

Build your own Shell
Python

Parse commands, manage PATH lookups, pipes, and process execution.

Practice skill gap: Python

Issue Description

Problem

The REST adapter currently sends authentication headers but has no way to declare an Accept media type. FHIR servers commonly use application/fhir+json, so the guide in PR #173 has to expose a required _format=json query argument on every endpoint to force JSON.

This is awkward for callers, duplicates transport configuration in tool schemas, and can expose an implementation detail that should be fixed by the adapter configuration.

Proposed change

Add a reviewed way for a REST adapter, or an individual endpoint, to send a configured Accept header. For example:

config:
  base_url: https://fhir.example.com/r4
  accept: application/fhir+json

The final configuration shape can follow existing REST settings conventions. It should not provide a way for tool callers to choose or override headers at runtime.

Acceptance criteria

  • A configured media type is sent as the Accept header on REST requests.
  • Bearer and basic authentication continue to work unchanged.
  • Tool arguments cannot add, replace, or remove request headers.
  • Invalid or empty configured media types fail config validation.
  • Existing configurations without the setting keep their current behavior.
  • Offline tests assert the received header against the in process mock REST service.
  • The FHIR guide can remove the required _format=json workaround after the feature ships.

Security notes

Header values come from reviewed configuration, not MCP tool arguments. Secrets must continue to use the existing environment variable based authentication settings and must not be copied into a generic headers mapping.

Context

Found while testing HAPI FHIR R4 for #141. The current workaround and PHI considerations are documented in PR #173. FHIR CapabilityStatement discovery is tracked separately in #174.

Linked Pull Requests (0)

No linked or cross-referenced pull requests detected via GitHub timeline. Check comments below for informal claims before starting.

GitHub Comments (2)

@bvenkataCOLLABORATOR
View comment →

Thanks @Mahnoor-Zaffar. A single reviewed accept: setting (not a general headers map) is the right shape, and your security notes are exactly the ones that matter. Implementation notes:

  • Add accept: str | None = None to RestAdapterSettings in config.py, and merge it into RestAdapter._headers(), which today only adds Authorization.
  • Validate it as a media type, such as ^[\w.+-]+/[\w.+-]+(\s*;\s*[\w.+-]+=[\w.+-]+)*$. That rejects empty values and, importantly, CR/LF, so a config value can't inject a second header.
  • A per-endpoint override can wait until someone needs it. Adapter-level covers FHIR.
  • tests/mock_rest_service.py can echo the received Accept header for the assertion.

Labelling this good first issue too.

@austinchennn
View comment →

I'd like to take this adapter-level accept setting, following @bvenkata's scope above. I will keep it out of tool arguments, validate a single media type without CR/LF, and test received headers on the local REST fixture with no-auth, bearer and basic auth controls, plus unchanged defaults and rejected runtime header overrides. I'll update the REST configuration docs and FHIR guide in the same PR. No per-endpoint override or generic headers map. Working with Codex assistance; no live FHIR/patient-data calls are planned.

Implemented in https://github.com/OWASP/legacy2mcp/pull/181. Actual local validation: 32 REST tests; full630passed3optional-skips; rootRuff/diff and3FHIRYAMLconfigs validate. Open for review, not yet merged; no live HAPI/patient-data/model calls. See the PR for the exact limits and checks.

Peer Help Forum · OWASP/legacy2mcp #176

Issue Troubleshooting Threads (0)

Ask Peers for Help

No troubleshooting threads opened for this issue yet. If you hit a test, build, or navigation blocker, post what you've tried so fellow contributors can help.

PR Verification & Rewards

Sign in and link GitHub to verify your PR against this issue and earn XP + coins.

Sign In

Contribution Workflow

Track your local progress before opening a pull request on GitHub.

Repository Context

Top Repository Paths

[dir] .claude
[dir] .claude/commands
.claude/commands/legacy2mcp.md
[dir] .cursor
.cursor/mcp.json
[dir] .cursor/rules
.cursor/rules/legacy2mcp.mdc
[dir] .github
[dir] .github/ISSUE_TEMPLATE
.github/ISSUE_TEMPLATE/config.yml
.github/ISSUE_TEMPLATE/new-analyzer.yml
.github/ISSUE_TEMPLATE/new-legacy-technology.yml
.github/copilot-instructions.md
.github/dependabot.yml
[dir] .github/workflows
.github/workflows/ci.yml
.github/workflows/mcp-compatibility.yml
.github/workflows/release.yml
.gitignore
.mcp.json
[dir] .vscode
.vscode/mcp.json
AGENTS.md
AUTHORS

CONTRIBUTING.md Excerpt

Contributing

New here? Start with an issue labeled good first issue -- small, self-contained, scoped to one file or one function. Looking for something bigger? help wanted issues are real gaps that need more design/discussion, not busywork. Either way, comment on the issue before starting so two people don't duplicate work, and feel free to ask questions on it -- that's what it's there for.

What's next (short version)

The authoritative, up-to-date list is always the open good first issue/ help wanted issues, not this file -- but in short, the biggest gaps today are:

  • More queue brokers (type: queue) -- the adapter publishes to and peeks at RabbitMQ queues; Kafka, SQS and consuming for real are still future work.
  • Stored-procedure calling -- discover --stored-procs already reads a live procedure/function catalog, and the db adapter can call a Postgres one listed under procedures:; SQL Server and Oracle calling, and converting a --stored-procs contract in init --from-contract, are still future work.
  • A direct init --db-dialect ... --db-dsn-env ... entry point -- today a db config only comes from a repo scan (ORM detection) or a hand-written config; there's no live "point at a database and get a starter config" path the way --wsdl-url/--rest-url/--webpage-url already have.
  • HTTP/SSE transport -- stdio only today.
  • More analyze coverage -- new frameworks (Koa, Hapi, NestJS, Starlette, Litestar), new side-effect rules (more payment, email and queue SDKs), and the first analyzer for another language. These are the best first contributions: docs/good-first-issues.md has a list of small, well-scoped ones with exact file pointers.

Full version-by-version history: docs/roadmap.md.

Development setup

git clone https://github.com/OWASP/legacy2mcp.git
cd legacy2mcp
pip install -e ".[dev]"
pytest tests/ -v

[dev] pulls in pytest, pytest-asyncio, flask, lxml, pathspec, the tree-sitter grammars and the anthropic SDK -- enough to run the full suite with

... (truncated)

Advisory PR Assistant

Helps structure your PR description or unpack reviewer feedback. Does not perform GitHub actions.