Skip to main content

Local, faithful-enough reimplementation of AWS Bedrock AgentCore Gateway, with a pluggable local Lambda backend.

Project description

localcore-gateway

PyPI CI License: Apache-2.0 Python ≥3.11

A local, faithful-enough reimplementation of AWS Bedrock AgentCore Gateway, with a pluggable local Lambda backend. Develop and test agent ↔ gateway ↔ Lambda integrations entirely on your machine, then point the same MCP client at the real AWS gateway with no code changes.

There is no official local emulator for AgentCore Gateway (AWS's agentcore dev is for the Runtime, not the Gateway). This fills that gap.

0.x — unstable. The CLI flags and config schema may change between minor releases until 1.0. Pin a version if you depend on it.

What it reproduces

  • MCP Streamable-HTTP at /mcp — the same wire surface as the real gateway (built on the FastMCP 3.x server; no hand-rolled JSON-RPC).
  • Target aggregation — every (target, tool) is exposed as one MCP tool named target___tool (AgentCore's triple-underscore convention).
  • AgentCore Lambda contract — the tool arguments are passed as the Lambda event; the tool identity is delivered via context.client_context.custom['bedrockAgentCoreToolName']; the Lambda's return value becomes the tool result.
  • OpenAPI targets — a REST API's spec becomes MCP tools; the tool name is the operation's operationId verbatim (as the real gateway does, not a slugified form), spec-level security is ignored (auth configured out of band).

Local Lambda backends

backend Docker fidelity use it for
native no one subprocess per target (real process isolation — monorepo-safe), faithful event/context, error envelope, CloudWatch-style logs, hot reload, hard timeout the fast dev loop
sam yes the real AWS Lambda Linux runtime via sam local start-lambda full Linux-runtime fidelity check before AWS

Documentation

Install

uv tool install localcore-gateway      # or: pipx install localcore-gateway
uvx --from localcore-gateway lcgw --help   # one-off, no install

Quick start

A handler and a config (nothing else needed):

# handlers.py
def handler(event, context):
    return {"sum": event["a"] + event["b"]}
# gateway.yaml
targets:
  - type: lambda
    name: demo
    lambda: { backend: native, handler: handlers.handler }
    tools:
      - name: add
        inputSchema:
          type: object
          properties: { a: { type: number }, b: { type: number } }
          required: [a, b]
lcgw tools  -c gateway.yaml
lcgw invoke -c gateway.yaml demo___add --data '{"a":2,"b":40}'
lcgw serve  -c gateway.yaml            # MCP at http://127.0.0.1:8080/mcp
lcgw dev    -c gateway.yaml            # same, with hot reload

Point any MCP client at http://127.0.0.1:8080/mcp. Richer examples (multi target, math_handlers.py, Strands agent) are in examples/.

From source (development)

git clone https://github.com/tawAsh1/localcore-gateway && cd localcore-gateway
uv sync
uv run pytest
uv run lcgw serve -c examples/config.yaml

Using the sam backend

Run sam local start-lambda in your SAM project, then set in the target:

lambda:
  backend: sam
  sam_endpoint: http://127.0.0.1:3001
  sam_function: DemoFunction

Configuration

See examples/config.yaml. A target declares a Lambda (backend, handler/sam_function, memory_mb, timeout_sec, env) and the tools it backs (each with an explicit JSON Schema). One Lambda can back many tools; the handler branches on bedrockAgentCoreToolName.

Known limitations

  • native runs your handler in a subprocess but is not a security sandbox (no filesystem/network jail) — only point it at trusted code.
  • native serializes invokes per target (one warm execution environment); it does not model Lambda's concurrent-environment scaling.
  • sam per-invoke logs appear in the sam local console (out-of-band for the Invoke API).
  • AgentCore's builtin semantic tool search (x_amz_bedrock_agentcore_search) is not implemented (intentionally omitted).
  • Target types: Lambda and OpenAPI are implemented; MCP-passthrough and Smithy are not yet. OpenAPI outbound auth covers static API key (header/query) and bearer; OAuth 2LO is out of scope.

License

Apache License 2.0. See NOTICE for attribution and the trademark disclaimer below.

Trademarks & disclaimer

This is an unofficial, community project. It is not affiliated with, endorsed by, or sponsored by Amazon Web Services, Inc. or its affiliates.

"AWS", "Amazon Web Services", "Amazon Bedrock", "Amazon Bedrock AgentCore", and "AWS Lambda" are trademarks of Amazon.com, Inc. or its affiliates. They are used here only nominatively, to accurately describe the AWS service this project interoperates with / reimplements locally. No AWS trademark, logo, or trade dress is used as the name or branding of this project.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

localcore_gateway-0.2.1.tar.gz (119.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

localcore_gateway-0.2.1-py3-none-any.whl (31.8 kB view details)

Uploaded Python 3

File details

Details for the file localcore_gateway-0.2.1.tar.gz.

File metadata

  • Download URL: localcore_gateway-0.2.1.tar.gz
  • Upload date:
  • Size: 119.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for localcore_gateway-0.2.1.tar.gz
Algorithm Hash digest
SHA256 6954ad6ae975d4d548b09f77a36e57381beb50959abc917e899d7d9bdc3e233e
MD5 3387c8925f9f471d6ffa8e698dfefa42
BLAKE2b-256 b6b24942a60d8daa12462aa0adf8b9bee70d53202970e2e4e36a1effacdef9ae

See more details on using hashes here.

Provenance

The following attestation bundles were made for localcore_gateway-0.2.1.tar.gz:

Publisher: release.yml on tawAsh1/localcore-gateway

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file localcore_gateway-0.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for localcore_gateway-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a7fb29d74ed0617647c90ee8b35b3a094a788678f89a6b363706c87b36ff7dce
MD5 39273ca0d6e5ace6387b35901ae0cfda
BLAKE2b-256 57bcd4dff1b86062cf9259d1a7ce5811ed52596bc53f4f63a8f5613fbbb15b77

See more details on using hashes here.

Provenance

The following attestation bundles were made for localcore_gateway-0.2.1-py3-none-any.whl:

Publisher: release.yml on tawAsh1/localcore-gateway

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page