Skip to content

Fix MCP tool discovery error and docker-compose port mapping#94

Closed
BobDenar1212 wants to merge 1 commit intowshobson:mainfrom
BobDenar1212:fix/mcp-discovery-and-docker-port
Closed

Fix MCP tool discovery error and docker-compose port mapping#94
BobDenar1212 wants to merge 1 commit intowshobson:mainfrom
BobDenar1212:fix/mcp-discovery-and-docker-port

Conversation

@BobDenar1212
Copy link
Contributor

@BobDenar1212 BobDenar1212 commented Jan 15, 2026

Title: Fix MCP tool discovery error and correct Docker port mapping

Description:
This PR addresses two critical issues preventing the Maverick MCP server from starting and functioning correctly.

  1. Fix MCP Tool Discovery Error:

    • Issue: The server failed to start with MCP error 0: the first argument must be callable. This was caused by incorrectly adding the
      EnhancedRateLimitMiddleware object directly to the MCP protocol layer using mcp.add_middleware(), which expects a callable.
    • Fix: Updated maverick_mcp/api/server.py to attach the middleware to the underlying FastAPI application (mcp.fastapi_app) instead of the MCP
      protocol instance.
  2. Fix Docker Compose Port Mapping:

    • Issue: The docker-compose.yml incorrectly mapped port 8003:8003. The Dockerfile exposes port 8000 (FastAPI default), causing connection
      refusals when trying to access the server on the host port.
    • Fix: Corrected the mapping to "8003:8000" (Host:Container).

Changes Proposed:

  • maverick_mcp/api/server.py: Changed middleware registration target.
  • docker-compose.yml: Corrected port mapping typo.

How Has This Been Tested?

  • Verification: A reproduction script (debug_server_inspection.py) was created to simulate the Gemini client's discovery calls (_list_tools,
    etc.).
  • Result: The script successfully listed all 57 tools, 9 prompts, and 7 resources after the fix, whereas it previously failed with the reported
    TypeError.
  • Deployment: Confirmed docker-compose.yml port mapping aligns with Dockerfile configuration (EXPOSE 8000).

Related Issue:
Fixes startup error MCP error 0: the first argument must be callable.

Type of Change:

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

Checklist:

  • My code follows the style guidelines of this project.
  • I have performed a self-review of my own code.
  • I have verified the fix with a reproduction script.
  • Docker configuration matches application settings.

@mondipsen
Copy link

I had the same issue. Fixed it by reverting back to the following:

git clone https://github.com/wshobson/maverick-mcp
cd maverick-mcp
git checkout 03eb239
make dev

@yharaskrik
Copy link

I had the same issue. Fixed it by reverting back to the following:

git clone https://github.com/wshobson/maverick-mcp
cd maverick-mcp
git checkout 03eb239
make dev

This also worked for me. I'll run off this commit for now until this PR gets merged

@ne0ark
Copy link

ne0ark commented Mar 4, 2026

Hello,

When can this be merged? Without this patch, MCP is currently unusable.

Thanks!

@shinobijs
Copy link

@wshobson can this be merged to resolve the blocking issue? Maverick is not working as-is.

@wshobson
Copy link
Owner

Thanks for this PR, @BobDenar1212 — and apologies for the delayed response!

The server.py middleware fix was already applied on main separately, so I've incorporated just the docker-compose port mapping fix (plus a correction to the API_PORT env var to match) into #111, which supersedes this PR.

Appreciate you catching these issues!

@wshobson wshobson closed this Mar 11, 2026
@shinobijs
Copy link

@wshobson thanks!

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.

6 participants