mcp-server-integration
Connect mcp-agent applications to MCP servers and expose MCPApp workflows as FastMCP servers.
- License 许可
- Apache-2.0
- 最近更新
- 2026-10-08
- Stars
- ★ 11
- Forks
- 3
01 前言 Front Matter
- name
- mcp-server-integration
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Connect mcp-agent applications to MCP servers and expose MCPApp workflows as FastMCP servers.
- disable-model-invocation
- true
02 资源文件 4
- 参考文档references/configuration.md7.5 KB
- 参考文档references/oauth-and-auth.md9.4 KB
- 参考文档references/server-and-client-workflows.md9.1 KB
- 参考文档references/troubleshooting.md8.8 KB
03 SKILL.md 正文
MCP Server Integration
Use this sub-skill when an agent needs to connect an mcp-agent app to upstream MCP servers or expose an MCPApp itself as an MCP server. It covers transport configuration, server registry behavior, connection lifecycle, MCP primitives, OAuth/authentication, roots, sampling, elicitation, and safe client-install preparation.
Start Here
- For app and agent construction, first read
../core-sdk/SKILL.md, then return here for server wiring. - Choose the direction:
- Consume upstream MCP servers: configure
mcp.servers, attach agents withserver_names, or usegen_client/MCPAggregatordirectly. - Expose this app as an MCP server: decorate tools/workflows on
MCPApp, then callcreate_mcp_server_for_app(app, **kwargs). - Prepare client installation/deployment: use the checks here, then follow
../cli-cloud-operations/SKILL.mdfor CLI install/deploy commands.
- Consume upstream MCP servers: configure
- Read the closest bundled reference:
references/configuration.mdforMCPServerSettings, transports, roots, registry, and client install dry-runs.references/server-and-client-workflows.mdforcreate_mcp_server_for_app, workflow tools, decorators, primitives, aggregators, sampling, and elicitation.references/oauth-and-auth.mdfor downstream OAuth servers, token storage, pre-authorization, and OAuth-protected app servers.references/troubleshooting.mdfor common failure modes and fixes.
- Use bundled scripts before running real services:
scripts/validate_server_config.py --helpscripts/validate_server_config.py path/to/mcp_agent.config.yaml --check-executablesscripts/minimal_app_server.py --helpscripts/minimal_app_server.py --mode dry-run --json
Upstream Server Checklist
- Define every upstream server under
mcp.servers.<server_name>and make sure the agent/workflow uses the same exactserver_name. - Use
transport: stdiowithcommandandargs; usesse,streamable_http, orwebsocketwithurl. - Put bearer/API tokens in
headersor secrets-backed placeholders; useauth.oauthonly for delegated OAuth flows. - Set
rootsasfile://URIs when a server needs declared filesystem access, and includeserver_uri_aliasonly when the server expects a different mounted URI. - Use
allowed_toolsto restrict high-risk or collision-prone tool surfaces before exposing them to an LLM. - Prefer
gen_client(server_name, app.context.server_registry, context=app.context)for a direct client session andMCPAggregator([...])when an agent needs a combined tools/resources/prompts surface.
App Server Checklist
- Register simple callable tools with
@app.toolfor synchronous results and@app.async_toolwhen callers should receiveworkflow_id/run_idand poll later. - Register workflow classes with
@app.workflowand@app.workflow_runwhen the workflow needs explicit workflow semantics or signals. - Wrap the running app with
create_mcp_server_for_app(agent_app, **fastmcp_kwargs)only afterasync with app.run() as agent_app. - Expect generic workflow tools:
workflows-list,workflows-runs-list,workflows-run,workflows-get_status,workflows-resume,workflows-cancel, andworkflows-store-credentials. - For explicit workflow classes, expect per-workflow tools named
workflows-<WorkflowName>-run; decorator tools expose their declared names instead. - Avoid starting public network transports during validation; use
scripts/minimal_app_server.py --mode dry-runto inspect the expected surface first.
MCP Primitives
- Tools: call with
agent.call_tool(...),session.call_tool(...), or let an attached LLM invoke allowed tools. - Resources: list/read with
list_resources()andread_resource(uri). - Prompts: list/get with
list_prompts()andget_prompt(...); use agent prompt helpers when combining prompts with resource content. - Roots: configure
rootson the server entry; validate every URI starts withfile://. - Sampling: provide an
MCPApphuman-input callback when nested servers may request LLM sampling approval. - Elicitation: provide an
MCPAppelicitation callback when servers may callelicitation/create; schema fields must stay primitive (str,int,float,bool).
When Not To Use This Sub-skill
- Use
../core-sdk/SKILL.mdfor basicMCPApp,Agent, LLM, and workflow construction before server integration. - Use
../durable-execution/SKILL.mdfor Temporal worker operations and durable workflow runtime management. - Use
../cli-cloud-operations/SKILL.mdfor CLI command syntax, cloud deployment, and hosted app lifecycle operations.
04 同仓库更多 Skills
obsidian-clipper-template-creator
Guide for creating templates for the Obsidian Web Clipper. Use when you want to create a new clipping template, understand available variables, or format clipped content.
obsidian-clipper-template-creator
Guide for creating templates for the Obsidian Web Clipper. Use when you want to create a new clipping template, understand available variables, or format clipped content.
python-api
Programmatic Object-Detection-Metrics API guidance for BoundingBox, BoundingBoxes, Evaluator, enums, coordinate conversion, AP/mAP semantics, and source-style import diagnostics.
file-evaluation
Folder-based PASCAL VOC AP/mAP evaluation from ground-truth and detection text files.
object-detection-metrics
Guides legacy Object-Detection-Metrics PASCAL VOC AP/mAP evaluation from detection text folders and direct Python API classes.
nx-workspace-patterns
Configure and optimize Nx monorepo workspaces. Use when setting up Nx, configuring project boundaries, optimizing build caching, or implementing affected commands.