Skip to content

Conversation

@galligan
Copy link
Contributor

@galligan galligan commented Jan 23, 2026

Add core type definitions for MCP server implementation:

  • ServerOptions: Configuration for server creation
  • Handler<I,O,E>: Generic handler function type
  • ToolDefinition/ResourceDefinition: MCP entity schemas
  • ServerContext: Request context with logger
  • McpError: TaggedError subclass for MCP failures

Co-Authored-By: Claude Opus 4.5 noreply@anthropic.com

Contributes to #46

Copy link
Contributor Author

galligan commented Jan 23, 2026

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: df2f41f74a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@greptile-apps
Copy link

greptile-apps bot commented Jan 23, 2026

Greptile Summary

  • Adds foundational type definitions and interfaces for the MCP (Model Context Protocol) server framework as part of implementing dual-transport architecture (CLI + MCP)
  • Creates new packages/mcp package with comprehensive type system including ToolDefinition, ResourceDefinition, McpError, and McpServer interfaces
  • Integrates with existing contracts package using Handler<I,O,E> pattern and extends TaggedError system with JSON-RPC error codes for MCP failures

Important Files Changed

Filename Overview
packages/mcp/src/types.ts New file establishing core type definitions for MCP server including tool/resource definitions, error handling, and server interface contracts
packages/mcp/package.json New package configuration with modular exports structure and dependencies on MCP SDK and internal packages

Confidence score: 4/5

  • This PR is safe to merge with minimal risk as it only adds type definitions without runtime implementation
  • Score reflects well-structured types that properly integrate with existing contracts, but includes complex generic signatures that warrant code review
  • Pay close attention to packages/mcp/src/types.ts for the handler integration patterns and error taxonomy alignment

Sequence Diagram

sequenceDiagram
    participant User
    participant Client as "MCP Client"
    participant Server as "McpServer"
    participant Tool as "ToolDefinition"
    participant Handler as "Tool Handler"

    User->>Client: "Request tool execution"
    Client->>Server: "invokeTool(name, input)"
    Server->>Server: "Validate input against schema"
    Server->>Tool: "Find registered tool"
    Server->>Handler: "handler(validatedInput, context)"
    Handler->>Handler: "Process business logic"
    Handler-->>Server: "Return Result<output, error>"
    Server-->>Client: "Return tool execution result"
    Client-->>User: "Present result"
Loading

@galligan
Copy link
Contributor Author

Addressed review feedback: added McpError coverage to ensure the package has tests and kept the entrypoint export in place. Submitted the update with gt.

galligan and others added 3 commits January 23, 2026 18:06
Add core type definitions for MCP server implementation:
- ServerOptions: Configuration for server creation
- Handler<I,O,E>: Generic handler function type
- ToolDefinition/ResourceDefinition: MCP entity schemas
- ServerContext: Request context with logger
- McpError: TaggedError subclass for MCP failures

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@galligan galligan force-pushed the p3-14/ui/shapes-render branch from 0246fb8 to f86a139 Compare January 23, 2026 23:09
@galligan galligan force-pushed the p3-15/mcp/types-interfaces branch from ac4a0b1 to d91d9f1 Compare January 23, 2026 23:09
@galligan
Copy link
Contributor Author

Restacked after downstack update (formatRelative test stabilization); no additional changes in this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants