modelcontextprotocol / modelcontextprotocol/python-sdk
Specifying capabilities w/ FastMCP Server
Dieses Issue hat noch niemand übernommen.
- #1043 von @gspencergoog — ohne Merge geschlossen
- Vorherrschende Sprache
- Python
- Sterne
- 24.3k
- Forks
- 4k
- Ø Merge
- 1 T. 1 Std.
- Gemergte PRs (30 T.)
- 31
Beschreibung
Question
I noticed that the FastMCP server does not have the options to manually specify the capabilities of the server, however it is possible to do so with the low-level server.
My current workaround to advertise the capabilities is like so:
mcp = FastMCP("test-server")
# Manually set notification options
lowlevel_server: Server = mcp._mcp_server
lowlevel_server.notification_options.resources_changed = True
lowlevel_server.notification_options.tools_changed = True
# Now, we override the mcp.run()
async def main():
async with stdio_server() as (r, w):
init_opts = lowlevel_server.create_initialization_options(
lowlevel_server.notification_options,
{}
)
await lowlevel_server.run(r, w, init_opts)
if __name__ == "__main__":
anyio.run(main)
Is there any other way to specify the capabilities of the FastMCP server? Is there a reason not to?
Thanks!
Additional Context
No response
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne damit, den FastMCP-Einstiegspunkt und die im Bericht aufgeführten Low-Level-Servermethoden zu lesen: notification_options, create_initialization_options und run. Ermittle, wie die FastMCP-Initialisierung derzeit Capabilities bereitstellt, und definiere „done“ als die Möglichkeit, diese Capabilities anzugeben, ohne mcp.run() zu überschreiben.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- python
- Bereich
- api
- Issue-Typ
- Feature
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100