Advanced MCP
Resources, prompts, tool search
How advanced MCP features work
MCP (Model Context Protocol) is the open protocol Claude Code uses to talk to external data sources and tools. This lesson is not about wiring up a basic server — it is about the four mechanisms that make such an integration genuinely useful: resources, prompts, tool search, and running Claude Code itself as an MCP server. A resource is any named blob of data a server exposes: a database schema, an issue body, a local file, a Notion page. You reference a resource with the @ symbol right in your request, and Claude pulls its contents into context. For example, @postgres://users/schema means "read the real schema of the users table from the connected postgres server" — the model reads actual data instead of guessing the structure.
The config block under "Claude Code as MCP Server" shows the inverse case. Setting "command": "claude" with the mcp serve argument registers Claude Code itself as a server inside another application. After that an external agent, an editor plugin, or a CI/CD pipeline can invoke Claude Code the same way Claude invokes any other MCP tool — handy when you want the model's reasoning embedded in an automated workflow. The "Output Management" block solves a practical problem: servers often return huge responses. maxTokens: 5000 caps the size of a single response, and a cursor holding the next-page token (pagination) lets you read the rest in chunks without overflowing the context window.
When to use it. Reach for @ mentions when you know exactly which slice of data the model needs — it saves tokens and removes guesswork. MCP prompts (like /mcp-github:create-pr) are good for repeatable command templates. Tool search kicks in automatically once you have many servers and keeping every description in context gets expensive. Common pitfalls: mentioning a resource the server does not expose (Claude gets an empty result); forgetting output limits and hitting context overflow; and confusing the connection scope — a server added locally is not visible in the shared project config. Grasping these four mechanisms turns MCP from "just another connector" into a real data layer for the agent.
Resources are data that servers expose to Claude. You can mention them via @.
Prompts are predefined command templates from MCP servers.
When there are many MCP servers, Claude searches for the right tool by description.
Use @ to reference MCP resources in your queries:
@postgres://schemaDatabase schema@github://issues/123Specific issue@file:///path/to/doc.mdLocal file@notion://page/abcNotion pageClaude Code itself can act as an MCP server for other applications:
// claude-code-mcp-server
// Claude Code сам может быть MCP сервером
// В другом приложении:
{
"mcpServers": {
"claude-code": {
"command": "claude",
"args": ["mcp", "serve"]
}
}
}
// Теперь другие агенты могут использовать Claude Code💡 This allows using Claude Code capabilities from IDE plugins, CI/CD, or other AI agents
MCP servers can return lots of data. Claude manages this:
Token Limits
Servers can specify maximum tokens in response
maxTokens: 5000Pagination
Large results are split into pages
cursor: "next_page_token"Advanced Tips
- •Use @ mentions for precise context specification
- •MCP Prompts work like custom commands
- •With many servers, Claude automatically searches for the right tool
- •Claude Code as MCP server — powerful automation pattern
Frequently asked questions
What are MCP resources and how do @ mentions work in Claude Code?
A resource is a named blob of data an MCP server exposes: a database schema, an issue body, a local file, or a Notion page. To pull a resource into context, reference it with the @ symbol right in your request. For example, @postgres://users/schema means "read the real schema of the users table from the connected postgres server" — the model reads actual data instead of guessing the structure.
How do I run Claude Code as an MCP server for another application?
In the other application's config, add a server with command "claude" and the mcp-serve argument. After that an external agent, an editor plugin, or a CI/CD pipeline can invoke Claude Code the same way Claude invokes any other MCP tool — useful when you want the model's reasoning embedded in an automated workflow.
How do I limit MCP server output so it doesn't overflow the context?
MCP servers often return huge responses. The maxTokens parameter (e.g. maxTokens: 5000) caps the size of a single response, and a cursor holding the next-page token enables pagination — the rest of the data is read in chunks without overflowing the model's context window.
How are MCP prompts different from regular commands in Claude Code?
MCP prompts are predefined command templates provided by the MCP server itself, like /mcp-github:create-pr. They work like custom slash commands and are good for repeatable actions. Unlike resources (which pull data in via @), prompts trigger a ready-made flow on the server side.
This lesson is part of a structured LLM course.
My Learning Path