MCPServer: public hooks for tool input schemas, capabilities and handler removal
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 43/100
Direzione di ricerca
Start with MCPServer in mcp.server.mcpserver and Server in mcp.server.lowlevel, then inspect ServerSession and the existing middleware hook. Check the guard tests mentioned in the issue and run the relevant tests before trying a branch. Done means the four requested hooks or public APIs are available and tested, including stable connection identity.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Description
We build an MCP server framework on mcp 2.x's MCPServer (mcp.server.mcpserver). It owns its own tool registry, so it overrides list_tools and call_tool, and it needs four more things the SDK only offers through private attributes. Each one ties us to a single 2.x minor, because a rename in a minor release silently changes what our users' clients see.
-
Tool input schemas for
Mcp-Paramheader validation. The low-levelServertakesget_tool_input_schema, butMCPServeralways passes its own_tool_input_schema, which reads_tool_manager. A subclass that answerstools/listandtools/callitself has to override the private_tool_input_schema(or fill_tool_manager._toolswith hand-builtToolobjects). Ask: acceptget_tool_input_schema=in theMCPServerconstructor, or make the method a documented, overridable public one. -
Adjusting advertised capabilities. We must report
capabilities.tools.listChanged: false(we never sendnotifications/tools/list_changed) and declare an extension only to some callers. Today that means reachingMCPServer._lowlevel_serverand replacingget_capabilitieson the instance. Ask: a public way to post-processServerCapabilitiesper request (a constructor callback such ascapabilities=lambda ctx, caps: caps), and a public accessor for the low-level server (MCPServer.lowlevel). -
Removing a default handler.
MCPServerregistersprompts/list,prompts/getand the resource handlers by default, and capabilities are derived from which handlers exist.Serverhasadd_request_handlerandget_request_handlerbut noremove_request_handler, so we pop from the private_request_handlers. Ask:Server.remove_request_handler(method), or constructor flags to leave prompts and resources out. -
A stable identity for a 2025-era connection. 2.x builds a
ServerSessionper request; the only stable identity of a client connection is the privateServerSession._connection. We key per-connection state (an "active context" a client enters and leaves) on it. Ask: a public, hashable connection identity on the request context (for examplectx.connection_id), documented as stable for the life of a 2025-era connection.
MCPServer.middleware (documented as provisional) already covers the one other hook we needed. We have guard tests for each of the above and can test a branch.
References
- Observed on
mcp2.3.0 and 2.4.0 (mcp.server.mcpserver.MCPServer,mcp.server.lowlevel.Server,ServerSession).
- Lingua principale
- Python
- Stelle
- 25k
- Fork
- 4.2k
- Merge medio
- 10m
- PR unite (30g)
- 1
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di modelcontextprotocol/python-sdk
-
v2
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 86/100
modelcontextprotocol/python-sdk#3978 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Client serves cached tools after its context exits with an exceptionForse già presa @jonxsong l’ha presa 1 giorno fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
modelcontextprotocol/python-sdk#3968 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
modelcontextprotocol/python-sdk#3957 ·
I maintainer di solito rispondono entro 1 giorno
-
v2
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 91/100
modelcontextprotocol/python-sdk#3934 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
bug v1
Difficoltà 2/5 1-3 ore Idoneità per principianti 79/100
modelcontextprotocol/python-sdk#3929 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di modelcontextprotocol/python-sdk
Issue simili
-
soup prune-prompt exits 1 after writing its output on a file over 100,000 rows, and reports a capped row count otherwiseForse già presa @abdulwaarith0 l’ha presa oggi. Apertaneeds-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
MakazhanAlpamys/Soup#3690 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
bug data-types native-format
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
ClickHouse/clickhouse-connect#1320 ·
I maintainer di solito rispondono entro 1 giorno
-
Public benchmark import end-to-end test fails when the test stack's worker runs the parity jobApertaaccepted
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
future-agi/future-agi#6392 ·
I maintainer di solito rispondono entro 1 giorno