Skip to content

Implement full MCP Client API with meta support#5

Merged
0xeb merged 2 commits intomainfrom
feature/client-api
Nov 24, 2025
Merged

Implement full MCP Client API with meta support#5
0xeb merged 2 commits intomainfrom
feature/client-api

Conversation

@0xeb
Copy link
Copy Markdown
Owner

@0xeb 0xeb commented Nov 24, 2025

Summary

Add complete Client API matching Python fastmcp, resolving Issue #2 (meta parameter support).

Client Methods Added

  • list_tools() / list_tools_mcp() - enumerate available tools
  • call_tool() / call_tool_mcp() - invoke tools with meta support
  • list_resources() / list_resources_mcp() - enumerate resources
  • list_resource_templates() - get resource templates
  • read_resource() / read_resource_mcp() - read resource contents
  • list_prompts() / list_prompts_mcp() - enumerate prompts
  • get_prompt() / get_prompt_mcp() - get prompt by name
  • complete() / complete_mcp() - completion support

Features

  • Full meta parameter support for contextual data (user IDs, trace IDs)
  • Structured output validation and coercion
  • Progress handler callbacks
  • Timeout support
  • Roots notification handling

New Files

  • include/fastmcpp/client/types.hpp - Client result types
  • tests/client_api.cpp - Comprehensive test coverage
  • examples/client_api.cpp - Usage demonstration

Test Plan

  • All 29 tests pass locally (Windows, Release)
  • CI passes on all platforms (Linux, Windows, macOS)

Resolves #2

0xeb added 2 commits November 24, 2025 14:29
Add complete Client API matching Python fastmcp, including:

Client Methods:
- list_tools() / list_tools_mcp() - enumerate available tools
- call_tool() / call_tool_mcp() - invoke tools with meta support
- list_resources() / list_resources_mcp() - enumerate resources
- list_resource_templates() - get resource templates
- read_resource() / read_resource_mcp() - read resource contents
- list_prompts() / list_prompts_mcp() - enumerate prompts
- get_prompt() / get_prompt_mcp() - get prompt by name
- complete() / complete_mcp() - completion support

Features:
- Full meta parameter support for contextual data (user IDs, trace IDs)
- Structured output validation and coercion
- Progress handler callbacks
- Timeout support
- Roots notification handling
- Sampling/elicitation callback stubs

New Files:
- include/fastmcpp/client/types.hpp - Client result types
- tests/client_api.cpp - Comprehensive test coverage (11 test cases)
- examples/client_api.cpp - Usage demonstration

Resolves: #2
The mock servers return different counts than the tests expected:
- tools: 4 (was 3)
- resources: 3 (was 2)

These assertions only fail in Debug builds since Release builds
define NDEBUG which disables assert().
@0xeb 0xeb force-pushed the feature/client-api branch from 719e15f to 44c6499 Compare November 24, 2025 22:29
@0xeb 0xeb merged commit 70f6b39 into main Nov 24, 2025
8 checks passed
@0xeb 0xeb deleted the feature/client-api branch November 24, 2025 23:03
@0xeb 0xeb mentioned this pull request Nov 24, 2025
0xeb added a commit that referenced this pull request Nov 30, 2025
…ontrol (issue #5)

Implements optional request logging, rate limiting, and concurrency limiting
middleware to prevent abuse and DoS attacks on server routes.

Features:
- LoggingMiddleware: Optional audit trail for all route invocations
- RateLimitMiddleware: Sliding window rate limiting per route
- ConcurrencyLimitMiddleware: Limits parallel handler execution

All middleware are optional and can be combined. Includes comprehensive tests
covering logging, rate enforcement, window expiration, concurrency limiting,
and middleware composition.

Security audit issue: fastmcpp #5 (minimal logging/limits on server hooks)
0xeb added a commit that referenced this pull request Nov 30, 2025
This commit addresses multiple security vulnerabilities and adds
comprehensive test coverage for HTTP client API integration.

Security Fixes:
- Add payload and timeout limits to HTTP/SSE servers (issue #3)
- Fix SSE session security with crypto-random IDs and session binding (issue #2)
- Add optional authentication and restrict CORS (issue #1)
- Fix HTTP client scheme handling and disable redirects (issue #4)
- Add security middleware for logging, rate limiting, and concurrency control (issue #5)

Test Coverage:
- Add HTTP client API integration tests (not LoopbackTransport)
- Add SSE HTTP integration tests with real network stack
- Fix SSE server test to extract and use session_id

All 45 tests passing (100% pass rate)
0xeb added a commit that referenced this pull request Nov 30, 2025
This commit addresses multiple security vulnerabilities and adds
comprehensive test coverage for HTTP client API integration.

Security Fixes:
- Add payload and timeout limits to HTTP/SSE servers (issue #3)
- Fix SSE session security with crypto-random IDs and session binding (issue #2)
- Add optional authentication and restrict CORS (issue #1)
- Fix HTTP client scheme handling and disable redirects (issue #4)
- Add security middleware for logging, rate limiting, and concurrency control (issue #5)

Test Coverage:
- Add HTTP client API integration tests (not LoopbackTransport)
- Add SSE HTTP integration tests with real network stack
- Fix SSE server test to extract and use session_id

All 45 tests passing (100% pass rate)
0xeb added a commit that referenced this pull request Nov 30, 2025
This commit addresses multiple security vulnerabilities and adds
comprehensive test coverage for HTTP client API integration.

Security Fixes:
- Add payload and timeout limits to HTTP/SSE servers (issue #3)
- Fix SSE session security with crypto-random IDs and session binding (issue #2)
- Add optional authentication and restrict CORS (issue #1)
- Fix HTTP client scheme handling and disable redirects (issue #4)
- Add security middleware for logging, rate limiting, and concurrency control (issue #5)

Test Coverage:
- Add HTTP client API integration tests (not LoopbackTransport)
- Add SSE HTTP integration tests with real network stack
- Fix SSE server test to extract and use session_id

All 45 tests passing (100% pass rate)
0xeb added a commit that referenced this pull request Nov 30, 2025
This commit addresses multiple security vulnerabilities and adds
comprehensive test coverage for HTTP client API integration.

Security Fixes:
- Add payload and timeout limits to HTTP/SSE servers (issue #3)
- Fix SSE session security with crypto-random IDs and session binding (issue #2)
- Add optional authentication and restrict CORS (issue #1)
- Fix HTTP client scheme handling and disable redirects (issue #4)
- Add security middleware for logging, rate limiting, and concurrency control (issue #5)

Test Coverage:
- Add HTTP client API integration tests (not LoopbackTransport)
- Add SSE HTTP integration tests with real network stack
- Fix SSE server test to extract and use session_id

All 45 tests passing (100% pass rate)
0xeb added a commit that referenced this pull request Nov 30, 2025
This commit addresses multiple security vulnerabilities and adds
comprehensive test coverage for HTTP client API integration.

Security Fixes:
- Add payload and timeout limits to HTTP/SSE servers (issue #3)
- Fix SSE session security with crypto-random IDs and session binding (issue #2)
- Add optional authentication and restrict CORS (issue #1)
- Fix HTTP client scheme handling and disable redirects (issue #4)
- Add security middleware for logging, rate limiting, and concurrency control (issue #5)

Test Coverage:
- Add HTTP client API integration tests (not LoopbackTransport)
- Add SSE HTTP integration tests with real network stack
- Fix SSE server test to extract and use session_id

All 45 tests passing (100% pass rate)
0xeb added a commit that referenced this pull request Nov 30, 2025
This commit addresses multiple security vulnerabilities and adds
comprehensive test coverage for HTTP client API integration.

Security Fixes:
- Add payload and timeout limits to HTTP/SSE servers (issue #3)
- Fix SSE session security with crypto-random IDs and session binding (issue #2)
- Add optional authentication and restrict CORS (issue #1)
- Fix HTTP client scheme handling and disable redirects (issue #4)
- Add security middleware for logging, rate limiting, and concurrency control (issue #5)

Test Coverage:
- Add HTTP client API integration tests (not LoopbackTransport)
- Add SSE HTTP integration tests with real network stack
- Fix SSE server test to extract and use session_id

All 45 tests passing (100% pass rate)
0xeb added a commit that referenced this pull request Nov 30, 2025
This commit addresses multiple security vulnerabilities and adds
comprehensive test coverage for HTTP client API integration.

Security Fixes:
- Add payload and timeout limits to HTTP/SSE servers (issue #3)
- Fix SSE session security with crypto-random IDs and session binding (issue #2)
- Add optional authentication and restrict CORS (issue #1)
- Fix HTTP client scheme handling and disable redirects (issue #4)
- Add security middleware for logging, rate limiting, and concurrency control (issue #5)

Test Coverage:
- Add HTTP client API integration tests (not LoopbackTransport)
- Add SSE HTTP integration tests with real network stack
- Fix SSE server test to extract and use session_id

All 45 tests passing (100% pass rate)
0xeb added a commit that referenced this pull request Nov 30, 2025
This commit addresses multiple security vulnerabilities and adds
comprehensive test coverage for HTTP client API integration.

Security Fixes:
- Add payload and timeout limits to HTTP/SSE servers (issue #3)
- Fix SSE session security with crypto-random IDs and session binding (issue #2)
- Add optional authentication and restrict CORS (issue #1)
- Fix HTTP client scheme handling and disable redirects (issue #4)
- Add security middleware for logging, rate limiting, and concurrency control (issue #5)

Test Coverage:
- Add HTTP client API integration tests (not LoopbackTransport)
- Add SSE HTTP integration tests with real network stack
- Fix SSE server test to extract and use session_id

All 45 tests passing (100% pass rate)
0xeb added a commit that referenced this pull request Dec 1, 2025
This commit addresses multiple security vulnerabilities and adds
comprehensive test coverage for HTTP client API integration.

Security Fixes:
- Add payload and timeout limits to HTTP/SSE servers (issue #3)
- Fix SSE session security with crypto-random IDs and session binding (issue #2)
- Add optional authentication and restrict CORS (issue #1)
- Fix HTTP client scheme handling and disable redirects (issue #4)
- Add security middleware for logging, rate limiting, and concurrency control (issue #5)

Test Coverage:
- Add HTTP client API integration tests (not LoopbackTransport)
- Add SSE HTTP integration tests with real network stack
- Fix SSE server test to extract and use session_id

All 45 tests passing (100% pass rate)
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.

Sending Metadata

1 participant