Skip to content

Add mk_mcp_from_refs(['module:function', ...]) + public import_object#2

Merged
thorwhalen merged 1 commit into
mainfrom
feat/mk-mcp-from-refs
Jun 4, 2026
Merged

Add mk_mcp_from_refs(['module:function', ...]) + public import_object#2
thorwhalen merged 1 commit into
mainfrom
feat/mk-mcp-from-refs

Conversation

@thorwhalen

Copy link
Copy Markdown
Member

One call from configuration strings to a runnable MCP server — what tools that read tool references from a file (e.g. coact's mcp realize backend) need, so they don't reimplement the importlib dance.

  • util.import_object(ref) — resolve 'module:attr' (preferred) or 'module.path.attr'.
  • main.mk_mcp_from_refs(refs, *, name=..., input_trans=...) — resolve each ref via import_object and delegate to mk_mcp_server.

Additive; existing API unchanged. New unit tests + doctests green (20 passed).

Closes #1.

One call from configuration strings to a runnable MCP server — what tools that
read tool references from a file (e.g. coact's mcp realize backend) need, so they
don't reimplement the importlib dance.

- util.import_object(ref): resolve 'module:attr' (preferred) or 'module.path.attr'
- main.mk_mcp_from_refs(refs, ...): resolve each ref and delegate to mk_mcp_server

Additive; existing API unchanged. Tests + doctests green.

Closes #1
@thorwhalen thorwhalen merged commit aafd097 into main Jun 4, 2026
1 check passed
@thorwhalen thorwhalen deleted the feat/mk-mcp-from-refs branch June 4, 2026 14:21
thorwhalen added a commit to thorwhalen/coact that referenced this pull request Jun 4, 2026
- llm.py: provider-agnostic facade. resolve_llm() accepts a callable, an aw
  StepConfig (reuses its resolve_llm), a model name, or None->ambient
  skill.ai.chat; returns None (never raises) when nothing is available.
  structured(prompt, schema) does instruct-JSON + parse + one retry.
- synthesis.py: synthesize_persona gains an optional llm that DRAFTS the identity
  paragraph; invariants + the return contract stay deterministic so the
  machine-facing contract is never at the mercy of generation. Drafting fires
  ONLY when an llm is explicitly injected — the mechanical path stays offline
  even when an ambient API key is present (DECISIONS D10).
- complete(): optional llm= threaded through (non-breaking); LLM failure falls
  back to template.
- realize.py: 'mcp' backend reads the source skill's coact: mcp block and
  delegates to py2mcp.mk_mcp_from_refs (coact writes no MCP plumbing).

Companion py2mcp PR i2mint/py2mcp#2 added mk_mcp_from_refs + import_object.

55 tests + 28 doctests + ruff green; mechanical path verified offline.

Refs #9 #10 #13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add mk_mcp_from_refs(['module:function', ...]) + public import_object

1 participant