MCPServer: public hooks for tool input schemas, capabilities and handler removal
Mantenedores costumam responder em até 1 dia
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 4/5
- Tempo estimado
- 3-5 dias
- Facilidade para iniciantes
- 43/100
Direção de pesquisa
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.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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).
- Linguagem predominante
- Python
- Estrelas
- 25k
- Forks
- 4.2k
- Merge médio
- 10min
- PRs com merge (30d)
- 1
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Tem um modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de modelcontextprotocol/python-sdk
-
v2
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 86/100
modelcontextprotocol/python-sdk#3978 · 2 comentários ·
Mantenedores costumam responder em até 1 dia
-
Client serves cached tools after its context exits with an exceptionTalvez já em andamento @jonxsong assumiu há 1 dia. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 65/100
modelcontextprotocol/python-sdk#3968 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 85/100
modelcontextprotocol/python-sdk#3957 ·
Mantenedores costumam responder em até 1 dia
-
v2
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 91/100
modelcontextprotocol/python-sdk#3934 · 2 comentários ·
Mantenedores costumam responder em até 1 dia
-
bug v1
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 79/100
modelcontextprotocol/python-sdk#3929 · 2 comentários ·
Mantenedores costumam responder em até 1 dia
Todas as issues de modelcontextprotocol/python-sdk
Issues semelhantes
-
auto-reported bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 62/100
Mantenedores costumam responder em até 1 dia
-
stix-atlas.json: the same relationship id is used for several different mitigates relationshipsAberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 76/100
-
backend bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 86/100
nolte/kamerplanter#3193 ·
Mantenedores costumam responder em até 1 dia
-
soup prune-prompt exits 1 after writing its output on a file over 100,000 rows, and reports a capped row count otherwiseTalvez já em andamento @abdulwaarith0 assumiu hoje. Abertaneeds-triage
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 84/100
MakazhanAlpamys/Soup#3690 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
Mantenedores costumam responder em até 1 dia