Skip to content

feat: Add MCP Resources and Prompts support#114

Open
jlouvel wants to merge 6 commits intomainfrom
feat/mcp-resources-prompts
Open

feat: Add MCP Resources and Prompts support#114
jlouvel wants to merge 6 commits intomainfrom
feat/mcp-resources-prompts

Conversation

@jlouvel
Copy link
Contributor

@jlouvel jlouvel commented Mar 6, 2026

  • Introduce McpServerResourceSpec for dynamic and static resource definitions

    • Dynamic resources backed by HTTP operations (call/steps)
    • Static resources served from file:// locations
    • Support for templated URIs with {param} placeholders
    • Output mapping and MIME type configuration
  • Introduce McpServerPromptSpec for reusable prompt templates

    • Inline prompts with multi-turn message templates
    • File-based prompts loaded from file:/// URIs
    • Typed arguments with {{arg}} placeholder substitution
    • Injection-safe argument handling (no re-interpolation)
  • Add McpResourceHandler for resources/list and resources/read

    • Template matching and parameter extraction
    • Path traversal prevention for static resources
    • Dynamic resource execution via OperationStepExecutor
    • Content type probing and safe file serving
  • Add McpPromptHandler for prompts/list and prompts/get

    • Argument substitution for both inline and file-based prompts
    • Multi-turn conversation templates
    • Escape handling for regex special characters
  • Refactor OperationStepExecutor for handler reusability

    • Extract execute() for unified call/steps orchestration
    • Extract applyOutputMappings() for output parameter mapping
    • Used by tools, resources, and other adapters
  • Update McpServerAdapter

    • Initialize resource and prompt handlers
    • Build tool labels map for MCP title field
    • Wire handlers for protocol dispatch
  • Extend capability JSON schema (v0.5)

    • McpResource definition with call/steps/location variants
    • McpPrompt with inline/file-based variants
    • McpPromptArgument with required flag
    • McpPromptMessage for multi-turn templates
    • Tool label field mapped to MCP title
  • Add comprehensive integration tests

    • YAML deserialization for resources and prompts
    • Handler creation and wiring
    • Protocol dispatch: resources/list, resources/templates/list, resources/read
    • Protocol dispatch: prompts/list, prompts/get
    • Template matching, substitution, and injection prevention
  • Document in Naftiko Specification v0.5

    • Complete §3.5.4-3.5.6 for MCP expose with resources/prompts
    • Complete §3.20+ for expression syntax in external references
    • Full examples with resources and prompts support
    • MCP capability example (§4.6)

Breaking changes: None
Backward compatible: Yes (resources/prompts are optional)

jlouvel added 6 commits March 6, 2026 14:33
…ep outputs

- align consumed output parameter parsing with spec by accepting `value` as alias of `mapping`
- serialize named output parameters as `value` (spec-compliant), keep `mapping` for mapped exposed outputs
- update step orchestration to expose consumed operation outputParameters (projected values) to subsequent steps
- store client operation in step handling context to support output projection
- add tests for `value` deserialization and serialization behavior
- keep tutorial multisteps flow using `{{fetch-me-user.userid}}` working end-to-end
Introduce McpServerResourceSpec and McpServerPromptSpec to extend MCP server capabilities with data resources and reusable prompt templates. Add corresponding handlers, refactor OperationStepExecutor for reusability, update schema to v0.5, and include comprehensive tests and specification documentation.
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.

1 participant